Hot questions for Using GlassFish in oracle

Question:

I have GlassFish server3.1.2.2 pre installed on my machine. Which I want to use in my Eclipse Luna

How do I manually configure it to use in Eclipse?

When I tried using Eclipse Market Place i got an error No repository found at http://download.oracle.com/otn_software/oepe/luna.

I tried searching through net for which I get pointed to the Oracle Enterprise Pack for Eclipse (OEPE) which is of about 485MB. Is there an another way round for this?


Answer:

You must use Eclipse WTP (Web Tool Platform), and should use the lastest version is Luna 4.4. Link download: Eclipse IDE for Java EE Developers http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/lunar

Menu Windows\Show view\Other, choose folder Server, click on Servers. Right click on blank area to use context menu, choose New\Server

Press link "Download additional server adapters"

Choose "GlassFish Tools" from Oracle vendor. Then, restart Eclipse.

Question:

I'm trying to make an oracle connection pool in my glassfish server. I had a glassfish instalation that was defaultly bundeled with netbeans. After I removed netbeans I donwloaded and now have a separate glassfish folder. On the glassfish from netbeans I had no problem making a connection pool, but when I try to do it on the stand-alone version(the one I downloaded) I get the error :

From the server.log:

java.lang.IllegalStateException: getOutputStream() has already been called for this response
at org.apache.catalina.connector.Response.getWriter(Response.java:777)
at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:224)
at com.sun.faces.context.ExternalContextImpl.getResponseOutputWriter(ExternalContextImpl.java:851)
at com.sun.faces.context.PartialViewContextImpl.createPartialResponseWriter(PartialViewContextImpl.java:504)
at com.sun.faces.context.PartialViewContextImpl.access$300(PartialViewContextImpl.java:79)
at com.sun.faces.context.PartialViewContextImpl$DelayedInitPartialResponseWriter.getWrapped(PartialViewContextImpl.java:642)
at javax.faces.context.PartialResponseWriter.startDocument(PartialResponseWriter.java:120)
at com.sun.faces.context.AjaxExceptionHandlerImpl.handlePartialResponseError(AjaxExceptionHandlerImpl.java:202)
at com.sun.faces.context.AjaxExceptionHandlerImpl.handle(AjaxExceptionHandlerImpl.java:127)
at javax.faces.context.ExceptionHandlerWrapper.handle(ExceptionHandlerWrapper.java:100)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:233)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.doChainInvoke(StandardPipeline.java:678)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:416)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:283)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
at java.lang.Thread.run(Thread.java:745)
]]

Is the problem coming from the glassfish bundeled with netbeans that I removed. And how can I fix this ?


Answer:

Actually I faced the same problem on windows, and it resolved be delete my glassfishe from Prgramfile folder and download new version from http://download.oracle.com/glassfish/4.0/promoted/glassfish-4.0-b87.zip and extract it where you want but not in programfile beacuse it need admin roll and then creat new server.

Question:

Is there any way to disable the use of TLS v1.1 (and v1) for all SSL configured listeners in Glassfish 4.1? I've tried to set the JVM property

-Ddeployment.security.TLSvX.Y=false

as recommended by this Oracle blog post (https://blogs.oracle.com/java-platform-group/entry/java_8_will_use_tls) but the protocols are still being used in the https negotiations.


Answer:

Ok, i've found how to do it by messing around with Glassfish command interface. Run the following commands:

asadmin set configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.tls-enabled=false

asadmin set configs.config.server-config.network-config.protocols.protocol.http-listener-2.ssl.tls11-enabled=false

And this will leave only TLSv1.2 enabled. This commands are run against the default HTTPS listener (port 8181), so remember to run against any other secure HTTP listener if you need to.

Question:

I currently have a application running that needs data from a database to be able to work properly.

Here are the specifics:

  • Glassfish 3.1.2
  • Oracle DB 11.2.0.2.0 (I have limited access here)
  • Java 7/JEE6
  • JDBC Lib oracle-jdbc-11.2.0.3-jdk6.jar
  • I use pooling with a standard configuration by Glassfish when a new connection pool is created
  • The SQLs used are only selects with no joins or other complex structures within
  • They run easily under 30 sec and below depending on the SQL

My problem is that I get the following error messages in infrequent intervals which results in missing data or complete shutdown of the JDBC resource.

[#|2015-10-22T16:25:42.400+0200|WARNING|glassfish3.1.2|javax.enterprise.resource.resourceadapter.com.sun.enterprise.resource.allocator|_ThreadID=461;_ThreadName=Thread-2;|RAR5038:Unexpected exception while creating resource for pool jdbc. Exception : javax.resource.spi.ResourceAllocationException: Connection could not be allocated because: I/O-Fehler: The Network Adapter could not establish the connection|#]

Followed by

[#|2015-10-22T19:10:47.787+0200|WARNING|glassfish3.1.2|javax.enterprise.resource.resourceadapter.com.sun.enterprise.resource.pool|_ThreadID=461;_ThreadName=Thread-2;|RAR5035:Unexpected exception while destroying resource from pool jdbc. Exception message: Error while destroying resource :I/O-Fehler: Unrecognized Windows Sockets error: 0: recv failed|#]
[#|2015-10-22T19:10:48.052+0200|WARNING|glassfish3.1.2|javax.enterprise.resource.resourceadapter.com.sun.enterprise.resource.pool|_ThreadID=461;_ThreadName=Thread-2;|RAR5035:Unexpected exception while destroying resource from pool jdbc. Exception message: Error while destroying resource :I/O-Fehler: Connection reset|#]

Followed by

 [#|2015-10-22T19:11:33.287+0200|WARNING|glassfish3.1.2|javax.enterprise.resource.resourceadapter.com.sun.enterprise.resource.pool|_ThreadID=461;_ThreadName=Thread-2;|RAR5035:Unexpected exception while destroying resource from pool jdbc. Exception message: Error while destroying resource :I/O-Fehler: Socket read timed out|#]

Followed by (removed non relevant parts from my impl with ....)

   #|2015-10-23T16:35:00.087+0200|SEVERE|glassfish3.1.2|javax.enterprise.resource.resourceadapter.com.sun.enterprise.resource|_ThreadID=576;_ThreadName=Thread-2;|RAR5031:System Exception
   javax.resource.spi.LocalTransactionException: Getrennte Verbindung
    at com.sun.gjc.spi.LocalTransactionImpl.rollback(LocalTransactionImpl.java:134)
    at com.sun.enterprise.resource.ConnectorXAResource.rollback(ConnectorXAResource.java:213)
    at com.sun.enterprise.transaction.JavaEETransactionImpl.rollback(JavaEETransactionImpl.java:571)
    at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.rollback(JavaEETransactionManagerSimplified.java:893)
    at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:5126)
    at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4915)
    at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2045)
    at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1994)
    at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:222)
    at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
    at com.sun.proxy.$Proxy248.loadData(Unknown Source)
       ....
    at sun.reflect.GeneratedMethodAccessor1663.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1052)
    at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1124)
    at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5388)
    at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:619)
    at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)
    at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:571)
       ....
    at sun.reflect.GeneratedMethodAccessor1559.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:861)
    at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)
    at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:571)
    at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:162)
    at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundTimeout(SystemInterceptorProxy.java:149)
    at sun.reflect.GeneratedMethodAccessor1563.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:861)
    at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)
    at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:370)
    at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5360)
    at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5348)
    at com.sun.ejb.containers.BaseContainer.callEJBTimeout(BaseContainer.java:4058)
    at com.sun.ejb.containers.EJBTimerService.deliverTimeout(EJBTimerService.java:1832)
    at com.sun.ejb.containers.EJBTimerService.access$100(EJBTimerService.java:108)
    at com.sun.ejb.containers.EJBTimerService$TaskExpiredWork.run(EJBTimerService.java:2646)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
   Caused by: java.sql.SQLRecoverableException: Getrennte Verbindung
    at oracle.jdbc.driver.PhysicalConnection.rollback(PhysicalConnection.java:3921)
    at com.sun.gjc.spi.LocalTransactionImpl.rollback(LocalTransactionImpl.java:128)
    ... 50 more

I have programmatic fail safe which opens a new transaction to avoid a ManagedException within in my application and retries three times in case of failure.

However this is apparently to not enough to ensure the stability of the JDBC connection.

What is the problem here?


Answer:

So here's what I tried and worked.

  1. IO Error: The Network Adapter could not establish the connection -> Database was running, URL was correct, Firewall was tested with a custom ping script
  2. java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind (JBOSS) -> The pc was a win7 machine however the argument -Djava.net.preferIPv4Stack=true didn't help
  3. The network adapter could not establish the connection - Oracle 11g -> Replaced my original jdbc 6 Jar with new one listed above, didn't solve the problem
  4. Java JDBC connection status -> This got my thinking

After seeing the post in 4. I tried several configurations in Resources -> JDBC -> JDBC Connection Pools -> jdbc for timeouts etc. I though using

select 1 from SOME_TABLE;

to be the solution. Unfortunately I made the mistake use it like this

Instead of this

The difference by my understanding is that the first validates the connection when it goes into the pool. The second validates it when it's given out the pool to be used by a resource.

Now it seems to work fine.

I hope this helps!

Question:

after to fail to create a jdbc connection pool through glassfish admin console i tried to create a JDBC Connection Pool for Oracle on GlassFish through the Windows command line by typing in this command

 create-jdbc-connection-pool 
 –datasourceclassname oracle.jdbc.pool.OracleDataSource 
 –restype javax.sql.DataSource 
 –property user=user1:password=topSecret:URL="jdbc:oracle:thin:@localhost:1521:XE" MyExampleDB

I get the following error message:

Please help? Is it even possible to create a JDBC Connection Pool with GlassFish? Or better to migrate to WildFly?


Answer:

yes, it's possible to create JDBC Pool in glassfish

I'm not sure about command line syntax, but via admin console it pretty easy

see admin console: http://localhost:4848/common/index.jsf Resources -> JDBC - > JDBC Connection Pools

upd:

command line example

asadmin create-jdbc-connection-pool 
--restype=java.sql.Driver
--driverclassname=oracle.jdbc.pool.OracleDataSource
--property user=myuser:password=mypassword:url='jdbc:oracle:thin:@localhost:1521:xe'
test_ora_pool

Question:

I want to store all my JMS messages to database(for testing how it works). I am using mysql 5.x as database and glassfish 4.1 as application server . I have made the following changes to default.properties for JMS

  1. imq.persist.store=jdbc
  2. imq.brokerid=broker1
  3. imq.persist.jdbc.dbVendor=mysql
  4. imq.persist.jdbc.mysql.user=root
  5. imq.persist.jdbc.mysql.password = password
  6. imq.persist.jdbc.mysql.property.url=jdbc:mysql://localhost:3306/jms

I hace copied mysql connector to ext folder . Now when I run imqdbmgr create all .the following error occurs:

    [#|2016-06-20T13:36:44.473+0530|SEVERE|5.1.1|imq.log.Logger|_ThreadID=1;_ThreadName=main;|ERROR [B3073]: Failed to create database table(s) - null:
com.sun.messaging.jmq.jmsserver.util.BrokerException: [B3073]: Failed to create database table(s) - null
        at com.sun.messaging.jmq.jmsserver.persist.jdbc.DBTool.doCreate(DBTool.java:252)
        at com.sun.messaging.jmq.jmsserver.persist.jdbc.DBTool.doCreate(DBTool.java:194)
        at com.sun.messaging.jmq.jmsserver.persist.jdbc.DBTool.doCommand(DBTool.java:2435)
        at com.sun.messaging.jmq.jmsserver.persist.jdbc.DBTool.main(DBTool.java:2506)
Caused by: com.sun.messaging.jmq.jmsserver.util.BrokerException: [B3025]: No database url specified by imq.persist.jdbc.mysql.createdburl
        at com.sun.messaging.jmq.jmsserver.persist.jdbc.comm.CommDBManager.connectToCreate(CommDBManager.java:726)

What is wrong here . This all works in Glassfish 3.1 . What is problem with glassfish4 ?


Answer:

Specified :

imq.persist.jdbc.mysql.createdburl= jdbc:mysql://localhost:3306/jms

and worked.