Skip to main content

Exception while preparing the app : Invalid resource : jdbc

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
7 replies [Last post]
eve2
Offline
Joined: 2007-01-05

Hello,
I have just installed the new release of glassfish 3.1 but I am having problemsdeploying my application which was deployed fine on previous version ofglassfish.
I read by Googling -
http://java.net/jira/browse/GLASSFISH-13672
http://javahowto.blogspot.com/2011/02/sample-glassfish-resourcesxml.html
http://blogs.sun.com/vkraemer/entry/supporting_glassfish_resources_xml
that I need to create a glassfish-resources.xml put it somewhere even though I have a persistence.xml file.The application is a full ear. I can see examples of glassfish-resources.xmlbut I am using netbeans 7 beta, so how do I create it and where doI place it in my project?
I have dir -
Enterprise app project Enterprise-app-client ejb-module war

So do I create a META-INF dir in my ejb-module dir and place the glassfish-resources.xml in there?
Please help.
Thanks eve

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
eve2
Offline
Joined: 2007-01-05

Sorry,
I forgot to add the log from server.
[#|2011-03-11T03:34:56.527+0000|SEVERE|glassfish3.1|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=36;_ThreadName=Thread-1;|Invalid resource : jdbc/_ENTERPRISEDB__pmorg.glassfish.deployment.common.DeploymentException: Invalid resource : jdbc/_ENTERPRISEDB__pm at org.glassfish.javaee.full.deployment.EarDeployer.prepare(EarDeployer.java:166) at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:870) 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:370) at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1067) at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1247) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235) at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:465) at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:222) at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168) at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:234) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225) 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)Caused by: java.lang.RuntimeException: Invalid resource : jdbc/_ENTERPRISEDB__pm at com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:539) at com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:468) 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.(PersistenceUnitInfoImpl.java:108) at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:154) at org.glassfish.persistence.jpa.PersistenceUnitLoader.(PersistenceUnitLoader.java:119) at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:213) at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:486) at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:220) at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:166) at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:870) at org.glassfish.javaee.full.deployment.EarDeployer.prepareBundle(EarDeployer.java:290) at org.glassfish.javaee.full.deployment.EarDeployer.access$200(EarDeployer.java:86) at org.glassfish.javaee.full.deployment.EarDeployer$1.doBundle(EarDeployer.java:141) at org.glassfish.javaee.full.deployment.EarDeployer$1.doBundle(EarDeployer.java:138) at org.glassfish.javaee.full.deployment.EarDeployer.doOnBundles(EarDeployer.java:215) at org.glassfish.javaee.full.deployment.EarDeployer.doOnAllTypedBundles(EarDeployer.java:224) at org.glassfish.javaee.full.deployment.EarDeployer.doOnAllBundles(EarDeployer.java:250) at org.glassfish.javaee.full.deployment.EarDeployer.prepare(EarDeployer.java:138) ... 29 moreCaused by: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Invalid resource : jdbc/_ENTERPRISEDB__pm at com.sun.enterprise.connectors.service.ConnectorResourceAdminServiceImpl$MyDataSource.validateResource(ConnectorResourceAdminServiceImpl.java:272) at com.sun.enterprise.connectors.service.ConnectorResourceAdminServiceImpl$MyDataSource.setResourceInfo(ConnectorResourceAdminServiceImpl.java:253) at com.sun.enterprise.connectors.service.ConnectorResourceAdminServiceImpl.lookupDataSourceInDAS(ConnectorResourceAdminServiceImpl.java:243) at com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:537) ... 48 more|#]
[#|2011-03-11T03:34:56.613+0000|SEVERE|glassfish3.1|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=36;_ThreadName=Thread-1;|Exception while preparing the app : Invalid resource : jdbc/_ENTERPRISEDB__pmjava.lang.RuntimeException: Invalid resource : jdbc/_ENTERPRISEDB__pm at com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:539) at com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:468) 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.(PersistenceUnitInfoImpl.java:108) at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:154) at org.glassfish.persistence.jpa.PersistenceUnitLoader.(PersistenceUnitLoader.java:119) at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:213) at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:486) at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:220) at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:166) at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:870) at org.glassfish.javaee.full.deployment.EarDeployer.prepareBundle(EarDeployer.java:290) at org.glassfish.javaee.full.deployment.EarDeployer.access$200(EarDeployer.java:86) at org.glassfish.javaee.full.deployment.EarDeployer$1.doBundle(EarDeployer.java:141) at org.glassfish.javaee.full.deployment.EarDeployer$1.doBundle(EarDeployer.java:138) at org.glassfish.javaee.full.deployment.EarDeployer.doOnBundles(EarDeployer.java:215) at org.glassfish.javaee.full.deployment.EarDeployer.doOnAllTypedBundles(EarDeployer.java:224) at org.glassfish.javaee.full.deployment.EarDeployer.doOnAllBundles(EarDeployer.java:250) at org.glassfish.javaee.full.deployment.EarDeployer.prepare(EarDeployer.java:138) at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:870) 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:370) at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1067) at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1247) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235) at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:465) at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:222) at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168) at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:234) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225) 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)Caused by: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Invalid resource : jdbc/_ENTERPRISEDB__pm at com.sun.enterprise.connectors.service.ConnectorResourceAdminServiceImpl$MyDataSource.validateResource(ConnectorResourceAdminServiceImpl.java:272) at com.sun.enterprise.connectors.service.ConnectorResourceAdminServiceImpl$MyDataSource.setResourceInfo(ConnectorResourceAdminServiceImpl.java:253) at com.sun.enterprise.connectors.service.ConnectorResourceAdminServiceImpl.lookupDataSourceInDAS(ConnectorResourceAdminServiceImpl.java:243) at com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:537) ... 48 more

Thanks
eve
From: gorgeous65@msn.com
To: ; ; persistence@glassfish.java.net
Subject: Exception while preparing the app : Invalid resource : jdbc
Date: Fri, 11 Mar 2011 03:56:09 +0000

Hello,
I have just installed the new release of glassfish 3.1 but I am having problemsdeploying my application which was deployed fine on previous version ofglassfish.
I read by Googling -
http://java.net/jira/browse/GLASSFISH-13672
http://javahowto.blogspot.com/2011/02/sample-glassfish-resourcesxml.html
http://blogs.sun.com/vkraemer/entry/supporting_glassfish_resources_xml
that I need to create a glassfish-resources.xml put it somewhere even though I have a persistence.xml file.The application is a full ear. I can see examples of glassfish-resources.xmlbut I am using netbeans 7 beta, so how do I create it and where doI place it in my project?
I have dir -
Enterprise app project Enterprise-app-client ejb-module war

So do I create a META-INF dir in my ejb-module dir and place the glassfish-resources.xml in there?
Please help.
Thanks eve

Jagadish Prasat...
Offline
Joined: 2011-03-11

Hi Eve,

You can refer this sample :
http://wikis.sun.com/display/GlassFish/Application+Scoped+Resources+and
+JDBC+Monitoring+Features+for+MS4

You can to have "glassfish-resources.xml" in META-INF directory of
the .ear
and let persistence.xml refer the resource.

eg:
With the following configuration in glassfish-resources.xml :

eve2
Offline
Joined: 2007-01-05

Hello,
After deploying using DB MS sql server 2000,
I got deployment issues so after reading some other post, I thoughtit had something to do with my driver JTDS 1.2.5, I switched to using the Javadb DB below are my resources and per unit--

<?xml version="1.0" encoding="UTF-8"?>

persistence unit --
<?xml version="1.0" encoding="UTF-8"?> jdbc/_test

I still get the error -

dist-directory-deploy:pre-run-deploy:Initial deploying ENTERPRISE to C:\jee\ENTERPRISE\dist\gfdeploy\ENTERPRISECompleted initial distribution of ENTERPRISEInitializing...deploy?DEFAULT=D:\jee\ENTERPRISE\dist\gfdeploy\ENTERPRISE&name=ENTERPRISE&force=true failed on GlassFish Server 3.1 Error occurred during deployment: Exception while preparing the app : Invalid resource : jdbc/_test__pm. Please see server.log for more details.Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method : java.lang.RuntimeException: Invalid resource : jdbc/_test__pmInvalid resource : jdbc/_test__pmD:\jee\ENTERPRISE\nbproject\build-impl.xml:295: The module has not been deployed. at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:187) at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:106) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.GeneratedMethodAccessor165.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:390) at org.apache.tools.ant.Target.performTasks(Target.java:411) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397) at org.apache.tools.ant.Project.executeTarget(Project.java:1366) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1249) at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:284) at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539) at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:154)BUILD FAILED (total time: 36 seconds)
So what Im I doing wrong?

Thanks
eve

Subject: Re: FW: Exception while preparing the app : Invalid resource : jdbc
From: jagadish.ramu...
To: users@glassfish.java.net
CC: ; persistence@glassfish.java.net
Date: Fri, 11 Mar 2011 19:38:31 +0530

Hi Eve,

You can refer this sample :

http://wikis.sun.com/display/GlassFish/Application+Scoped+Resources+and+...

You can to have "glassfish-resources.xml" in META-INF directory of the .ear

and let persistence.xml refer the resource.

eg:

With the following configuration in glassfish-resources.xml :

eve2
Offline
Joined: 2007-01-05

Hello,
I took a closer look into my glassfish resource and persistence.xml and made some corrections. I have a different deployment errornow. This error is resolved.
Thanks
eve
From: gorgeous65@msn.com
To: ; users@glassfish.java.net
CC: ; persistence@glassfish.java.net
Subject: RE: Exception while preparing the app : Invalid resource : jdbc
Date: Wed, 23 Mar 2011 02:19:10 +0000

Hello,
After deploying using DB MS sql server 2000,
I got deployment issues so after reading some other post, I thoughtit had something to do with my driver JTDS 1.2.5, I switched to using the Javadb DB below are my resources and per unit--

<?xml version="1.0" encoding="UTF-8"?>

persistence unit --
<?xml version="1.0" encoding="UTF-8"?> jdbc/_test

I still get the error -

dist-directory-deploy:pre-run-deploy:Initial deploying ENTERPRISE to C:\jee\ENTERPRISE\dist\gfdeploy\ENTERPRISECompleted initial distribution of ENTERPRISEInitializing...deploy?DEFAULT=D:\jee\ENTERPRISE\dist\gfdeploy\ENTERPRISE&name=ENTERPRISE&force=true failed on GlassFish Server 3.1 Error occurred during deployment: Exception while preparing the app : Invalid resource : jdbc/_test__pm. Please see server.log for more details.Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method : java.lang.RuntimeException: Invalid resource : jdbc/_test__pmInvalid resource : jdbc/_test__pmD:\jee\ENTERPRISE\nbproject\build-impl.xml:295: The module has not been deployed. at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:187) at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:106) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.GeneratedMethodAccessor165.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:390) at org.apache.tools.ant.Target.performTasks(Target.java:411) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397) at org.apache.tools.ant.Project.executeTarget(Project.java:1366) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1249) at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:284) at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539) at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:154)BUILD FAILED (total time: 36 seconds)
So what Im I doing wrong?

Thanks
eve

Subject: Re: FW: Exception while preparing the app : Invalid resource : jdbc
From: jagadish.ramu...
To: users@glassfish.java.net
CC: ; persistence@glassfish.java.net
Date: Fri, 11 Mar 2011 19:38:31 +0530

Hi Eve,

You can refer this sample :

http://wikis.sun.com/display/GlassFish/Application+Scoped+Resources+and+...

You can to have "glassfish-resources.xml" in META-INF directory of the .ear

and let persistence.xml refer the resource.

eg:

With the following configuration in glassfish-resources.xml :

jorgwel
Offline
Joined: 2011-10-22

Eve,

How did you solve this problem?

What changes you did to persistence.xml and other resources?

Best regards.

jr158900
Offline
Joined: 2005-04-13

Can you provide more information ? Do you use "glassfish-resources.xml" (application/module scoped resources) bundled in the application's META-INF/WEB-INF directory ?

The exception indicates that the jdbc-resource referred via <jta-data-source>/<non-jta-data-source> is not available. Make sure that the <jta-data-source> or <non-jta-data-source> elements in persistence.xml should refer to a jdbc-resource made available in application server.

strayan
Offline
Joined: 2013-11-26

Using Glassfish 4 and Netbean 7.4, having same issue when trying to deploy the WAR from IDE.

Below post is not clear
1) Link specified does not work
2) Below lines has some typo Is it "you can't"?
You can to have "glassfish-resources.xml" in META-INF directory of
the .ear
and let persistence.xml refer the resource.

Do we need glassfish-resources.xml and persistence.xml? If yes, how it should be configured?

Hi Eve,

You can refer this sample :
http://wikis.sun.com/display/GlassFish/Application+Scoped+Resources+and
+JDBC+Monitoring+Features+for+MS4

You can to have "glassfish-resources.xml" in META-INF directory of
the .ear
and let persistence.xml refer the resource.

eg:
With the following configuration in glassfish-resources.xml :