[nbj2ee] How to create jdbc resources in embedded glassfish container for tests?

  • From: "volodiaL" < >
  • To:
  • Subject: [nbj2ee] How to create jdbc resources in embedded glassfish container for tests?
  • Date: Tue, 13 Nov 2012 12:25:23 -0500

Hello! 

I can't anyway pass line 
container = javax.ejb.embeddable.EJBContainer.createEJBContainer(); 
I stopped at the following exception: 

Code:
SEVERE: Exception while invoking class 
org.glassfish.persistence.jpa.JPADeployer prepare method  
лист 13, 2012 5:47:34 PM org.glassfish.api.ActionReport failure  
SEVERE: Exception while preparing the app  
лист 13, 2012 5:47:34 PM 
com.sun.enterprise.v3.server.ApplicationLifecycle deploy  
SEVERE: Invalid resource : jdbc/olympicsDS__pm  
java.lang.RuntimeException: Invalid resource : jdbc/olympicsDS__pm  
    at 
com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:540)
  
    at 
com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:469)
  
    at 
org.glassfish.persistence.common.PersistenceHelper.lookupPMResource(PersistenceHelper.java:63)
  
    at 
org.glassfish.persistence.jpa.ProviderContainerContractInfoBase.lookupDataSource(ProviderContainerContractInfoBase.java:71)
  
    at 
org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:108)
  
    at 
org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:155)
  
    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.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:129)
  
    at 
com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:105)
  
    at 
org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:140) 
 
    at 
org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:134)
  
    at 
javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:127)  
    at 
javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)  
    at com.javahelp.tests.JavaHelpTest.setUpClass(JavaHelpTest.java:33)  
    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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
  
    at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
  
    at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
  
    at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27) 
 
    at 
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)  
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)  
    at 
org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
  
    at 
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
  
    at 
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
  
    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.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
  
    at 
org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
  
    at 
org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
  
    at 
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
  
    at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)  
Caused by: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: 
Invalid resource : jdbc/olympicsDS__pm  
    at 
com.sun.enterprise.connectors.service.ConnectorResourceAdminServiceImpl$MyDataSource.validateResource(ConnectorResourceAdminServiceImpl.java:274)
  
    at 
com.sun.enterprise.connectors.service.ConnectorResourceAdminServiceImpl$MyDataSource.setResourceInfo(ConnectorResourceAdminServiceImpl.java:255)
  
    at 
com.sun.enterprise.connectors.service.ConnectorResourceAdminServiceImpl.lookupDataSourceInDAS(ConnectorResourceAdminServiceImpl.java:245)
  
    at 
com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:538)
  
    ... 49 more  



I believe that I should create jdbc connection pool and jdbc resource for 
embedded ejb glassfish container? 
Does anybody know how to create jdbc connection pool and jdbc resource for 
embedded ejb glassfish container? 

Thank you!






[nbj2ee] How to create jdbc resources in embedded glassfish container for tests?

volodiaL 11/13/2012

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close