Unable to Connect to JDBC Connection Pool from Glassfish











up vote
14
down vote

favorite
4












I am running GlassFish Server Open Source Edition 3.1.2.2 (build 5) with MySql



I have created a JDBC Connection Pool using NetBeans.



Googled this problem I found that adding it is a classpath issue.
Connecting a MySQL database to Glassfish classpath is not set or classname is wrong
and
http://bhapca.blogspot.in/2009/06/class-name-is-wrong-or-classpath-is-not.html
Added the jar in the directory.



C:Program Filesglassfish-3.1.2.2glassfishdomainsdomain1lib


and also tried in



C:Program Filesglassfish-3.1.2.2glassfishdomainsdomain1libext


Restarted the server many times. Re-created connection pool .Still No Success.



I get this when i try pinging it from Admin Console



Error An error has occurred
Ping Connection Pool failed for AffableBeanPool. Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource Please check the server.log for more details.


related server log entry:



Log Entry Detail

Timestamp

Jul 15, 2013 15:45:49.340
Log Level

WARNING
Logger

javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service
Name-Value Pairs

_ThreadID=22;_ThreadName=Thread-2;
Record Number

3172
Message ID

RAR8054
Complete Message

Exception while creating an unpooled [test] connection for pool [ AffableBeanPool ], Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource


and



Log Entry Detail

Timestamp

Jul 15, 2013 15:39:33.777
Log Level

SEVERE
Logger

javax.enterprise.resource.resourceadapter.com.sun.gjc.util
Name-Value Pairs

_ThreadID=27;_ThreadName=Thread-2;
Record Number

3153
Message ID

Complete Message

RAR5099 : Wrong class name or classpath for Datasource Object java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlDataSource at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) at com.sun.gjc.common.DataSourceObjectBuilder.getDataSourceObject(DataSourceObjectBuilder.java:285) at com.sun.gjc.common.DataSourceObjectBuilder.constructDataSourceObject(DataSourceObjectBuilder.java:114) at com.sun.gjc.spi.ManagedConnectionFactory.getDataSource(ManagedConnectionFactory.java:1307) at com.sun.gjc.spi.DSManagedConnectionFactory.getDataSource(DSManagedConnectionFactory.java:163) at com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:102) at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.getUnpooledConnection(ConnectorConnectionPoolAdminServiceImpl.java:697) at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.testConnectionPool(ConnectorConnectionPoolAdminServiceImpl.java:426) at com.sun.enterprise.connectors.ConnectorRuntime.pingConnectionPool(ConnectorRuntime.java:1086) at org.glassfish.connectors.admin.cli.PingConnectionPool.execute(PingConnectionPool.java:130) at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085) at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259) at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:214) at org.glassfish.admin.rest.resources.TemplateExecCommand.executeCommand(TemplateExecCommand.java:127) at org.glassfish.admin.rest.resources.TemplateCommandGetResource.processGet(TemplateCommandGetResource.java:78) at sun.reflect.GeneratedMethodAccessor188.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205) at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288) at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469) at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339) at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer._service(GrizzlyContainer.java:182) at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer.service(GrizzlyContainer.java:147) at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:148) at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179) at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117) at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) at com.sun.grizzly.ContextTask.run(ContextTask.java:71) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) at java.lang.Thread.run(Thread.java:662)









share|improve this question
























  • Still No Success. - what are you actually trying to do? Do you get any error messages?
    – Andreas Fester
    Jul 15 '13 at 9:57






  • 1




    Please check the server.log for more details! What are the server.log files saying? I'm using a MySQL pool with the com.mysql.jdbc.jdbc2.optional.MysqlXADataSource without any problems. Cheers
    – SimonSez
    Jul 15 '13 at 10:16










  • @Andreas Please have a look. Added error message.
    – karx
    Jul 15 '13 at 10:16















up vote
14
down vote

favorite
4












I am running GlassFish Server Open Source Edition 3.1.2.2 (build 5) with MySql



I have created a JDBC Connection Pool using NetBeans.



Googled this problem I found that adding it is a classpath issue.
Connecting a MySQL database to Glassfish classpath is not set or classname is wrong
and
http://bhapca.blogspot.in/2009/06/class-name-is-wrong-or-classpath-is-not.html
Added the jar in the directory.



C:Program Filesglassfish-3.1.2.2glassfishdomainsdomain1lib


and also tried in



C:Program Filesglassfish-3.1.2.2glassfishdomainsdomain1libext


Restarted the server many times. Re-created connection pool .Still No Success.



I get this when i try pinging it from Admin Console



Error An error has occurred
Ping Connection Pool failed for AffableBeanPool. Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource Please check the server.log for more details.


related server log entry:



Log Entry Detail

Timestamp

Jul 15, 2013 15:45:49.340
Log Level

WARNING
Logger

javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service
Name-Value Pairs

_ThreadID=22;_ThreadName=Thread-2;
Record Number

3172
Message ID

RAR8054
Complete Message

Exception while creating an unpooled [test] connection for pool [ AffableBeanPool ], Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource


and



Log Entry Detail

Timestamp

Jul 15, 2013 15:39:33.777
Log Level

SEVERE
Logger

javax.enterprise.resource.resourceadapter.com.sun.gjc.util
Name-Value Pairs

_ThreadID=27;_ThreadName=Thread-2;
Record Number

3153
Message ID

Complete Message

RAR5099 : Wrong class name or classpath for Datasource Object java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlDataSource at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) at com.sun.gjc.common.DataSourceObjectBuilder.getDataSourceObject(DataSourceObjectBuilder.java:285) at com.sun.gjc.common.DataSourceObjectBuilder.constructDataSourceObject(DataSourceObjectBuilder.java:114) at com.sun.gjc.spi.ManagedConnectionFactory.getDataSource(ManagedConnectionFactory.java:1307) at com.sun.gjc.spi.DSManagedConnectionFactory.getDataSource(DSManagedConnectionFactory.java:163) at com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:102) at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.getUnpooledConnection(ConnectorConnectionPoolAdminServiceImpl.java:697) at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.testConnectionPool(ConnectorConnectionPoolAdminServiceImpl.java:426) at com.sun.enterprise.connectors.ConnectorRuntime.pingConnectionPool(ConnectorRuntime.java:1086) at org.glassfish.connectors.admin.cli.PingConnectionPool.execute(PingConnectionPool.java:130) at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085) at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259) at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:214) at org.glassfish.admin.rest.resources.TemplateExecCommand.executeCommand(TemplateExecCommand.java:127) at org.glassfish.admin.rest.resources.TemplateCommandGetResource.processGet(TemplateCommandGetResource.java:78) at sun.reflect.GeneratedMethodAccessor188.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205) at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288) at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469) at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339) at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer._service(GrizzlyContainer.java:182) at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer.service(GrizzlyContainer.java:147) at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:148) at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179) at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117) at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) at com.sun.grizzly.ContextTask.run(ContextTask.java:71) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) at java.lang.Thread.run(Thread.java:662)









share|improve this question
























  • Still No Success. - what are you actually trying to do? Do you get any error messages?
    – Andreas Fester
    Jul 15 '13 at 9:57






  • 1




    Please check the server.log for more details! What are the server.log files saying? I'm using a MySQL pool with the com.mysql.jdbc.jdbc2.optional.MysqlXADataSource without any problems. Cheers
    – SimonSez
    Jul 15 '13 at 10:16










  • @Andreas Please have a look. Added error message.
    – karx
    Jul 15 '13 at 10:16













up vote
14
down vote

favorite
4









up vote
14
down vote

favorite
4






4





I am running GlassFish Server Open Source Edition 3.1.2.2 (build 5) with MySql



I have created a JDBC Connection Pool using NetBeans.



Googled this problem I found that adding it is a classpath issue.
Connecting a MySQL database to Glassfish classpath is not set or classname is wrong
and
http://bhapca.blogspot.in/2009/06/class-name-is-wrong-or-classpath-is-not.html
Added the jar in the directory.



C:Program Filesglassfish-3.1.2.2glassfishdomainsdomain1lib


and also tried in



C:Program Filesglassfish-3.1.2.2glassfishdomainsdomain1libext


Restarted the server many times. Re-created connection pool .Still No Success.



I get this when i try pinging it from Admin Console



Error An error has occurred
Ping Connection Pool failed for AffableBeanPool. Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource Please check the server.log for more details.


related server log entry:



Log Entry Detail

Timestamp

Jul 15, 2013 15:45:49.340
Log Level

WARNING
Logger

javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service
Name-Value Pairs

_ThreadID=22;_ThreadName=Thread-2;
Record Number

3172
Message ID

RAR8054
Complete Message

Exception while creating an unpooled [test] connection for pool [ AffableBeanPool ], Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource


and



Log Entry Detail

Timestamp

Jul 15, 2013 15:39:33.777
Log Level

SEVERE
Logger

javax.enterprise.resource.resourceadapter.com.sun.gjc.util
Name-Value Pairs

_ThreadID=27;_ThreadName=Thread-2;
Record Number

3153
Message ID

Complete Message

RAR5099 : Wrong class name or classpath for Datasource Object java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlDataSource at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) at com.sun.gjc.common.DataSourceObjectBuilder.getDataSourceObject(DataSourceObjectBuilder.java:285) at com.sun.gjc.common.DataSourceObjectBuilder.constructDataSourceObject(DataSourceObjectBuilder.java:114) at com.sun.gjc.spi.ManagedConnectionFactory.getDataSource(ManagedConnectionFactory.java:1307) at com.sun.gjc.spi.DSManagedConnectionFactory.getDataSource(DSManagedConnectionFactory.java:163) at com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:102) at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.getUnpooledConnection(ConnectorConnectionPoolAdminServiceImpl.java:697) at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.testConnectionPool(ConnectorConnectionPoolAdminServiceImpl.java:426) at com.sun.enterprise.connectors.ConnectorRuntime.pingConnectionPool(ConnectorRuntime.java:1086) at org.glassfish.connectors.admin.cli.PingConnectionPool.execute(PingConnectionPool.java:130) at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085) at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259) at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:214) at org.glassfish.admin.rest.resources.TemplateExecCommand.executeCommand(TemplateExecCommand.java:127) at org.glassfish.admin.rest.resources.TemplateCommandGetResource.processGet(TemplateCommandGetResource.java:78) at sun.reflect.GeneratedMethodAccessor188.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205) at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288) at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469) at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339) at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer._service(GrizzlyContainer.java:182) at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer.service(GrizzlyContainer.java:147) at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:148) at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179) at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117) at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) at com.sun.grizzly.ContextTask.run(ContextTask.java:71) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) at java.lang.Thread.run(Thread.java:662)









share|improve this question















I am running GlassFish Server Open Source Edition 3.1.2.2 (build 5) with MySql



I have created a JDBC Connection Pool using NetBeans.



Googled this problem I found that adding it is a classpath issue.
Connecting a MySQL database to Glassfish classpath is not set or classname is wrong
and
http://bhapca.blogspot.in/2009/06/class-name-is-wrong-or-classpath-is-not.html
Added the jar in the directory.



C:Program Filesglassfish-3.1.2.2glassfishdomainsdomain1lib


and also tried in



C:Program Filesglassfish-3.1.2.2glassfishdomainsdomain1libext


Restarted the server many times. Re-created connection pool .Still No Success.



I get this when i try pinging it from Admin Console



Error An error has occurred
Ping Connection Pool failed for AffableBeanPool. Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource Please check the server.log for more details.


related server log entry:



Log Entry Detail

Timestamp

Jul 15, 2013 15:45:49.340
Log Level

WARNING
Logger

javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service
Name-Value Pairs

_ThreadID=22;_ThreadName=Thread-2;
Record Number

3172
Message ID

RAR8054
Complete Message

Exception while creating an unpooled [test] connection for pool [ AffableBeanPool ], Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource


and



Log Entry Detail

Timestamp

Jul 15, 2013 15:39:33.777
Log Level

SEVERE
Logger

javax.enterprise.resource.resourceadapter.com.sun.gjc.util
Name-Value Pairs

_ThreadID=27;_ThreadName=Thread-2;
Record Number

3153
Message ID

Complete Message

RAR5099 : Wrong class name or classpath for Datasource Object java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlDataSource at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) at com.sun.gjc.common.DataSourceObjectBuilder.getDataSourceObject(DataSourceObjectBuilder.java:285) at com.sun.gjc.common.DataSourceObjectBuilder.constructDataSourceObject(DataSourceObjectBuilder.java:114) at com.sun.gjc.spi.ManagedConnectionFactory.getDataSource(ManagedConnectionFactory.java:1307) at com.sun.gjc.spi.DSManagedConnectionFactory.getDataSource(DSManagedConnectionFactory.java:163) at com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:102) at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.getUnpooledConnection(ConnectorConnectionPoolAdminServiceImpl.java:697) at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.testConnectionPool(ConnectorConnectionPoolAdminServiceImpl.java:426) at com.sun.enterprise.connectors.ConnectorRuntime.pingConnectionPool(ConnectorRuntime.java:1086) at org.glassfish.connectors.admin.cli.PingConnectionPool.execute(PingConnectionPool.java:130) at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085) at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259) at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:214) at org.glassfish.admin.rest.resources.TemplateExecCommand.executeCommand(TemplateExecCommand.java:127) at org.glassfish.admin.rest.resources.TemplateCommandGetResource.processGet(TemplateCommandGetResource.java:78) at sun.reflect.GeneratedMethodAccessor188.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205) at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288) at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469) at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339) at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer._service(GrizzlyContainer.java:182) at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer.service(GrizzlyContainer.java:147) at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:148) at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179) at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117) at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) at com.sun.grizzly.ContextTask.run(ContextTask.java:71) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) at java.lang.Thread.run(Thread.java:662)






mysql sql glassfish






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 23 '17 at 12:19









Community

11




11










asked Jul 15 '13 at 9:55









karx

1301214




1301214












  • Still No Success. - what are you actually trying to do? Do you get any error messages?
    – Andreas Fester
    Jul 15 '13 at 9:57






  • 1




    Please check the server.log for more details! What are the server.log files saying? I'm using a MySQL pool with the com.mysql.jdbc.jdbc2.optional.MysqlXADataSource without any problems. Cheers
    – SimonSez
    Jul 15 '13 at 10:16










  • @Andreas Please have a look. Added error message.
    – karx
    Jul 15 '13 at 10:16


















  • Still No Success. - what are you actually trying to do? Do you get any error messages?
    – Andreas Fester
    Jul 15 '13 at 9:57






  • 1




    Please check the server.log for more details! What are the server.log files saying? I'm using a MySQL pool with the com.mysql.jdbc.jdbc2.optional.MysqlXADataSource without any problems. Cheers
    – SimonSez
    Jul 15 '13 at 10:16










  • @Andreas Please have a look. Added error message.
    – karx
    Jul 15 '13 at 10:16
















Still No Success. - what are you actually trying to do? Do you get any error messages?
– Andreas Fester
Jul 15 '13 at 9:57




Still No Success. - what are you actually trying to do? Do you get any error messages?
– Andreas Fester
Jul 15 '13 at 9:57




1




1




Please check the server.log for more details! What are the server.log files saying? I'm using a MySQL pool with the com.mysql.jdbc.jdbc2.optional.MysqlXADataSource without any problems. Cheers
– SimonSez
Jul 15 '13 at 10:16




Please check the server.log for more details! What are the server.log files saying? I'm using a MySQL pool with the com.mysql.jdbc.jdbc2.optional.MysqlXADataSource without any problems. Cheers
– SimonSez
Jul 15 '13 at 10:16












@Andreas Please have a look. Added error message.
– karx
Jul 15 '13 at 10:16




@Andreas Please have a look. Added error message.
– karx
Jul 15 '13 at 10:16












3 Answers
3






active

oldest

votes

















up vote
25
down vote



accepted










You've placed the jdbc jar in domain folder, try putting it in the Glassfish server folder.
C:Program Filesglassfish-3.1.2.2glassfishlib






share|improve this answer





















  • This did the trick
    – GabrielBB
    Jun 7 '17 at 5:20


















up vote
6
down vote













Right, you lack mysql lib find and download mysql-connector-java-5.x.x-bin.jar copy to E:Projectsglassfish3.1.1glassfishlib then restart server and enjoy !!!






share|improve this answer





















  • That file is already in that folder for me but I am still getting Ping Connection Pool failed for MySQLPool. null Please check the server.log for more details.
    – Darrell
    Nov 7 '14 at 4:59


















up vote
1
down vote













You can put yor mysql connector jar at this place.
It works for me
E:serversglassfish4glassfishdomainsdomain1lib






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f17651423%2funable-to-connect-to-jdbc-connection-pool-from-glassfish%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    25
    down vote



    accepted










    You've placed the jdbc jar in domain folder, try putting it in the Glassfish server folder.
    C:Program Filesglassfish-3.1.2.2glassfishlib






    share|improve this answer





















    • This did the trick
      – GabrielBB
      Jun 7 '17 at 5:20















    up vote
    25
    down vote



    accepted










    You've placed the jdbc jar in domain folder, try putting it in the Glassfish server folder.
    C:Program Filesglassfish-3.1.2.2glassfishlib






    share|improve this answer





















    • This did the trick
      – GabrielBB
      Jun 7 '17 at 5:20













    up vote
    25
    down vote



    accepted







    up vote
    25
    down vote



    accepted






    You've placed the jdbc jar in domain folder, try putting it in the Glassfish server folder.
    C:Program Filesglassfish-3.1.2.2glassfishlib






    share|improve this answer












    You've placed the jdbc jar in domain folder, try putting it in the Glassfish server folder.
    C:Program Filesglassfish-3.1.2.2glassfishlib







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jul 27 '13 at 8:04









    nickrak

    1,4751017




    1,4751017












    • This did the trick
      – GabrielBB
      Jun 7 '17 at 5:20


















    • This did the trick
      – GabrielBB
      Jun 7 '17 at 5:20
















    This did the trick
    – GabrielBB
    Jun 7 '17 at 5:20




    This did the trick
    – GabrielBB
    Jun 7 '17 at 5:20












    up vote
    6
    down vote













    Right, you lack mysql lib find and download mysql-connector-java-5.x.x-bin.jar copy to E:Projectsglassfish3.1.1glassfishlib then restart server and enjoy !!!






    share|improve this answer





















    • That file is already in that folder for me but I am still getting Ping Connection Pool failed for MySQLPool. null Please check the server.log for more details.
      – Darrell
      Nov 7 '14 at 4:59















    up vote
    6
    down vote













    Right, you lack mysql lib find and download mysql-connector-java-5.x.x-bin.jar copy to E:Projectsglassfish3.1.1glassfishlib then restart server and enjoy !!!






    share|improve this answer





















    • That file is already in that folder for me but I am still getting Ping Connection Pool failed for MySQLPool. null Please check the server.log for more details.
      – Darrell
      Nov 7 '14 at 4:59













    up vote
    6
    down vote










    up vote
    6
    down vote









    Right, you lack mysql lib find and download mysql-connector-java-5.x.x-bin.jar copy to E:Projectsglassfish3.1.1glassfishlib then restart server and enjoy !!!






    share|improve this answer












    Right, you lack mysql lib find and download mysql-connector-java-5.x.x-bin.jar copy to E:Projectsglassfish3.1.1glassfishlib then restart server and enjoy !!!







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jul 2 '14 at 3:12









    Mike Nguyen

    7801814




    7801814












    • That file is already in that folder for me but I am still getting Ping Connection Pool failed for MySQLPool. null Please check the server.log for more details.
      – Darrell
      Nov 7 '14 at 4:59


















    • That file is already in that folder for me but I am still getting Ping Connection Pool failed for MySQLPool. null Please check the server.log for more details.
      – Darrell
      Nov 7 '14 at 4:59
















    That file is already in that folder for me but I am still getting Ping Connection Pool failed for MySQLPool. null Please check the server.log for more details.
    – Darrell
    Nov 7 '14 at 4:59




    That file is already in that folder for me but I am still getting Ping Connection Pool failed for MySQLPool. null Please check the server.log for more details.
    – Darrell
    Nov 7 '14 at 4:59










    up vote
    1
    down vote













    You can put yor mysql connector jar at this place.
    It works for me
    E:serversglassfish4glassfishdomainsdomain1lib






    share|improve this answer

























      up vote
      1
      down vote













      You can put yor mysql connector jar at this place.
      It works for me
      E:serversglassfish4glassfishdomainsdomain1lib






      share|improve this answer























        up vote
        1
        down vote










        up vote
        1
        down vote









        You can put yor mysql connector jar at this place.
        It works for me
        E:serversglassfish4glassfishdomainsdomain1lib






        share|improve this answer












        You can put yor mysql connector jar at this place.
        It works for me
        E:serversglassfish4glassfishdomainsdomain1lib







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 17 '15 at 13:46









        Arpit Thakkar

        336




        336






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f17651423%2funable-to-connect-to-jdbc-connection-pool-from-glassfish%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            404 Error Contact Form 7 ajax form submitting

            How to know if a Active Directory user can login interactively

            TypeError: fit_transform() missing 1 required positional argument: 'X'