tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo K. Shikida" <shik...@gmail.com>
Subject Re: org.apache.openjpa.persistence.PersistenceException: null
Date Wed, 18 Sep 2013 16:14:04 GMT
thanks, I'll give it a try

[]

Leo


On Wed, Sep 18, 2013 at 12:50 PM, Romain Manni-Bucau
<rmannibucau@gmail.com>wrote:

> A real project pom doing it:
> https://github.com/rmannibucau/JeBlog/blob/master/pom.xml
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
>
> 2013/9/18 Leonardo K. Shikida <shikida@gmail.com>:
> > So,
> >
> > what seems to work for me now was to enhance the classes before using
> them.
> >
> > thanks Rick and Romain
> >
> > It sounds a little wrong for me that I have to add an annotation
> processor
> > to generate classes for criteria (openjpa.metamodel=true) and another
> step
> > to post-process classes before using the classes. Isn't java source code
> > good enough? :-)
> >
> > And since I am too lazy to add an eclipse plugin that renders in a way
> that
> > I can't read the last checkbox, neither I want to change my eclipse
> project
> > structure to use an ant builder, and neither I want to move from 1.5.2 to
> > 1.6.0 right now, I decided to post-process my class manually with this
> > snippet.
> >
> >     public static void main(String[] args) {
> >         String baseClassDir = "/path/to/classes/";
> >         Collection<File> files = FileUtils.listFiles(new
> > File(baseClassDir), null, true);
> >         for(File file:files){
> >             String[] a = new String[3];
> >             a[0] = "-d";
> >             a[1] = baseClassDir;
> >             a[2] = file.getAbsolutePath();
> >             org.apache.openjpa.enhance.PCEnhancer.main(a);
> >         }
> >     }
> >
> > Maybe this can help someone, I hope :-)
> >
> > TIA
> >
> > Leo
> >
> > []
> >
> > Leo
> >
> >
> > On Wed, Sep 18, 2013 at 11:58 AM, Leonardo K. Shikida <shikida@gmail.com
> >wrote:
> >
> >> Also, it seems somehow consistent about the JDK. Both IBM 7 JDKs for
> >> windows and linux work, and both Oracle JDK for oracle 7 (u40) don't.
> >>
> >> TIA
> >>
> >> Leo
> >>
> >> []
> >>
> >> Leo
> >>
> >>
> >> On Wed, Sep 18, 2013 at 11:52 AM, Leonardo K. Shikida <
> shikida@gmail.com>wrote:
> >>
> >>> Hi Rick
> >>>
> >>> here what happens
> >>>
> >>> when I run from eclipse, using IBM JDK 7 on linux, I defaults to
> subclass
> >>>
> >>>
> >>> WARNING: Creating subclass for "[...]". This means that your
> application
> >>> will be less efficient and will consume more memory than it would if
> you
> >>> ran the OpenJPA enhancer. Additionally, lazy loading will not be
> available
> >>> for one-to-one and many-to-one persistent attributes in types using
> field
> >>> access; they will be loaded eagerly instead.
> >>>
> >>> but it works.
> >>>
> >>> now, the same thing but using the javaagent in eclipse run
> configurations
> >>>
> >>> -javaagent:/path/to/openejb-javaagent.jar
> >>>
> >>> then I get
> >>>
> >>> INFO: Creating subclass and redefining methods for "[...]". This means
> >>> that your application will be less efficient than it would if you ran
> the
> >>> OpenJPA enhancer.
> >>>
> >>> Exception in thread "main" javax.ejb.EJBException: The bean
> encountered a
> >>> non-application exception; nested exception is:
> >>>     <openjpa-2.2.0-r422266:1244990 fatal general error>
> >>> org.apache.openjpa.persistence.PersistenceException: null
> >>>
> >>> which is pretty the same error I get if I use Oracle JVM and no
> javaagent
> >>>
> >>> TIA
> >>>
> >>> Leo
> >>>
> >>>
> >>> []
> >>>
> >>> Leo
> >>>
> >>>
> >>> On Wed, Sep 18, 2013 at 11:35 AM, Rick Curtis <curtisr7@gmail.com>
> wrote:
> >>>
> >>>> The waters are getting pretty muddy here.... but I'll try my best to
> >>>> clear
> >>>> things up.
> >>>>
> >>>> I'm not certain, but I suspect that when running on the IBM JVM, the
> >>>> openjpa.DynamicEnhancementAgent was kicking in an your Entities were
> >>>> getting enhanced automagically. For whatever reason it sounds like
> that
> >>>> wasn't working on the Windows Oracle JVM and it was falling back to
> >>>> subclassing. I know you mentioned that you don't have
> >>>> openjpa.RuntimeUnenhancedClass set to supported, but the initial stack
> >>>> trace that you posted indicates otherwise.
> >>>>
> >>>> The root issue here is that your entities weren't being enhanced. It
> >>>> sounds
> >>>> like now that you have the latest version of the tomEE agent hooked
> up,
> >>>> everything is working? If you prefer to not go the agent path, you
> could
> >>>> always use build time enhancement and not have to mess with any of
> this
> >>>> business.
> >>>>
> >>>> HTH,
> >>>> Rick
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> On Wed, Sep 18, 2013 at 9:16 AM, Romain Manni-Bucau
> >>>> <rmannibucau@gmail.com>wrote:
> >>>>
> >>>> > the javaagent was broken (fixed on trunk) so i fear you need to
> >>>> > enhance classes in your build
> >>>> > Romain Manni-Bucau
> >>>> > Twitter: @rmannibucau
> >>>> > Blog: http://rmannibucau.wordpress.com/
> >>>> > LinkedIn: http://fr.linkedin.com/in/rmannibucau
> >>>> > Github: https://github.com/rmannibucau
> >>>> >
> >>>> >
> >>>> >
> >>>> > 2013/9/18 Leonardo K. Shikida <shikida@gmail.com>:
> >>>> > > Hi Romain
> >>>> > >
> >>>> > > thanks
> >>>> > >
> >>>> > > I am running some code using tomEE embedded in a main() method,
> using
> >>>> > > eclipse.
> >>>> > >
> >>>> > > So I've added to the run configurations->java application->my
> >>>> class->VM
> >>>> > > arguments
> >>>> > >
> >>>> > > -javaagent:/home/myuser/tomee/lib/openejb-javaagent.jar
> >>>> > >
> >>>> > > As suggested in (I guess)
> >>>> > >
> >>>> > >
> >>>> >
> >>>>
> http://webspherepersistence.blogspot.com.br/2009/02/openjpa-enhancement.html
> >>>> > >
> >>>> > > But I still get an error such as
> >>>> > >
> >>>> > > INFO: Creating subclass and redefining methods for "[class
xyz]".
> >>>> This
> >>>> > > means that your application will be less efficient than it
would
> if
> >>>> you
> >>>> > ran
> >>>> > > the OpenJPA enhancer.
> >>>> > > Exception in thread "main" javax.ejb.EJBException: The bean
> >>>> encountered a
> >>>> > > non-application exception; nested exception is:
> >>>> > >     <openjpa-2.2.0-r422266:1244990 fatal general error>
> >>>> > > org.apache.openjpa.persistence.PersistenceException: null
> >>>> > >
> >>>> > > Am I missing something here?
> >>>> > >
> >>>> > > Your posts below talks about some system properties, is it
enough
> to
> >>>> just
> >>>> > > drop them into properties.xml for tomee 1.5.2?
> >>>> > >
> >>>> > >
> >>>> >
> >>>>
> http://rmannibucau.wordpress.com/2012/07/26/tomee-and-openejb-jpa-deploy-time-enhancement/
> >>>> > >
> >>>> > > TIA
> >>>> > >
> >>>> > > Leo
> >>>> > >
> >>>> > >
> >>>> > >
> >>>> > >
> >>>> > >
> >>>> > > []
> >>>> > >
> >>>> > > Leo
> >>>> > >
> >>>> > >
> >>>> > > On Wed, Sep 18, 2013 at 1:36 AM, Romain Manni-Bucau
> >>>> > > <rmannibucau@gmail.com>wrote:
> >>>> > >
> >>>> > >> Hi
> >>>> > >>
> >>>> > >> Note: In tomee on trunk if you list your classes in
> >>>> persistence-unit it
> >>>> > is
> >>>> > >> automatically done if the persistence.xml is in
> >>>> meta-inf/persistence.xml
> >>>> > >> Le 18 sept. 2013 04:40, "Leonardo K. Shikida" <shikida@gmail.com>
> a
> >>>> > écrit
> >>>> > >> :
> >>>> > >>
> >>>> > >> > So just answering myself (openJPA list brought the
solution)
> >>>> > >> >
> >>>> > >> > It seems that if I use IBM JVM (J9) in both windows
and linux,
> it
> >>>> > works.
> >>>> > >> >
> >>>> > >> > If I use oracle's, then I get the error.
> >>>> > >> >
> >>>> > >> > My persistence.xml does not have
> >>>> > >> >
> >>>> > >> >  <property name="openjpa.RuntimeUnenhancedClasses"
> >>>> > value="unsupported"/>
> >>>> > >> >
> >>>> > >> > And I get the warning
> >>>> > >> >
> >>>> > >> > WARNING: Creating subclass for "[...]".
> >>>> > >> > This means that your application will be
> >>>> > >> > less efficient and will consume more memory
> >>>> > >> > than it would if you ran the OpenJPA enhancer.
> >>>> > >> >
> >>>> > >> > Additionally, lazy loading will not be
> >>>> > >> > available for one-to-one and many-to-one
> >>>> > >> > persistent attributes in types using field
> >>>> > >> > access; they will be loaded eagerly instead.
> >>>> > >> >
> >>>> > >> > And this procedure is not recommended as stated at
> >>>> > >> > http://openjpa.apache.org/entity-enhancement.html
> >>>> > >> >
> >>>> > >> > "The use of OpenJPA's subclassing support is not
recommended,
> and
> >>>> is
> >>>> > >> > disabled by default in OpenJPA 2.0 and beyond."
> >>>> > >> >
> >>>> > >> > TIA
> >>>> > >> >
> >>>> > >> >
> >>>> > >> > Leo
> >>>> > >> >
> >>>> > >> >
> >>>> > >> >
> >>>> > >> > []
> >>>> > >> >
> >>>> > >> > Leo
> >>>> > >> >
> >>>> > >> >
> >>>> > >> > On Tue, Sep 17, 2013 at 1:14 PM, Leonardo K. Shikida
<
> >>>> > shikida@gmail.com>
> >>>> > >> > wrote:
> >>>> > >> > >
> >>>> > >> > > Hi
> >>>> > >> > >
> >>>> > >> > > I have an tomee 1.5.2 + that runs perfectly
on linux, but
> when I
> >>>> > try to
> >>>> > >> > run from windows, it gives me the following error
message (see
> >>>> > >> stacktrace)
> >>>> > >> > >
> >>>> > >> > > My doubts are
> >>>> > >> > >
> >>>> > >> > > - what does it mean :-)
> >>>> > >> > > - why only in windows
> >>>> > >> > > - is there any way to deal with this?
> >>>> > >> > >
> >>>> > >> > > My feeling it that it's somehow related to the
OpenJPA
> >>>> enhancement
> >>>> > >> > process, but I really don't have a clue here.
> >>>> > >> > >
> >>>> > >> > > TIA
> >>>> > >> > >
> >>>> > >> > > Leo
> >>>> > >> > >
> >>>> > >> > > Exception in thread "main" javax.ejb.EJBException:
The bean
> >>>> > >> encountered a
> >>>> > >> > non-application exception; nested exception is:
> >>>> > >> > >     <openjpa-2.2.0-r422266:1244990 fatal
general error>
> >>>> > >> > org.apache.openjpa.persistence.PersistenceException:
null
> >>>> > >> > >     at
> >>>> > >> >
> >>>> > >> >
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.convertException(BaseEjbProxyHandler.java:363)
> >>>> > >> > >     at
> >>>> > >> >
> >>>> > >> >
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:283)
> >>>> > >> > >     at (...)    at
> >>>> > >> > > (...)
> >>>> > >> > > Caused by: <openjpa-2.2.0-r422266:1244990
fatal general
> error>
> >>>> > >> > org.apache.openjpa.persistence.PersistenceException:
null
> >>>> > >> > >     at
> >>>> > >> >
> >>>> > >> >
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openjpa.enhance.ClassRedefiner.redefineClasses(ClassRedefiner.java:96)
> >>>> > >> > >     at
> >>>> > >> >
> >>>> > >> >
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(ManagedClassSubclasser.java:176)
> >>>> > >> > >     at
> >>>> > >> >
> >>>> > >> >
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:314)
> >>>> > >> > >     at
> >>>> > >> >
> >>>> > >> >
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:238)
> >>>> > >> > >     at
> >>>> > >> >
> >>>> > >> >
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:212)
> >>>> > >> > >     at
> >>>> > >> >
> >>>> > >> >
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
> >>>> > >> > >     at
> >>>> > >> >
> >>>> > >> >
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
> >>>> > >> > >     at
> >>>> > >> >
> >>>> > >> >
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)
> >>>> > >> > >     at
> >>>> > >> >
> >>>> > >> >
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createEntityManager(ReloadableEntityManagerFactory.java:160)
> >>>> > >> > >     at
> >>>> > >> >
> >>>> > >> >
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.persistence.JtaEntityManagerRegistry.getEntityManager(JtaEntityManagerRegistry.java:115)
> >>>> > >> > >     at
> >>>> > >> >
> >>>> > >> >
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.persistence.JtaEntityManager.getEntityManager(JtaEntityManager.java:80)
> >>>> > >> > >  (...)
> >>>> > >> > > Caused by: java.lang.VerifyError
> >>>> > >> > >     at
> >>>> sun.instrument.InstrumentationImpl.retransformClasses0(Native
> >>>> > >> > Method)
> >>>> > >> > >     at
> >>>> > >> >
> >>>> > >> >
> >>>> > >>
> >>>> >
> >>>>
> sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:144)
> >>>> > >> > >     ... 52 more
> >>>> > >> > >
> >>>> > >> > > []
> >>>> > >> > >
> >>>> > >> > > Leo
> >>>> > >> >
> >>>> > >>
> >>>> >
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> *Rick Curtis*
> >>>>
> >>>
> >>>
> >>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message