tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Quintin Beukes <quin...@skywalk.co.za>
Subject Re: Persistence unit <class> annotation having no effect
Date Sat, 24 Oct 2009 12:34:51 GMT
I admit i might have misinterpreted the spec, and I'm not sure if you
read my post on Geronimo mailing list, so I'll repeat it here. Please
correct me if I'm wrong. Have a look at the description of:
https://issues.apache.org/jira/browse/GERONIMO-4928

Specifically the part: All classes must be on the classpath to ensure
that entity managers from different persistence units that
map the same class will be accessing the same identical class.

Here they simply specify the classpath, and a bit more upwards they
say that the way these classes are found is one or more of the listed
options. So it's not required to use the jar-file element when you
have multiple jars/PUs.

Quintin Beukes



On Sat, Oct 24, 2009 at 10:29 AM, Jean-Louis MONTEIRO
<jean-louis.monteiro@atosorigin.com> wrote:
>
> Hi Quintin,
>
> AFAIK, the class element in the persistence unit can be used to reference a
> class from your module. But, from my understanding, you have 2 jars modules
> so, IMHO it should not work.
>
> To make it work, i believe you need to use the jar-file tag.
> Finally, i think OpenEJB is only responsible to give a classloader to the
> persistence provider but classes discovery is in charge of the persistence
> provider.
>
> Hope it helps.
> Jean-Louis
>
>
> Q Beukes wrote:
>>
>> I think I might have why it works in OpenEJB and not in Geronimo. It
>> seems Geronimo has OpenJPA do the management, where OpenEJB does it
>> themselves.
>>
>> Is there a way I can pass this responsibility over to OpenEJB instead?
>>
>> Quintin Beukes
>>
>>
>>
>> On Fri, Oct 23, 2009 at 3:25 PM, Quintin Beukes <quintin@last.za.net>
>> wrote:
>>> Hey,
>>>
>>> When doing unit tests, this work fine. But as soon as I deploy the app
>>> to Geronimo, it fails.
>>>
>>> I have 2 jars A and B. B depends on A, and both have entities classes.
>>> Some of the entities in B reference (foreign keys) entities in A. So
>>> to get this working I add the classes in in A I'm referencing to B's
>>> persistence unit.
>>>
>>> When I unit test, this works perfectly. But as soon as I deploy it, I
>>> get the following:
>>> 2009-10-23 15:18:26,400 INFO  [config] Configuring enterprise
>>> application: net.kunye/VDS-lamps-ejb/3.0/jar
>>> 2009-10-23 15:18:26,807 INFO  [OpenEJB] Auto-deploying ejb LampBean:
>>> EjbDeployment(deployment-id=VDS-lamps-ejb/LampBean)
>>> 2009-10-23 15:18:26,808 INFO  [config] Enterprise application
>>> "net.kunye/VDS-lamps-ejb/3.0/jar" loaded.
>>> 2009-10-23 15:18:28,719 INFO  [Ejb3Configuration] Processing
>>> PersistenceUnitInfo [
>>>        name: VDS-lamps-PU
>>>        ...]
>>> 2009-10-23 15:18:28,961 INFO  [AnnotationBinder] Binding entity from
>>> annotated class: net.kunye.vds.lamps.LampAssignment
>>> 2009-10-23 15:18:28,962 INFO  [EntityBinder] Bind entity
>>> net.kunye.vds.lamps.LampAssignment on table LampAssignment
>>> 2009-10-23 15:18:29,004 INFO  [AnnotationBinder] Binding entity from
>>> annotated class: net.kunye.vds.lamps.Lamp
>>> 2009-10-23 15:18:29,004 INFO  [EntityBinder] Bind entity
>>> net.kunye.vds.lamps.Lamp on table Lamp
>>> 2009-10-23 15:18:29,017 INFO  [AnnotationBinder] Binding entity from
>>> annotated class: net.kunye.vds.lamps.LampFault
>>> 2009-10-23 15:18:29,017 INFO  [EntityBinder] Bind entity
>>> net.kunye.vds.lamps.LampFault on table LampFault
>>> 2009-10-23 15:18:29,018 INFO  [AnnotationBinder] Binding entity from
>>> annotated class: net.kunye.vds.lamps.LampTest
>>> 2009-10-23 15:18:29,019 INFO  [EntityBinder] Bind entity
>>> net.kunye.vds.lamps.LampTest on table LampTest
>>> 2009-10-23 15:18:29,033 ERROR [GBeanInstanceState] Error while
>>> starting; GBean is now in the FAILED state:
>>> abstractName="net.kunye/VDS-lamps-ejb/3.0/jar?EJBModule=net.kunye/VDS-lamps-ejb/3.0/jar,J2EEApplication=null,PersistenceUnitModule=ejb.jar,j2eeType=PersistenceUnit,name=VDS-lamps-PU"
>>> org.hibernate.AnnotationException: @OneToOne or @ManyToOne on
>>> net.kunye.vds.lamps.LampAssignment.employee references an unknown
>>> entity: net.kunye.personnel.Employee
>>>        at
>>> org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:81)
>>>        at
>>> org.hibernate.cfg.AnnotationConfiguration.processEndOfQueue(AnnotationConfiguration.java:456)
>>>        at
>>> org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:438)
>>>        at
>>> org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:309)
>>>        at
>>> org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1162)
>>>        at
>>> org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1226)
>>>        at
>>> org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:173)
>>>        at
>>> org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:854)
>>>        at
>>> org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:425)
>>>        at
>>> org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:131)
>>>        at
>>> org.apache.geronimo.persistence.PersistenceUnitGBean.<init>(PersistenceUnitGBean.java:127)
>>>        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>>> Method)
>>>        at
>>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>>>        at
>>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>>>        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>>>        at
>>> org.apache.xbean.recipe.ReflectionUtil$ConstructorFactory.create(ReflectionUtil.java:952)
>>>        at
>>> org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:276)
>>>        at
>>> org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
>>>        at
>>> org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)
>>>        at
>>> org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:910)
>>>        at
>>> org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:269)
>>>        at
>>> org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:103)
>>>        at
>>> org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(GBeanInstanceState.java:125)
>>>        at
>>> org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive(GBeanInstance.java:538)
>>>        at
>>> org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(BasicKernel.java:377)
>>>        at
>>> org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:456)
>>>        at
>>> org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:190)
>>>        at
>>> org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:546)
>>>        at
>>> org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:527)
>>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>        at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>        at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>>        at
>>> org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
>>>        at
>>> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:130)
>>>        at
>>> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:850)
>>>        at
>>> org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:237)
>>>        at
>>> org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:342)
>>>        at sun.reflect.GeneratedMethodAccessor134.invoke(Unknown Source)
>>>        at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>>        at
>>> org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
>>>        at
>>> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:130)
>>>        at
>>> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:850)
>>>        at
>>> org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:237)
>>>        at
>>> org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke(MBeanGBeanBridge.java:172)
>>>        at
>>> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
>>>        at
>>> com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
>>>        at
>>> javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1426)
>>>        at
>>> javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:72)
>>>        at
>>> javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1264)
>>>        at java.security.AccessController.doPrivileged(Native Method)
>>>        at
>>> javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1366)
>>>        at
>>> javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:788)
>>>        at sun.reflect.GeneratedMethodAccessor175.invoke(Unknown Source)
>>>        at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>>        at
>>> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>>>        at sun.rmi.transport.Transport$1.run(Transport.java:159)
>>>        at java.security.AccessController.doPrivileged(Native Method)
>>>        at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>>>        at
>>> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>>>        at
>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>>>        at
>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
>>>        at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>>        at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>>        at java.lang.Thread.run(Thread.java:619)
>>> 2009-10-23 15:18:29,036 INFO  [startup] Assembling app:
>>> /opt/kms/server/geronimo-2.2-20091022/var/temp/geronimo-deployer1499506686456954036.tmpdir/VDS-lamps-ejb-3.0.jar
>>>
>>> The entity being referenced is in a module called KMS-Personnel-ejb. I
>>> do have this module as a dependency. If it didn't find it, it should
>>> would have told me so. Just a few moments before I deployed this one,
>>> I have this in my log:
>>> 2009-10-23 15:14:49,688 INFO  [AnnotationBinder] Binding entity from
>>> annotated class: net.kunye.personnel.Employee
>>> 2009-10-23 15:14:49,688 INFO  [EntityBinder] Bind entity
>>> net.kunye.personnel.Employee on table Employee
>>> 2009-10-23 15:14:49,690 INFO  [AnnotationBinder] Binding entity from
>>> annotated class: net.kunye.personnel.Visitor
>>> 2009-10-23 15:14:49,690 INFO  [EntityBinder] Bind entity
>>> net.kunye.personnel.Visitor on table Visitor
>>> 2009-10-23 15:14:49,773 INFO  [AnnotationBinder] Binding entity from
>>> annotated class: net.kunye.personnel.Company
>>> 2009-10-23 15:14:49,774 INFO  [EntityBinder] Bind entity
>>> net.kunye.personnel.Company on table Company
>>>
>>> This is my deployment plan: This is my deployment plan for the above
>>> project.
>>>  <dep:environment>
>>>    <dep:moduleId>
>>>      <dep:groupId>net.kunye</dep:groupId>
>>>      <dep:artifactId>VDS-lamps-ejb</dep:artifactId>
>>>      <dep:version>3.0</dep:version>
>>>      <dep:type>jar</dep:type>
>>>    </dep:moduleId>
>>>
>>>    <dep:dependencies>
>>>      <dep:dependency>
>>>        <dep:groupId>net.kunye</dep:groupId>
>>>        <dep:artifactId>VDS-ejb</dep:artifactId>
>>>        <dep:version>3.0</dep:version>
>>>        <dep:type>jar</dep:type>
>>>      </dep:dependency>
>>>      <dep:dependency>
>>>        <dep:groupId>net.kunye</dep:groupId>
>>>        <dep:artifactId>KMS-Personnel-ejb</dep:artifactId>
>>>        <dep:version>1.0</dep:version>
>>>        <dep:type>jar</dep:type>
>>>      </dep:dependency>
>>>    </dep:dependencies>
>>>  </dep:environment>
>>>
>>> Can someone please advise how to get around this. It's an urgent problem.
>>>
>>> Quintin Beukes
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Persistence-unit-%3Cclass%3E-annotation-having-no-effect-tp26026433p26037064.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
>

Mime
View raw message