users@glassfish.java.net

Re: detecting persistence archive in ScatteredEar lib

From: Bhavanishankar <bhavanishankara.sapaliga_at_oracle.com>
Date: Tue, 03 May 2011 22:53:15 +0530

Hi,

Does your persistence.jar contain different content than what is in
HOME/persistence/classes?

If yes, then that means you need to build ScatteredEnterpriseArchive
with two modules, like this:

    ScatteredEnterpriseArchive ear = new
    ScatteredEnterpriseArchive("persistence");
    ear.addArchive(new File("lib", "persistence.jar")); // i.e.,
    lib/persistence.jar as one module.
    ear.addArchive(new File(HOME+"persistence/classes")); // i.e.,
    HOME/persistence/classes as other module.
    deployer.deploy(ear.toURI());

If not, you have only one module. So you can directly use ScatteredArchive.

Just on a side note, the 'name' argument in
ScatteredArchive/ScatteredEnterpriseArchive is the archive name. So, it
should be "persistence" rather than "persistence.jar".

Also, I could not quite follow the code you have sent:

    new ScatteredArchive("persistence.jar", ScatteredArchive.Type./JAR,
    new File(HOME+"persistence\\classes")); "lib/persistence.jar"); /

(does it compile? doesn't look like a valid statement)

_Bhavani.

On 05/02/2011 06:19 PM, forums_at_java.net wrote:
> Hi,
>
> I am trying to deploy java 6 + JPA 2\hibernate 3.6 application using
> embeeded
> glassfish - scattered ear.
>
> I downloaded the latest glassfish embedded jar:
> glassfish-embedded-all-3.2-SNAPSHOT.
>
> I've put the persistence.xml in a seperate jar and located the jar in ear
> lib:
>
>
> persitenceArchive =
>
> *new ScatteredArchive("persistence.jar", ScatteredArchive.Type./JAR, *new
> File(HOME+"persistence\\classes")); "lib/persistence.jar");
> I see on deplyment that the persistence.jar appears in the temporary
> ear lib
> directory. But the persistence archive is not proceessed. I know this
> because
> there is no message on it in the console, and whe trying to access ejb
> method
> which injects entityManager of this unit, I get the error:
> java.lang.IllegalStateException: Unable to retrieve
> EntityManagerFactory for
> unitName
> entityManagerEntityManagerWrapper.java:132)EntityManagerWrapper.java:173)EntityManagerWrapper.java:565)RepositoryServiceBean.java:75)
>
>
> I saw old bugs on this issue (persistence archive in exploaded ear not
> proceeded), but they seemed to be solved. I sthere any known bug on this?
>
> Thanks.
>
> */*
>
> Caused by:
>
> at com.sun.enterprise.container.common.impl.EntityManagerWrapper.init(
>
> at
> com.sun.enterprise.container.common.impl.EntityManagerWrapper._getDelegate(
>
>
> at
> com.sun.enterprise.container.common.impl.EntityManagerWrapper.createNamedQuery(
>
>
> at xxx.core.RepositoryServiceBean.getFees(
>
> enterpriseArchive.addArchive(persitenceArchive.toURI(),
>
>
> --
>
> [Message sent by forum member 'tovi']
>
> View Post: http://forums.java.net/node/797357
>
>

-- 
Sun, an Oracle Company