Skip to main content

[solved]simple question about "connection pools" and datasource

3 replies [Last post]
rageice
Offline
Joined: 2008-05-22

Hello everybody, excuse me for my bad english.

I am trying to create a datasource for hsql in the glassfish server admin console
So, I first have to create a connection pool.
For the "datasource classname" property, I set: org.hsqldb.jdbc.jdbcDatasource and I put hsqldb.jar in $GLASSFISH_HOME/lib/
But after steps, when I try to use the ping from the server admin console, I have the following error:
"Class name is wrong or classpath is not set for : org.hsqldb.jdbc.jdbcDatasource"

Should I copy hsqldb.jar somewhere else?

Thank you in advance.

(
As I am a beginner with j2e application servers, I will write here properties I edit myself during the creation of my connection pool in case someone see an error:

password | apassword
user | auser
database | mydatabasename
url | hsqldb:hsql://localhost

There is something else not really clear for me, in report with datasources.
When we create a datasource from an xml file for hsqldb, generally, the only class we have to set is: org.hsqldb.jdbcDriver
But if I use this in the "datasource classname", I have the following error:
"org.hsqldb.jdbcDriver cannot be cast to javax.sql.DataSource"
I suppose it comes from the difference between connection pool and data source, but it's strange for me (and the org.hsqldb.jdbcDriver is never required apparently during the datasource creation process with the server admin console). So, it is not really clear for me.

)

Message was edited by: rageice

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Shreedhar Ganapathy

Could you try doing the ping after restarting GF domain admin server
after placing the jar in the lib dir ?

glassfish@javadesktop.org wrote:
> Hello everybody, excuse me for my bad english.
>
> I am trying to create a datasource for hsql in the glassfish server admin console
> So, I first have to create a connection pool.
> For the "datasource classname" property, I set: org.hsqldb.jdbc.jdbcDatasource and I put hsqldb.jar in $GLASSFISH_HOME/lib/
> But after steps, when I try to use the ping from the server admin console, I have the following error:
> "Class name is wrong or classpath is not set for : org.hsqldb.jdbc.jdbcDatasource"
>
> Should I copy hsqldb.jar somewhere else?
>
> Thank you in advance.
>
>
> (
> As I am a beginner with j2e application servers, I will write here properties I edit myself during the creation of my connection pool in case someone see an error:
>
> password | apassword
> user | auser
> database | mydatabasename
> url | hsqldb:hsql://localhost
>
> There is something else not really clear for me, in report with datasources.
> When we create a datasource from an xml file for hsqldb, generally, the only class we have to set is: org.hsqldb.jdbcDriver
> But if I use this in the "datasource classname", I have the following error:
> "org.hsqldb.jdbcDriver cannot be cast to javax.sql.DataSource"
> I suppose it comes from the difference between connection pool and data source, but it's strange for me (and the org.hsqldb.jdbcDriver is never required apparently during the datasource creation process with the server admin console). So, it is not really clear for me.
>
> )
> [Message sent by forum member 'rageice' (rageice)]
>
> http://forums.java.net/jive/thread.jspa?messageID=275956
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

rageice
Offline
Joined: 2008-05-22

The solution:

copy hsqldb.jar to $GLASSFISH_HOME/domain/$DOMAIN/lib/

Use org.hsqldb.jdbc.jdbcDataSource for "Datasource classname"

And the "additional properties":
username: yourusername
password: yourpassword
database: jdbc:hsqldb:hsql//your_server/your_db

It looks like easy now... But sincerely, it makes me cry :-)

rageice
Offline
Joined: 2008-05-22

I have solved my initial problem, probably by copying hsqldb.jar to $GLASSFISH_HOME\domains\domain1\lib and restarting the server several times.

I now have the following error when I try to ping:
"Connection object cannot be null"

I really don't know where this error comes from.
If it comes from the properties, this is the additional properties i set:
User: auser
Password : apassword
Database: hsqldb:hsql://localhost/contact

(these are the only important properties I found in the jdbcDataSource class).

I really don't understand what'd happening, any help would be appreciate.

Thank you in advance.

(the full stack trace:

[#|2008-05-22T14:46:05.872+0200|WARNING|sun-appserver9.1|javax.enterprise.resource.resourceadapter|_ThreadID=14;_ThreadName=httpWorkerThread-4848-0;_RequestID=e03d7abd-f5e4-4c1b-a3a5-676f2e19d18e;|Connection object cannot be null|#]

[#|2008-05-22T14:46:05.872+0200|WARNING|sun-appserver9.1|javax.enterprise.system.stream.err|_ThreadID=14;_ThreadName=httpWorkerThread-4848-0;_RequestID=e03d7abd-f5e4-4c1b-a3a5-676f2e19d18e;|java.lang.RuntimeException: javax.resource.ResourceException: Connection object cannot be null
at com.sun.enterprise.tools.admingui.util.JMXUtil.invoke(JMXUtil.java:124)
at com.sun.enterprise.tools.admingui.util.JMXUtil.invoke(JMXUtil.java:75)
at com.sun.enterprise.tools.admingui.handlers.JdbcHandlers.pingJdbcConnectionPool(JdbcHandlers.java:530)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.jsftemplating.layout.descriptors.handler.Handler.invoke(Handler.java:421)
at com.sun.jsftemplating.layout.descriptors.LayoutElementBase.dispatchHandlers(LayoutElementBase.java:343)
at com.sun.jsftemplating.layout.descriptors.LayoutElementBase.dispatchHandlers(LayoutElementBase.java:317)
at com.sun.jsftemplating.layout.event.CommandActionListener.invokeCommandHandlers(CommandActionListener.java:133)
at com.sun.jsftemplating.layout.event.CommandActionListener.processAction(CommandActionListener.java:81)
at javax.faces.event.ActionEvent.processListener(ActionEvent.java:77)
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:746)
at javax.faces.component.UICommand.broadcast(UICommand.java:368)
at com.sun.webui.jsf.component.WebuiCommand.broadcast(WebuiCommand.java:160)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
at com.sun.faces.extensions.avatar.lifecycle.PartialTraversalLifecycle.execute(PartialTraversalLifecycle.java:80)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
at com.sun.enterprise.tools.admingui.servlet.DelayedInitFacesServlet.service(DelayedInitFacesServlet.java:89)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:240)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
at com.sun.enterprise.web.connector.grizzly.WorkerThreadImpl.run(WorkerThreadImpl.java:116)
Caused by: javax.resource.ResourceException: Connection object cannot be null
at com.sun.enterprise.connectors.ConnectorConnectionPoolAdminServiceImpl.testConnectionPool(ConnectorConnectionPoolAdminServiceImpl.java:556)
at com.sun.enterprise.connectors.ConnectorRuntime.testConnectionPool(ConnectorRuntime.java:515)
at com.sun.enterprise.admin.mbeans.ResourcesMBean.pingConnectionPool(ResourcesMBean.java:2387)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:375)
at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:358)
at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:464)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:90)
at $Proxy1.invoke(Unknown Source)
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:304)
at com.sun.enterprise.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:174)
at com.sun.enterprise.tools.admingui.util.JMXUtil.invoke(JMXUtil.java:119)
... 54 more
Caused by: javax.resource.ResourceException: Connection object cannot be null
at com.sun.gjc.spi.ManagedConnection.(ManagedConnection.java:146)
at com.sun.gjc.spi.ManagedConnectionFactory.constructManagedConnection(ManagedConnectionFactory.java:958)
at com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:122)
at com.sun.enterprise.connectors.ConnectorConnectionPoolAdminServiceImpl.getUnpooledConnection(ConnectorConnectionPoolAdminServiceImpl.java:1304)
at com.sun.enterprise.connectors.ConnectorConnectionPoolAdminServiceImpl.testConnectionPool(ConnectorConnectionPoolAdminServiceImpl.java:551)
... 73 more
|#]

)

Message was edited by: rageice