tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@visi.com>
Subject Re: OpenEJB - Missing required persistence.xml
Date Tue, 12 Feb 2008 23:53:45 GMT
It seems like what's happening is eclipse isn't configured to copy in  
the src/*/resources files into the related build output directories.

To see if I could replicate the issue, I grabbed our injection-of- 
entitymanager example from the examples zip and generated an eclipse  
project for it using 'mvn eclipse:eclipse' on the command line.  Then  
I added the M2_REPO variable[1].  When it asked me if I wanted to  
rebuild everything I said yes.  After I was able to run the test case  
in eclipse.

Here's the relevant part of my .classpath file when all that was done:

   <classpathentry kind="src" path="src/main/java"/>
   <classpathentry kind="src" path="src/main/resources" excluding="**/ 
*.java"/>
   <classpathentry kind="src" path="src/test/java" output="target/test- 
classes"/>
   <classpathentry kind="output" path="target/classes"/>

The goal is that "src/main/java" and "src/main/resources" should  
output into "target/classes".  And "src/test/java" and "src/test/ 
resources" should output into "target/test-classes".  If both of those  
happen correctly, you shouldn't need any <Deployments> entries in your  
openejb.xml file at all.

If you can post your .classpath file for pattern-management-impl  
that'd be great.

On a side note, you can configure data sources from within your test  
case (and delete your openejb.xml entirely) like so:

         Properties p = new Properties();
         p.put(Context.INITIAL_CONTEXT_FACTORY,  
"org.apache.openejb.client.LocalInitialContextFactory");

         p.put("myDataSource", "new://Connector?type=DataSource");
         p.put("myDataSource.JdbcDriver",  
"org.apache.derby.jdbc.EmbeddedDriver");
         p.put("myDataSource.JdbcUrl",  
"jdbc:derby:derbyDB;create=true");

         Context context = new InitialContext(p);

-David

[1]  http://people.apache.org/~dblevins/eclipse-howto/new-variable.tiff

On Feb 11, 2008, at 10:34 AM, <Karsten.Ohme@t-systems.com> <Karsten.Ohme@t-systems.com

 > wrote:

> Hi,
>
> I'm experimenting for one day with OpenEJB 3.0-beta-2, but I'm  
> stuck. I
> have tried different approaches to test EJBs, ejb3unit, JBoss
> embeddable, but OpenEJB seems to be the best, although it also does  
> not
> work for me.
>
> I always get a
>
> - FAIL ... PatternManagementDaoImpl:	Missing required persistence.xml
> for @PersistenceContext ref "em" to unit "pattern-managementPu"
>
> What's wrong? It is there. And where should it be placed? In META-INF
> like usually? It seems that it is later found.
>
> What I want to do is to use an Apache Derby database (in memory) which
> is automatically initilialized. What do I have to define and where,  
> that
> this works?
>
> Can I define the order in which the EJB modules are loaded?
>
> Thanks,
> Karsten
>
> Apache OpenEJB 3.0-beta-2    build: 20080131-03:38
> http://openejb.apache.org/
> - openejb.home = C:\workspace\pattern-management\pattern-management- 
> impl
> - openejb.base = C:\workspace\pattern-management\pattern-management- 
> impl
> - Configuring Service(id=Default Security Service,  
> type=SecurityService,
> provider-id=Default Security Service)
> - Configuring Service(id=Default Transaction Manager,
> type=TransactionManager, provider-id=Default Transaction Manager)
> - Configuring Service(id=Derby Database, type=Resource,
> provider-id=Default JDBC Database)
> - Configuring Service(id=Default JDK 1.3 ProxyFactory,
> type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory)
> - Configuring Service(id=Default Stateless Container, type=Container,
> provider-id=Default Stateless Container)
> - Found EjbModule in classpath:
> C:\workspace\pattern-management\pattern-management-impl\src\main 
> \resourc
> es
> - Found EjbModule in classpath:
> C:\workspace\pattern-management\pattern-management-impl\src\test 
> \resourc
> es
> - Configuring app:
> C:\workspace\networkstorage-management\networkstorage-management-impl 
> \ta
> rget\classes
> - Loaded Module:
> C:\workspace\networkstorage-management\networkstorage-management-impl 
> \ta
> rget\classes
> - Configuring app:
> C:\workspace\pattern-management\pattern-management-impl\target\classes
> - FAIL ... PatternManagementDaoImpl:	Missing required persistence.xml
> for @PersistenceContext ref "em" to unit "pattern-managementPu"
> - FAIL ... TestFacadeImpl:	Missing required persistence.xml for
> @PersistenceContext ref "em" to unit "pattern-managementPu"
> - Jar not loaded.
> C:\workspace\pattern-management\pattern-management-impl\target 
> \classes.
> Module failed validation.
> AppModule(path=C:\workspace\pattern-management\pattern-management- 
> impl\t
> arget\classes)
> - Configuring app:
> C:\workspace\pattern-management\pattern-management-impl\src\main 
> \resourc
> es
> - Configuring PersistenceUnit(name=pattern-managementPu,  
> provider=null)
> - Loaded Module:
> C:\workspace\pattern-management\pattern-management-impl\src\main 
> \resourc
> es
> - Configuring app:
> C:\workspace\pattern-management\pattern-management-impl\src\test 
> \resourc
> es
> - Configuring PersistenceUnit(name=pattern-managementPu,  
> provider=null)
> - Loaded Module:
> C:\workspace\pattern-management\pattern-management-impl\src\test 
> \resourc
> es
> - Creating ProxyFactory(id=Default JDK 1.3 ProxyFactory)
> - Creating TransactionManager(id=Default Transaction Manager)
> - Creating SecurityService(id=Default Security Service)
> - Creating Resource(id=Derby Database)
> - Creating Container(id=Default Stateless Container)
> - Assembling app:
> C:\workspace\networkstorage-management\networkstorage-management-impl 
> \ta
> rget\classes
> - Jndi(name=NetworkStorageServiceImplRemote) -->
> Ejb(deployment-id=NetworkStorageServiceImpl)
> - Created Ejb(deployment-id=NetworkStorageServiceImpl,
> ejb-name=NetworkStorageServiceImpl, container=Default Stateless
> Container)
> - Deployed
> Application(path=C:\workspace\networkstorage-management 
> \networkstorage-m
> anagement-impl\target\classes)
> - Assembling app:
> C:\workspace\pattern-management\pattern-management-impl\src\main 
> \resourc
> es
> - PersistenceUnit(name=pattern-managementPu, provider=null)
> - JAVA AGENT NOT INSTALLED. The JPA Persistence Provider requested
> installation of a ClassFileTransformer which requires a JavaAgent.   
> See
> http://openejb.apache.org/3.0/javaagent.html
> - Deployed
> Application(path=C:\workspace\pattern-management\pattern-management- 
> impl
> \src\main\resources)
> - Assembling app:
> C:\workspace\pattern-management\pattern-management-impl\src\test 
> \resourc
> es
> - PersistenceUnit(name=pattern-managementPu, provider=null)
> - JAVA AGENT NOT INSTALLED. The JPA Persistence Provider requested
> installation of a ClassFileTransformer which requires a JavaAgent.   
> See
> http://openejb.apache.org/3.0/javaagent.html
> - Deployed
> Application(path=C:\workspace\pattern-management\pattern-management- 
> impl
> \src\test\resources)
> - OpenEJB ready.
> OpenEJB ready.
>


Mime
View raw message