Caused by: javax.naming.NameNotFoundException: poo

2019-08-06 10:38发布

问题:

I am fighting this error for a few days already.

I can't find reasonable explanation about it on the Internet: I use Glassfish 3.1.2.2 (build 5)

2012-12-19T17:54:26.046+0200 javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.util
WARNING: RAR8068: Using default datasource : __ds_jdbc_ra for pool : JavaHelpPool
2012-12-19T17:54:26.093+0200 javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service
SEVERE: RAR8061: failed to load resource-adapter-config or RA [ __ds_jdbc_ra ], com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Unable to get active RA for module __ds_jdbc_ra
2012-12-19T17:54:26.093+0200 javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service
SEVERE: RAR8060: Unable to lookup pool [ JavaHelpPool ], javax.naming.NamingException: Lookup failed for '__SYSTEM/pools/JavaHelpPool' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory
.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NameNotFoundException: pools]
2012-12-19T17:54:26.093+0200 javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service
SEVERE: RAR6017 : Failed to get connection pool object jdbc/javahelpds via JNDI lookup : com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Lookup failed for '__SYSTEM/pools/JavaHelpPool' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.cor
ba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
2012-12-19T17:54:26.093+0200 javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.util
WARNING: RAR8068: Using default datasource : __ds_jdbc_ra for pool : JavaHelpPool
2012-12-19T17:54:26.140+0200 javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service
SEVERE: RAR8061: failed to load resource-adapter-config or RA [ __ds_jdbc_ra ], com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Unable to get active RA for module __ds_jdbc_ra
2012-12-19T17:54:26.156+0200 javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service
SEVERE: RAR8060: Unable to lookup pool [ JavaHelpPool ], javax.naming.NamingException: Lookup failed for '__SYSTEM/pools/JavaHelpPool' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory
.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NameNotFoundException: pools]
2012-12-19T17:54:26.156+0200 javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service
SEVERE: RAR6017 : Failed to get connection pool object jdbc/javahelpds via JNDI lookup : com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Lookup failed for '__SYSTEM/pools/JavaHelpPool' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.cor
ba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
2012-12-19T17:54:26.625+0200 org.eclipse.persistence.session.file:/C:/glassfish3/glassfish/domains/domain1/applications/JavaHelp/WEB-INF/classes/_com.javahelp_JavaHelp_war_1.0PU24750959
INFO: EclipseLink, version: Eclipse Persistence Services - 2.3.2.v20111125-r10461
2012-12-19T17:54:26.640+0200 javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.util
WARNING: RAR8068: Using default datasource : __ds_jdbc_ra for pool : JavaHelpPool
2012-12-19T17:54:26.687+0200 javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service
SEVERE: RAR8061: failed to load resource-adapter-config or RA [ __ds_jdbc_ra ], com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Unable to get active RA for module __ds_jdbc_ra
2012-12-19T17:54:26.687+0200 javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service
WARNING: RAR7010: Pool not reachable.
2012-12-19T17:54:26.687+0200 javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service
WARNING: jdbc.exc_get_conn
[#|2012-12-19T17:54:26.687+0200|SEVERE|glassfish3.1.2|org.eclipse.persistence.session.file:/C:/glassfish3/glassfish/domains/domain1/applications/JavaHelp/WEB-INF/classes/_com.javahelp_JavaHelp_war_1.0PU24750959.ejb|_ThreadID=44;_ThreadName=admin-thread-pool-4848(1);|Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: This pool is not registered with the runtime environment : JavaHelpPool
Error Code: 0
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:309)
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:135)
at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:584)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:488)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:294)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:272)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.zeroturnaround.jrebel.integration.eclipselink.EntityManagerFactoryMethodHandler.invokeInternal(EntityManagerFactoryMethodHandler.java:117)
at org.zeroturnaround.jrebel.integration.eclipselink.EntityManagerFactoryMethodHandler.invokeCreateEntityManager(EntityManagerFactoryMethodHandler.java:103)
at org.zeroturnaround.jrebel.integration.eclipselink.EntityManagerFactoryMethodHandler.invoke(EntityManagerFactoryMethodHandler.java:77)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl_$$_javassist_0.createEntityManager(EntityManagerFactoryImpl_$$_javassist_0.java)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:211)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:120)
at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:224)
at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:495)
at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:233)
at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:871)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:410)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
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 com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:461)
at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:212)
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:722)
Caused by: java.sql.SQLException: This pool is not registered with the runtime environment : JavaHelpPool
at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.getConnection(ConnectorConnectionPoolAdminServiceImpl.java:1552)
at com.sun.enterprise.connectors.ConnectorRuntime.getConnection(ConnectorRuntime.java:564)
at com.sun.enterprise.connectors.service.ConnectorResourceAdminServiceImpl$MyDataSource.getConnection(ConnectorResourceAdminServiceImpl.java:283)
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:132)
... 52 more
Caused by: javax.resource.ResourceException: This pool is not registered with the runtime environment : JavaHelpPool
at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.getUnpooledConnection(ConnectorConnectionPoolAdminServiceImpl.java:669)
at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.getConnection(ConnectorConnectionPoolAdminServiceImpl.java:1545)
... 55 more
Caused by: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: This pool is not bound in JNDI : JavaHelpPool
at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.obtainManagedConnectionFactory(ConnectorConnectionPoolAdminServiceImpl.java:1087)
at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.getUnpooledConnection(ConnectorConnectionPoolAdminServiceImpl.java:628)
... 56 more
Caused by: javax.naming.NamingException: Lookup failed for '__SYSTEM/pools/JavaHelpPool' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exc
eption is javax.naming.NameNotFoundException: pools]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:518)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at com.sun.appserv.connectors.internal.api.ResourceNamingService.lookup(ResourceNamingService.java:221)
at com.sun.ent
erprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.getConnectorConnectionPool(ConnectorConnectionPoolAdminServiceImpl.java:870)
at com.sun.enterprise.connectors.service.ConnectorConnectionPoolA
dminServiceImpl.obtainManagedConnectionFactory(ConnectorConnectionPoolAdminServiceImpl.java:1003)
... 57 more
Caused by: javax.naming.NameNotFoundException: pools
at com.sun.enterprise.naming.impl.TransientContext.resolveContext(TransientContext.java:310)
at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:218)
at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:219)
at com.sun.enterprise.naming.impl.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:77)
at com.sun.enterprise.naming.impl.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:119)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:505)
... 63 more

If somebody knows please tell what is it. I pasted __ds_jdbc_ra.jar manually at C:\glassfish3\glassfish\bin\lib\install\applications__ds_jdbc_ra and it does not help!

回答1:

I used exact same glassfish version

This is how I solved it

I use createEjbContainer api without passing properties

look for your temp folder, it creates a glassfish 3 temp domain there

checkin that folder structure under src/test/resources/gfv3

this is what i have

src\test\resources\gfv3
src\test\resources\META-INF
src\test\resources\gfv3\domains
src\test\resources\gfv3\lib
src\test\resources\gfv3\domains\domain1
src\test\resources\gfv3\domains\domain1\config
src\test\resources\gfv3\domains\domain1\config\admin-keyfile
src\test\resources\gfv3\domains\domain1\config\cacerts.jks
src\test\resources\gfv3\domains\domain1\config\cadump.txt
src\test\resources\gfv3\domains\domain1\config\domain.xml
src\test\resources\gfv3\domains\domain1\config\keyfile
src\test\resources\gfv3\domains\domain1\config\keystore.jks
src\test\resources\gfv3\domains\domain1\config\login.conf
src\test\resources\gfv3\domains\domain1\config\server.policy
src\test\resources\gfv3\lib\install
src\test\resources\gfv3\lib\install\applications
src\test\resources\gfv3\lib\install\applications\jaxr-ra
src\test\resources\gfv3\lib\install\applications\jmsra
src\test\resources\gfv3\lib\install\applications\__cp_jdbc_ra
src\test\resources\gfv3\lib\install\applications\__dm_jdbc_ra
src\test\resources\gfv3\lib\install\applications\__ds_jdbc_ra
src\test\resources\gfv3\lib\install\applications\__xa_jdbc_ra
src\test\resources\gfv3\lib\install\applications\jaxr-ra\jaxr-ra.jar
src\test\resources\gfv3\lib\install\applications\jmsra\fscontext.jar
src\test\resources\gfv3\lib\install\applications\jmsra\imqbroker.jar
src\test\resources\gfv3\lib\install\applications\jmsra\imqjmsbridge.jar
src\test\resources\gfv3\lib\install\applications\jmsra\imqjmsra.jar
src\test\resources\gfv3\lib\install\applications\jmsra\imqjmx.jar
src\test\resources\gfv3\lib\install\applications\jmsra\imqstomp.jar
src\test\resources\gfv3\lib\install\applications\__cp_jdbc_ra\__cp_jdbc_ra.jar
src\test\resources\gfv3\lib\install\applications\__dm_jdbc_ra\__dm_jdbc_ra.jar
src\test\resources\gfv3\lib\install\applications\__ds_jdbc_ra\__ds_jdbc_ra.jar
src\test\resources\gfv3\lib\install\applications\__xa_jdbc_ra\__xa_jdbc_ra.jar
src\test\resources\META-INF\persistence.xml

Then you can edit domain.xml add datasources there

then use code to test ejb

I used glassfish v3, maven, oracle db

Map&lt;String, Object&gt; p = new HashMap&lt;String, Object&gt;();
//        p.put(EJBContainer.APP_NAME, "TON_APP_NAME");

        File[] modules = {
            new File("target/test-classes"),
            new File("target/classes")

        };
        p.put(EJBContainer.MODULES, modules);
        p.put("org.glassfish.ejb.embedded.glassfish.installation.root", "src/test/resources/gfv3");

        ejbContainer = EJBContainer.createEJBContainer(p);
        ctx = ejbContainer.getContext();
        ejbFacade = (AllocnGrpFacade) ctx.lookup("java:global/classes/AllocnGrpFacade");

good luck