J'utilise GlassFish Server Open Source Edition 3.1.2.2 (build 5) avec MySql
J'ai créé un pool de connexions JDBC à l'aide de NetBeans.
J'ai trouvé ce problème à Google. L'ajout est un problème de chemin de classe . La connexion d'une base de données MySQL au chemin de classe Glassfish n'est pas définie ou nom de classe est incorrect et http://bhapca.blogspot.in/2009/06/class-name-is-wrong-or-classpath-is-not.html Ajout du fichier jar dans le répertoire.
C:\Program Files\glassfish-3.1.2.2\glassfish\domains\domain1\lib
et aussi essayé dans
C:\Program Files\glassfish-3.1.2.2\glassfish\domains\domain1\lib\ext
Redémarrez le serveur plusieurs fois. Pool de connexions recréé .Still No Success.
Je reçois ceci quand j'essaie de le cingler depuis la console d'administration
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.
entrée du journal du serveur associé:
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
et
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)
Vous avez placé le fichier jdbc dans le dossier du domaine. Essayez de le placer dans le dossier du serveur Glassfish.C:\Program Files\glassfish-3.1.2.2\glassfish\lib
Bon, vous n'avez pas besoin de trouver mysql lib et télécharger mysql-connector-Java-5.x.x-bin.jar, copier vers E:\Projects\glassfish3.1.1\glassfish\lib
puis redémarrer le serveur et profiter !!!
Vous pouvez mettre votre jarre de connecteur mysql à cet endroit . Cela fonctionne pour moi E:\servers\glassfish4\glassfish\domain\domain1\lib