persistence@glassfish.java.net

Re: FW: Exception while preparing the app : Invalid resource : jdbc

From: Jagadish Prasath Ramu <jagadish.ramu_at_oracle.com>
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
+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 :

----------------------------------------------------------------------------------------------------------------------------------
<jdbc-connection-pool res-type="javax.sql.XADataSource"
name="java:app/jdbc/app-level-pool">
      <property name="User" value="dbuser" />
      <property name="Password" value="dbpassword" />
      <property name="driverType" value="4" />
      <property name="portNumber" value="1527" />
      <property name="dataBaseName" value="testdb" />
      <property name="retrieveMessagesFromServerOnGetMessage"
value="true" />
      <property name="create" value="true" />
      <property name="connectionAttributes" value=";create=true" />
      <property name="serverName" value="localhost" />
    </jdbc-connection-pool>

    <jdbc-resource enabled="true"
jndi-name="java:app/jdbc/app-level-ds"
object-type="user" pool-name="java:app/jdbc/app-level-pool"/>
----------------------------------------------------------------------------------------------------------------------------------



the resource "java:app/jdbc/app-level-ds" can be referred by the
persistence.xml's jndi-name attribute.
----------------------------------------------------------------------------------------------------------------------------------
 <persistence-unit name ="em">
      <jta-data-source>java:app/jdbc/app-level-ds</jta-data-source>

<class>com.sun.s1asdev.ejb.ejb30.persistence.tx_propagation.Person</class>
    </persistence-unit>
----------------------------------------------------------------------------------------------------------------------------------

-- 
Thanks,
-Jagadish
Sun, an Oracle Company.
On Fri, 2011-03-11 at 10:28 +0000, Eve Pokua wrote:
> 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__pm
> org.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.<init>(PersistenceUnitInfoImpl.java:108)
> at
> org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:154)
> at
> org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(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 more
> 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
> |#]
> 
> 
> [#|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__pm
> 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.<init>(PersistenceUnitInfoImpl.java:108)
> at
> org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:154)
> at
> org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(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_at_msn.com
> To: users_at_glassfish.java.net; ejb_at_glassfish.java.net;
> persistence_at_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
> problems
> deploying my application which was deployed fine on previous version
> of
> glassfish.
> 
> 
> 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.xml
> but I am using netbeans 7 beta, so how do I create it and where do
> I 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
>