David Blevins wrote: > > > On Mar 30, 2008, at 8:29 PM, Chad and Doria Skinner wrote: >> I have a project I am working on and we have separated our business >> model from our business logic by placing them into different >> projects in eclipse. These projects are both jars that are placed in >> our ear file. When I try to run a test on one of our session beans >> in the EJB project I keep getting errors that it is missing the >> persistence.xml file that is in our BusinessLogic project. The code >> is compiling properly, but the tests will not run until I copy the >> persistence.xml into the EJB project. Does anyone know if having >> separate jars for the SessionBeans and entities is supported? > > I think there might be an issue with the module getting picked up if > it only contains a peristence.xml and nothing else. An alternate > technique to moving the persistence.xml into the BusinessLogic project > is to add an empty ejb-jar.xml file to the BusinessModel project > containing only "<ejb-jar/>" > > That should tide you over till we can get this fixed. > > -David > >
I am getting back to working on this and still have the same problem. My projects are configured as: websiteBusinessLogic - contains Entity Beans websiteEJB - contains my EJBs I have ejb-jar.xml files in the META-INF directories of both projects and my my persistence.xml file contains the following: <?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="website" transaction-type="JTA"> <jta-data-source>jdbc/websitedb</jta-data-source> <non-jta-data-source>jdbc/unmanagedWebsitedb</non-jta-data-source> <class>us.ks.k12.topeka.website.model.Alert</class> <class>us.ks.k12.topeka.website.model.Announcement</class> <class>us.ks.k12.topeka.website.model.Entry</class> <class>us.ks.k12.topeka.website.model.Job</class> <class>us.ks.k12.topeka.website.model.Location</class> <class>us.ks.k12.topeka.website.model.NewsEntry</class> <class>us.ks.k12.topeka.website.model.Preference</class> <class>us.ks.k12.topeka.website.model.Profile</class> <class>us.ks.k12.topeka.website.model.Tag</class> <class>us.ks.k12.topeka.website.model.TagGroup</class> <class>us.ks.k12.topeka.website.model.TagSearch</class> <properties> </properties> </persistence-unit> </persistence> my jUnit test: @Before public void setup() { try { Logger.getRootLogger().setLevel(Level.DEBUG); Properties p = new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory"); p.put("openejb.deployments.classpath.include", ".*seamTest/WebsiteBusinessModel/.*"); p.put("jdbc/websitedb", "new://Resource?type=DataSource"); p.put("jdbc/websitedb.JdbcUrl", "jdbc:mysql://localhost:3306/website"); p.put("jdbc/websitedb.JdbcDriver", "com.mysql.jdbc.Driver"); p.put("jdbc/websitedb.UserName", "webuser"); p.put("jdbc/websitedb.Password", "webpass"); p.put("jdbc/unmanagedWebsitedb", "new://Resource?type=DataSource"); p.put("jdbc/unmanagedWebsitedb.JdbcUrl", "jdbc:mysql://localhost:3306/website"); p.put("jdbc/unmanagedWebsitedb.JdbcDriver", "com.mysql.jdbc.Driver"); p.put("jdbc/unmanagedWebsitedb.UserName", "webuser"); p.put("jdbc/unmanagedWebsitedb.Password", "webpass"); p.put("jdbc/unmanagedWebsitedb.JtaManaged", "false"); p.put("jdbc/profileDB", "new://Resource?type=DataSource"); p.put("jdbc/profileDB.JdbcUrl", "jdbc:mysql://localhost:3306/website"); p.put("jdbc/profileDB.JdbcDriver", "com.mysql.jdbc.Driver"); p.put("jdbc/profileDB.UserName", "webuser"); p.put("jdbc/profileDB.Password", "webpass"); p.put("jdbc/profileDB.JtaManaged", "false"); p.put("myStatefulContainer", "new://Container?type=STATEFUL"); p.put("myStatefulContainer.PoolSize", "5"); p.put("myStatefulContainer.BulkPassivate", "1"); p.put("myStatelessContainer", "new://Container?type=STATELESS"); p.put("myStatelessContainer.PoolSize", "5"); p.put("myStatelessContainer.BulkPassivate", "1"); context = new InitialContext(p); } catch(NamingException e) { e.printStackTrace(); Assert.fail(e.getMessage()); } } @Test public void testProfileSynchronizer() throws Exception { ProfileSynchronizer lProfileSynchronizer = (ProfileSynchronizer) context.lookup("ProfileSynchronizerLocal"); lProfileSynchronizer.updateProfiles(); } But when I run the test I get the following error: Apache OpenEJB 3.0 build: 20080408-04:13 http://openejb.apache.org/ INFO - openejb.home = /home/cskinne1/.eclipse/europa/workspaces/seamTest/WebsiteEJB INFO - openejb.base = /home/cskinne1/.eclipse/europa/workspaces/seamTest/WebsiteEJB INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service) INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager) INFO - Configuring Service(id=jdbc/profileDB, type=Resource, provider-id=Default JDBC Database) INFO - Configuring Service(id=jdbc/websitedb, type=Resource, provider-id=Default JDBC Database) INFO - Configuring Service(id=jdbc/unmanagedWebsitedb, type=Resource, provider-id=Default JDBC Database) INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory, type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory) INFO - Configuring Service(id=myStatelessContainer, type=Container, provider-id=Default Stateless Container) INFO - Configuring Service(id=myStatefulContainer, type=Container, provider-id=Default Stateful Container) INFO - Found EjbModule in classpath: /home/cskinne1/.eclipse/europa/workspaces/seamTest/WebsiteBusinessModel/build/classes INFO - Found EjbModule in classpath: /home/cskinne1/.m2/repository/org/jboss/seam/jboss-seam/2.0.1.GA/jboss-seam-2.0.1.GA.jar INFO - Found EjbModule in classpath: /home/cskinne1/.eclipse/europa/workspaces/seamTest/WebsiteEJB/build/classes INFO - Configuring app: /home/cskinne1/.eclipse/europa/workspaces/seamTest/WebsiteBusinessModel/build/classes INFO - Configuring PersistenceUnit(name=website) INFO - Loaded Module: /home/cskinne1/.eclipse/europa/workspaces/seamTest/WebsiteBusinessModel/build/classes INFO - Configuring app: /home/cskinne1/.m2/repository/org/jboss/seam/jboss-seam/2.0.1.GA/jboss-seam-2.0.1.GA.jar INFO - Loaded Module: /home/cskinne1/.m2/repository/org/jboss/seam/jboss-seam/2.0.1.GA/jboss-seam-2.0.1.GA.jar INFO - Configuring app: /home/cskinne1/.eclipse/europa/workspaces/seamTest/WebsiteEJB/build/classes INFO - Auto-linking resource-ref 'termsDTA' in bean ProfileSynchronizer to Resource(id=jdbc/profileDB) ERROR - FAIL ... JobManager: Missing required persistence.xml for @PersistenceContext ref "entityManager" to unit "website" ERROR - FAIL ... ProfileManager: Missing required persistence.xml for @PersistenceContext ref "entityManager" to unit "website" ERROR - FAIL ... ProfileSynchronizer: Missing required persistence.xml for @PersistenceContext ref "entityManager" to unit "website" ERROR - FAIL ... LocationManager: Missing required persistence.xml for @PersistenceContext ref "entityManager" to unit "website" ERROR - FAIL ... AlertManager: Missing required persistence.xml for @PersistenceContext ref "entityManager" to unit "website" ERROR - FAIL ... NewsEntryManager: Missing required persistence.xml for @PersistenceContext ref "entityManager" to unit "website" ERROR - FAIL ... CalendarEntryManager: Missing required persistence.xml for @PersistenceContext ref "entityManager" to unit "website" ERROR - FAIL ... PreferenceManager: Missing required persistence.xml for @PersistenceContext ref "entityManager" to unit "website" ERROR - FAIL ... TagManager: Missing required persistence.xml for @PersistenceContext ref "entityManager" to unit "website" ERROR - FAIL ... TagGroupManager: Missing required persistence.xml for @PersistenceContext ref "entityManager" to unit "website" ERROR - FAIL ... AnnouncementManager: Missing required persistence.xml for @PersistenceContext ref "entityManager" to unit "website" ERROR - FAIL ... TagSearchManager: Missing required persistence.xml for @PersistenceContext ref "entityManager" to unit "website" ERROR - Invalid EjbModule(path=/home/cskinne1/.eclipse/europa/workspaces/seamTest/WebsiteEJB/build/classes) INFO - Set the 'openejb.validation.output.level' system property to VERBOSE for increased validation details. WARN - Jar not loaded. /home/cskinne1/.eclipse/europa/workspaces/seamTest/WebsiteEJB/build/classes. Module failed validation. AppModule(path=/home/cskinne1/.eclipse/europa/workspaces/seamTest/WebsiteEJB/build/classes) WARN - Property "BulkPassivate" not supported by "myStatelessContainer" INFO - Assembling app: /home/cskinne1/.eclipse/europa/workspaces/seamTest/WebsiteBusinessModel/build/classes INFO - PersistenceUnit(name=website, provider=org.apache.openjpa.persistence.PersistenceProviderImpl) ERROR - 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 INFO - Deployed Application(path=/home/cskinne1/.eclipse/europa/workspaces/seamTest/WebsiteBusinessModel/build/classes) INFO - Assembling app: /home/cskinne1/.m2/repository/org/jboss/seam/jboss-seam/2.0.1.GA/jboss-seam-2.0.1.GA.jar INFO - Jndi(name=TimerServiceDispatcherLocal) --> Ejb(deployment-id=TimerServiceDispatcher) INFO - Jndi(name=EjbSynchronizationsLocal) --> Ejb(deployment-id=EjbSynchronizations) INFO - Created Ejb(deployment-id=TimerServiceDispatcher, ejb-name=TimerServiceDispatcher, container=myStatelessContainer) INFO - Created Ejb(deployment-id=EjbSynchronizations, ejb-name=EjbSynchronizations, container=myStatefulContainer) INFO - Deployed Application(path=/home/cskinne1/.m2/repository/org/jboss/seam/jboss-seam/2.0.1.GA/jboss-seam-2.0.1.GA.jar) If I set the system property -Dopenejb.validation.output.level=VERBOSE I get a series of the following error (one per entity). ERROR - FAIL ... JobManager: A persistence unit must be defined via META-INF/persistence.xml to satisfy @PersistenceContext ref "entityManager" to unit "website". An example of a suitable persistence.xml might be:<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"><persistence-unit name="website"><jta-data-source>java:openejb/Resource/myDataSource</jta-data-source><non-jta-data-source>java:openejb/Resource/myUnmanagedDataSource</non-jta-data-source><properties><property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/></properties></persistence-unit></persistence> One of the things that concerns me is the error: WARN - Jar not loaded. /home/cskinne1/.eclipse/europa/workspaces/seamTest/WebsiteEJB/build/classes. Module failed validation. AppModule(path=/home/cskinne1/.eclipse/europa/workspaces/seamTest/WebsiteEJB/build/classes) Does anyone know what I am missing so that I can get this to load my entities from one jar and the session beans from a seperate jar. I don't understand why my jar would not validate and the error does not tell me. Are there any other flags that I can set to figure out why the jar is not being loaded? Also, do I need to put anything in my ejb-jar.xml file to register the local interfaces for my beans (at this point I don't have any remote beans). -- View this message in context: http://www.nabble.com/Eclipse-Multiple-Projects-and-Missing-persistence.xml-tp16391627p17764028.html Sent from the OpenEJB User mailing list archive at Nabble.com.