users@glassfish.java.net

Re: Persistence unit ref:

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Fri, 04 Dec 2009 15:23:41 -0800

Eve,

Are you deploying it to GF v2.x or v3? In v3 you need to package shared parts
into the ear's lib/myjar.jar to be available to all components.

Regards,
-marina

Eve Pokua wrote:
> Ralph,
>
> My application is a full enterprise application.
> No the persistence.xml is in my ejb
> mobule section where all my entity files are.
>
> eve
> ------------------------------------------------------------------------
> From: ralph.winzinger_at_senacor.de
> To: users_at_glassfish.dev.java.net
> Date: Sat, 5 Dec 2009 00:01:29 +0100
> Subject: Re: Persistence unit ref:
>
> but persistence.xml is not contained in your war, is it?
>
>
> Am 04.12.2009 um 23:53 schrieb Eve Pokua:
>
> Ralph see attached
>
> Hope that helps. This testing is also giving error.
>
> Thanks
>
> eve
>
>
>
> ------------------------------------------------------------------------
> From: gorgeous65_at_msn.com <mailto:gorgeous65_at_msn.com>
> To: users_at_glassfish.dev.java.net
> <mailto:users_at_glassfish.dev.java.net>; ejb_at_glassfish.dev.java.net
> <mailto:ejb_at_glassfish.dev.java.net>; persistence_at_glassfish.dev.java.net
> <mailto:persistence_at_glassfish.dev.java.net>
> Date: Fri, 4 Dec 2009 22:32:26 +0000
> Subject: RE: Persistence unit ref:
>
> Ralph,
>
> My application is very big.
>
> Do you have spring?
>
> In Marina's example
>
> This is what the JavaEE spec gives as an example:
> *<persistence-unit-ref>
> <persistence-unit-ref-name>
> persistence/InventoryAppDB
> *</persistence-unit-ref-name>
> <persistence-unit-name>
> InventoryManagement
> </persistence-unit-name>
> *</persistence-unit-ref>
> *
>
>
> I do not have what is bold in my per.xml
>
> Shouldn't it be why I am getting an error? The web.xml can not
> resolve -
>
> Deploying application in domain failed; Could not resolve a
> persistence unit corresponding to the persistence-unit-ref-name
> [persistence/ENTERPRISE-ejbPU] in scope of the module called
> [gfdeploy#C:\jee\ENTERPRISE\dist\gfdeploy\ENTERPRISE-war_war].
> Please verify your application.
>
> IT's complaining about the per-unit-ref-name which is not in my per.xml.
>
>
> How do I put that in? I tried to add it in but has been getting error.
> Could you add it in and send it over?
>
> I will try and see if I can send over a test app.
>
> Thanking you.
>
> eve
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------
> From: ralph.winzinger_at_senacor.de <mailto:ralph.winzinger_at_senacor.de>
> To: users_at_glassfish.dev.java.net <mailto:users_at_glassfish.dev.java.net>
> Date: Fri, 4 Dec 2009 23:00:35 +0100
> Subject: Re: Persistence unit ref:
>
> well, I tried various constellations to test whether your error will
> show up (renaming persistence.xml, changing the value
> in <persistence-unit-ref-name> (web.xml), changing <persistence-unit
> name=...> (persistence.xml)). But the error only occurred when the
> unit-names in persistence.xml and web.xml did not match.
>
> If your project is some kind of test-project, you might send your
> WAR (if it is not too big of course) - I will try to throw it at my
> container ...
>
>
> Am 04.12.2009 um 22:51 schrieb Eve Pokua:
>
> Ralph,
>
> I have recreated my persistence.xml.
>
> Please, note that I am using netbeans 6.7 to create my
> persistence.xml.
>
> Here is the new file-
>
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="1.0"
> xmlns="http://java.sun.com/xml/ns/persistence"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/persistencehttp://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
> <persistence-unit name="ENTERPRISE-ejbPU" transaction-type="JTA">
>
> <provider>oracle.toplink.essentials.PersistenceProvider</provider>
> <jta-data-source>jdbc_/EnterpriseDB2</jta-data-source>
> <properties>
> <property name="toplink.ddl-generation"
> value="create-tables"/>
> </properties>
> </persistence-unit>
> </persistence>
>
>
> My problem comes when I have to
>
> this to my web.xml-
>
> <persistence-unit-ref>
>
> <persistence-unit-ref-name>persistence/ENTERPRISE-ejbPU</persistence-unit-ref-name>
>
> <persistence-unit-name>ENTERPRISE-ejbPU</persistence-unit-name>
> </persistence-unit-ref>
>
> when I comment it out of my web.xml, my application deploys.
>
> Ralph, could you please, double check your per.xml to see if you
> have the
>
> persistence-unit-ref>
> <persistence-unit-ref-name>
>
> tag and also please, do reproduce my error by changing the per.
> name.
>
> I'm sure you will reproduce the error.
>
>
> This is what the JavaEE spec gives as an example:
> <persistence-unit-ref>
> <persistence-unit-ref-name>
> persistence/InventoryAppDB
> </persistence-unit-ref-name>
> <persistence-unit-name>
> InventoryManagement
> </persistence-unit-name>
> </persistence-unit-ref>
>
> Mar. I am using netbeans to create the per.xml.
>
>
>
> Thanking you for all your help.
>
> eve
>
>
>
>
> ------------------------------------------------------------------------
>
> From: ralph.winzinger_at_senacor.de <mailto:ralph.winzinger_at_senacor.de>
> To: users_at_glassfish.dev.java.net
> <mailto:users_at_glassfish.dev.java.net>
> Date: Fri, 4 Dec 2009 22:05:39 +0100
> Subject: Re: Persistence unit ref:
>
> Eve,
>
> the only way, how I can reproduce your error is to change the
> value of <persistence-unit-name> to something not matching the
> name in the persistence.xml. But thatseems to be ok in the
> snippets you sent. So I would go on and look for old files that
> might be still around - maybe there's another persistence.xml
> that is read by accident. Look inside the WAR and make sure that
> everything is as expected.
>
> Bye,
> Ralph
>
>
>
> Am 04.12.2009 um 19:48 schrieb Eve Pokua:
>
> Ralph,
>
> Here is my per.xml
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="1.0"
> xmlns="http://java.sun.com/xml/ns/persistence"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
> <persistence-unit name="ENTERPRISE-ejbPU"
> transaction-type="JTA">
> <jta-data-source>jdbc_/EnterpriseDB2</jta-data-source>
> <exclude-unlisted-classes>false</exclude-unlisted-classes>
> <properties>
> </properties>
> </persistence-unit>
> </persistence>
>
>
> regards
>
> eve
>
> ------------------------------------------------------------------------
> From: ralph.winzinger_at_senacor.de
> <mailto:ralph.winzinger_at_senacor.de>
> To: users_at_glassfish.dev.java.net
> <mailto:users_at_glassfish.dev.java.net>
> Date: Fri, 4 Dec 2009 15:20:16 +0100
> Subject: Re: Persistence unit ref:
>
> hi,
>
> what does your persistence.xml look like?
>
>
> Am 04.12.2009 um 13:50 schrieb Eve Pokua:
>
> Ralph,
>
> Thank you for your reply.
>
> I did as you said.
>
> i added the following to my web.xml
>
>
>
> <persistence-unit-ref>
> <persistence-unit-ref-name>persistence/ENTERPRISE-ejbPU</persistence-unit-ref-name>
> <persistence-unit-name>ENTERPRISE-ejbPU</persistence-unit-name>
> </persistence-unit-ref>
>
>
>
> in my applicationContext.xml
>
> <bean
> class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"
> >
> <property name="persistenceUnits">
> <map>
> <entry key="MyPU"
> value="persistence/ENTERPRISE-ejbPU"/>
> </map>
> </property>
> </bean>
>
> <!--
> see http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/transaction/jta/JtaTransactionManager.html -->
> <tx:jta-transaction-manager/>
> <!--
> see http://static.springsource.org/spring/docs/2.5.x/reference/transaction.html -->
> <tx:annotation-driven/>
>
>
> But I still get the error -
>
> [#|2009-12-04T12:34:05.536+0000|SEVERE|sun-appserver2.1|javax.enterprise.system.tools.deployment|_ThreadID=20;_ThreadName=Thread-48;_RequestID=3fb89f4d-e8ef-403f-a422-9e5442bf9b3a;|Exception
> occured in J2EEC Phase
> com.sun.enterprise.deployment.backend.IASDeploymentException:
> Could not resolve a persistence unit corresponding to
> the persistence-unit-ref-name
> [persistence/ENTERPRISE-ejbPU] in scope of the module
> called
> [gfdeploy#C:\jee\ENTERPRISE\dist\gfdeploy\ENTERPRISE-war_war].
> Please verify your application.
> at
> com.sun.enterprise.deployment.BundleDescriptor.findReferencedPUsViaPURefs(BundleDescriptor.java:711)
> at
> com.sun.enterprise.deployment.WebBundleDescriptor.findReferencedPUs(WebBundleDescriptor.java:727)
> at
> com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.getAllPersistenceUnitDescriptors(PersistenceProcessor.java:214)
> at
> com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.processApplication(PersistenceProcessor.java:175)
> at
> com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.processApplication(DeploymentEventListenerImpl.java:211)
> at
> com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.processEvent(DeploymentEventListenerImpl.java:172)
> at
> com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.notifyDeploymentEvent(DeploymentEventListenerImpl.java:122)
> at
> com.sun.enterprise.deployment.backend.DeploymentEventManager.notifyDeploymentEvent(DeploymentEventManager.java:79)
> at
> com.sun.enterprise.deployment.backend.AppDeployer.postDeploy(AppDeployer.java:401)
> at
> com.sun.enterprise.deployment.backend.AppDeployer.deploy(AppDeployer.java:260)
> at
> com.sun.enterprise.deployment.backend.AppDeployer.doRequestFinish(AppDeployer.java:148)
> at
> com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:208)
> at
> com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:108)
> at
> com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:966)
> at
> com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:283)
> at
> com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:835)
> at
> com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:187)
> at
> com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:225)
> |#]
> [#|2009-12-04T12:37:03.074+0000|INFO|sun-appserver2.1|javax.enterprise.resource.webcontainer.jsf.config|_ThreadID=21;_ThreadName=httpWorkerThread-4848-1;;|Initializing
> Sun's JavaServer Faces implementation (1.2_04-b22-p05)
> for context ''|#]
> [#|2009-12-04T12:37:58.729+0000|INFO|sun-appserver2.1|com.sun.jbi.framework|_ThreadID=21;_ThreadName=httpWorkerThread-4848-1;|JBIFW0012:
> JBI framework startup complete.|#]
>
>
> sO MY QUESTION AGAIN IS - WHERE CAN I FIND A REFERENCE
> TO MY persistence-unit-ref-name????
>
> I'VE CHECKED MY domain.xml but no details.
>
> thanks
>
> eve
>
>
>
> ------------------------------------------------------------------------
> From: ralph.winzinger_at_senacor.com
> <mailto:ralph.winzinger_at_senacor.com>
> To: users_at_glassfish.dev.java.net
> <mailto:users_at_glassfish.dev.java.net>
> Date: Fri, 4 Dec 2009 00:42:46 +0100
> Subject: Re: Persistence unit ref:
>
> Hi,
>
> I got this working just about an ago ...
>
> web.xml:
>
> <persistence-unit-ref>
>
> <persistence-unit-ref-name>persistence/hd</persistence-unit-ref-name>
> <persistence-unit-name>hd</persistence-unit-name>
> </persistence-unit-ref>
>
> application-context.xml:
>
> <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" >
> <property name="persistenceUnits">
> <map>
> <entry key="MyPU" value="persistence/hd"/>
> </map>
> </property>
> </bean>
>
> <!-- see
> <http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/transaction/jta/JtaTransactionManager.html>http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/transaction/jta/JtaTransactionManager.html -->
> <tx:jta-transaction-manager/>
> <!-- see
> <http://static.springsource.org/spring/docs/2.5.x/reference/transaction.html>http://static.springsource.org/spring/docs/2.5.x/reference/transaction.html -->
> <tx:annotation-driven/>
>
> Hope this helps ...
>
> Bye,
> Ralph
>
>
> Kurz gehalten, da vom iPhone gesendet
>
> Am 04.12.2009 um 00:16 schrieb "Eve Pokua"
> <gorgeous65_at_msn.com <mailto:gorgeous65_at_msn.com>>:
>
> Hello,
>
> Below is my persistence.xml-
>
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="1.0" xmlns="
> <http://java.sun.com/xml/ns/persistence>http://java.sun.com/xml/ns/persistence"
> xmlns:xsi="
> <http://www.w3.org/2001/XMLSchema-instance>http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="
> <http://java.sun.com/xml/ns/persistence>http://java.sun.com/xml/ns/persistence
> <http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd>http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
> <persistence-unit name="ENTERPRISE-ejbPU"
> transaction-type="JTA">
>
> <jta-data-source>jdbc_/EnterpriseDB2</jta-data-source>
>
> <exclude-unlisted-classes>false</exclude-unlisted-classes>
> <properties>
> </properties>
> </persistence-unit>
> </persistence>
>
>
> How do I find the name of my -persistence-unit-ref-name?
>
> I use the following and I get deployment error
>
> <persistence-unit-ref-name>ENTERPRISE-ejbPU</persistence-unit-ref-name>
>
> Deploying application in domain failed; Could not
> resolve a persistence unit corresponding to the
> persistence-unit-ref-name [ENTERPRISE-ejbPU] in
> scope of the module called
> [gfdeploy#C:\jee\ENTERPRISE\dist\gfdeploy\ENTERPRISE-war_war].
> Please verify your application.
>
> I need to specify it within my web.xml in-order to
> use @Persistence in my spring JEE
> application.
>
> Thanking you.
>
> eve
>
>
>
> ------------------------------------------------------------------------
> Use Hotmail to send and receive mail from your
> different email accounts. Find out how.
> <http://clk.atdmt.com/UKM/go/186394592/direct/01/>
>
>
> ------------------------------------------------------------------------
> New! Receive and respond to mail from other email
> accounts from within Hotmail Find out how.
> <http://clk.atdmt.com/UKM/go/186394593/direct/01/>
>
>
> Ralph Winzinger
> Principal Architect
> ______________________________
> Senacor Technologies AG
> Vordere Cramergasse 11
> 90478 Nürnberg
>
> Telefon: +49 (0)911 4244-202
> Telefax: +49 (0)911 4244-100
>
> ralph.winzinger_at_senacor.com <mailto:ralph.winzinger_at_senacor.com>
> www.senacor.com <http://www.senacor.com/>
>
> Senacor Technologies Aktiengesellschaft - Sitz: Nürnberg -
> Amtsgericht Nürnberg - Reg.-Nr.: HRB 23098
> Vorstand: Matthias Tomann, Marcus Purzer -
> Aufsichtsratsvorsitzender: Mathias J. Lindermeir
>
>
> ------------------------------------------------------------------------
> Add other email accounts to Hotmail in 3 easy steps. Find
> out how. <http://clk.atdmt.com/UKM/go/186394593/direct/01/>
>
>
> Ralph Winzinger
> Principal Architect
> ______________________________
> Senacor Technologies AG
> Vordere Cramergasse 11
> 90478 Nürnberg
>
> Telefon: +49 (0)911 4244-202
> Telefax: +49 (0)911 4244-100
>
> ralph.winzinger_at_senacor.com <mailto:ralph.winzinger_at_senacor.com>
> www.senacor.com <http://www.senacor.com/>
>
> Senacor Technologies Aktiengesellschaft - Sitz: Nürnberg -
> Amtsgericht Nürnberg - Reg.-Nr.: HRB 23098
> Vorstand: Matthias Tomann, Marcus Purzer -
> Aufsichtsratsvorsitzender: Mathias J. Lindermeir
>
>
> ------------------------------------------------------------------------
> View your other email accounts from your Hotmail inbox. Add them
> now. <http://clk.atdmt.com/UKM/go/186394592/direct/01/>
>
>
> Ralph Winzinger
> Principal Architect
> ______________________________
> Senacor Technologies AG
> Vordere Cramergasse 11
> 90478 Nürnberg
>
> Telefon: +49 (0)911 4244-202
> Telefax: +49 (0)911 4244-100
>
> ralph.winzinger_at_senacor.com <mailto:ralph.winzinger_at_senacor.com>
> www.senacor.com <http://www.senacor.com/>
>
> Senacor Technologies Aktiengesellschaft - Sitz: Nürnberg -
> Amtsgericht Nürnberg - Reg.-Nr.: HRB 23098
> Vorstand: Matthias Tomann, Marcus Purzer -
> Aufsichtsratsvorsitzender: Mathias J. Lindermeir
>
>
> ------------------------------------------------------------------------
> View your other email accounts from your Hotmail inbox. Add them
> now. <http://clk.atdmt.com/UKM/go/186394592/direct/01/>
> ------------------------------------------------------------------------
> Have more than one Hotmail account? Link them together to easily
> access
> both. <persistence.xml><web.xml><BaleBean2.java><BaleBeanRemote2.java><Baleent2.java><Testingapp2-war.war>---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> <mailto:users-unsubscribe_at_glassfish.dev.java.net>
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
> <mailto:users-help_at_glassfish.dev.java.net>
>
>
> Ralph Winzinger
> Principal Architect
> ______________________________
> Senacor Technologies AG
> Vordere Cramergasse 11
> 90478 Nürnberg
>
> Telefon: +49 (0)911 4244-202
> Telefax: +49 (0)911 4244-100
>
> ralph.winzinger_at_senacor.com <mailto:ralph.winzinger_at_senacor.com>
> www.senacor.com <http://www.senacor.com/>
>
> Senacor Technologies Aktiengesellschaft - Sitz: Nürnberg - Amtsgericht
> Nürnberg - Reg.-Nr.: HRB 23098
> Vorstand: Matthias Tomann, Marcus Purzer - Aufsichtsratsvorsitzender:
> Mathias J. Lindermeir
>
>
> ------------------------------------------------------------------------
> Add other email accounts to Hotmail in 3 easy steps. Find out how.
> <http://clk.atdmt.com/UKM/go/186394593/direct/01/ >