You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by baboune <se...@yahoo.com> on 2011/02/24 21:13:50 UTC
Build time enhancement or GlassFish enhancement?
H,
Sorry for this stupid question but despite reading
http://openjpa.apache.org/entity-enhancement.html
http://openjpa.apache.org/entity-enhancement.html , and
http://people.apache.org/~mprudhom/openjpa/site/openjpa-project/manual/ref_guide_pc_enhance.html
http://people.apache.org/~mprudhom/openjpa/site/openjpa-project/manual/ref_guide_pc_enhance.html
, it seems fair to assume that I should not use build time enhancement of my
entity beans.
Quoting from openjpa manual:
"2.2. Enhancing JPA Entities on Deployment
The JEE 5 specification includes hooks to automatically enhance JPA entities
when they are deployed into a container. Thus, if you are using a JEE
5-compliant application server, OpenJPA will enhance your entities
automatically at runtime. Note that if you prefer build-time enhancement,
OpenJPA's runtime enhancer will correctly recognize and skip pre-enhanced
classes.
If your application server does not support the JEE 5 enhancement hooks,
consider using the build-time enhancement described above, or the more
general runtime enhancement described in the next section."
We are running OpenJPA 1.2.2 on GlassFish 2.1.
No build time enhancement is required correct?
/Thanks
--
View this message in context: http://openjpa.208410.n2.nabble.com/Build-time-enhancement-or-GlassFish-enhancement-tp6061774p6061774.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: Build time enhancement or GlassFish enhancement?
Posted by baboune <se...@yahoo.com>.
As suspected something strange with the class loaded and entities (POJOs)
used in a web service... Stripped the openjpa jar to
PersistenceCapable.class, put that into ear -> worked
--
View this message in context: http://openjpa.208410.n2.nabble.com/Build-time-enhancement-or-GlassFish-enhancement-tp6061774p6086146.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: Build time enhancement or GlassFish enhancement?
Posted by baboune <se...@yahoo.com>.
Dont know if you will get much answer on this one in this thread ;)
I am fine with build time enhancement. BUT, there is one problem due to
this at deployment time. If I enhance my classes, and package those in an
ear alongside one war then I get:
[#|2011-02-26T16:13:36.733+0100|SEVERE|sun-glassfish-comms-server2.0|javax.enterprise.system.tools.d
eployment|_ThreadID=16;_ThreadName=Timer-8;_RequestID=5d90ddb1-09aa-4328-aa94-1b777ca0355a;|Exceptio
n occured in J2EEC Phasejava.lang.ClassNotFoundException:
org.apache.openjpa.enhance.PersistenceCapa
ble
java.lang.NoClassDefFoundError:
org/apache/openjpa/enhance/PersistenceCapable
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.getDeclaredConstructor(Class.java:1985)
at
com.sun.xml.bind.v2.model.nav.ReflectionNavigator.hasDefaultConstructor(ReflectionNavigat
or.java:464)
at
com.sun.xml.bind.v2.model.nav.ReflectionNavigator.hasDefaultConstructor(ReflectionNavigat
or.java:58)
at
com.sun.xml.bind.v2.model.impl.ClassInfoImpl.<init>(ClassInfoImpl.java:193)
at
com.sun.xml.bind.v2.model.impl.RuntimeClassInfoImpl.<init>(RuntimeClassInfoImpl.java:95)
at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createClassInfo(RuntimeModelBuilder.ja
va:108)
at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createClassInfo(RuntimeModelBuilder.ja
va:79)
at
com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:239)
at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:
98)
at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:
79)
at
com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:209)
at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:
93)
at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:
79)
at
com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:315)
at
com.sun.xml.bind.v2.model.impl.TypeRefImpl.calcRef(TypeRefImpl.java:92)
at
com.sun.xml.bind.v2.model.impl.TypeRefImpl.getTarget(TypeRefImpl.java:69)
at
com.sun.xml.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:58)
at
com.sun.xml.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:51)
at
com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java
:74)
at
com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java
:77)
at java.util.AbstractList$Itr.next(AbstractList.java:345)
at
com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:255)
at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:
98)
at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:
79)
at
com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:209)
at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:
93)
at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:
79)
at
com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:315)
at
com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:330)
at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:432)
at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:286)
at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
at
com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:105)
at
com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:153)
at
com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:149)
at java.security.AccessController.doPrivileged(Native Method)
at
com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:148
)
at
com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:87)
at
com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:262)
at
com.sun.tools.ws.wscompile.WsgenTool.buildModel(WsgenTool.java:218)
at com.sun.tools.ws.wscompile.WsgenTool.run(WsgenTool.java:119)
at
com.sun.tools.ws.util.WSToolsObjectFactoryImpl.wsgen(WSToolsObjectFactoryImpl.java:61)
at
com.sun.tools.ws.spi.WSToolsObjectFactory.wsgen(WSToolsObjectFactory.java:107)
at com.sun.enterprise.webservice.WsUtil.runWsGen(WsUtil.java:1845)
at com.sun.enterprise.webservice.WsUtil.genWSInfo(WsUtil.java:2249)
at
com.sun.enterprise.deployment.backend.AppDeployerBase.loadDescriptors(AppDeployerBase.jav
a:360)
at
com.sun.enterprise.deployment.backend.AppDeployer.explodeArchive(AppDeployer.java:303)
at
com.sun.enterprise.deployment.backend.AppDeployer.deploy(AppDeployer.java:207)
at
com.sun.enterprise.deployment.backend.AppDeployer.doRequestFinish(AppDeployer.java:148)
at
com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:208)
at
com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:1
08)
at
com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentServi
ce.java:966)
at
com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java
:280)
at
com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java
:298)
at
com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.deploy(ApplicationsConfigMBean.ja
va:584)
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
com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:390)
at
com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:373)
at
com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:477)
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerIntercepto
r.java:836)
at
com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:90)
at $Proxy1.invoke(Unknown Source)
at
com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:
304)
at
com.sun.enterprise.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:170)
at
com.sun.enterprise.deployment.autodeploy.AutoDeployer.invokeDeploymentService(AutoDeploye
r.java:583)
at
com.sun.enterprise.deployment.autodeploy.AutoDeployer.deployJavaEEArchive(AutoDeployer.ja
va:564)
at
com.sun.enterprise.deployment.autodeploy.AutoDeployer.deploy(AutoDeployer.java:495)
at
com.sun.enterprise.deployment.autodeploy.AutoDeployer.deployAll(AutoDeployer.java:270)
at
com.sun.enterprise.deployment.autodeploy.AutoDeployControllerImpl$AutoDeployTask.run(Auto
DeployControllerImpl.java:374)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Caused by: java.lang.ClassNotFoundException:
org.apache.openjpa.enhance.PersistenceCapable
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 92 more
|#]
[#|2011-02-26T16:13:36.735+0100|SEVERE|sun-glassfish-comms-server2.0|javax.enterprise.system.tools.d
eployment|_ThreadID=16;_ThreadName=Timer-8;org/apache/openjpa/enhance/PersistenceCapable
;_RequestID=5d90ddb1-09aa-4328-aa94-1b777ca0355a;|"DPL8011: autodeployment
failure while deploying t
he application : org/apache/openjpa/enhance/PersistenceCapable
"|#]
Note that his happens only if I have a war file in th ear, there are no such
problems with jars.
I suspect that the enhanced classes and the wsgen (transform annotations
into web service) somehow rely on a different class loader than the openjpa
jars...
BR
/Nicolas
--
View this message in context: http://openjpa.208410.n2.nabble.com/Build-time-enhancement-or-GlassFish-enhancement-tp6061774p6067771.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: Build time enhancement or GlassFish enhancement?
Posted by ljnelson <lj...@gmail.com>.
On Thu, Feb 24, 2011 at 4:25 PM, Michael Dick [via OpenJPA] <
ml-node+6062079-1927496547-155969@n2.nabble.com> wrote:
> Where build time enhancement can really help you is if you run some
> acceptance or unit tests before deploying to Glassfish. It's always nice to
>
> test with the same bytecode that you deploy.
>
Slight tangent and I hope this isn't a thread hijack: I'd like to hear from
people--particularly Maven users--who support more than one JPA provider.
How do you do your build time enhancements so that all the enhanced versions
of the classes don't crash into each other or get mixed up?
Best,
Laird
--
View this message in context: http://openjpa.208410.n2.nabble.com/Build-time-enhancement-or-GlassFish-enhancement-tp6061774p6062142.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: Build time enhancement or GlassFish enhancement?
Posted by Michael Dick <mi...@gmail.com>.
Just to add to Rick's comments.
Where build time enhancement can really help you is if you run some
acceptance or unit tests before deploying to Glassfish. It's always nice to
test with the same bytecode that you deploy.
That said, it Glassfish should configure the automatic enhancement if you
use a container managed EntityManagerFactory or EntityManager. It's not
required to hook in a class transformer for enhancement if you use the
javax.persistence.Persistence bootstrap class.
So, like Rick said, taking the time to do build time enhancement can
eliminate one more variant in your environment (and save some headaches).
Hope this helps
-mike
On Thu, Feb 24, 2011 at 2:23 PM, Rick Curtis <cu...@gmail.com> wrote:
> I'd recommend taking the time to setup build time enhancement. You'll save
> on headaches in the long run.
>
> Thanks,
> Rick
>
> On Thu, Feb 24, 2011 at 2:13 PM, baboune <se...@yahoo.com> wrote:
>
> >
> > H,
> >
> > Sorry for this stupid question but despite reading
> > http://openjpa.apache.org/entity-enhancement.html
> > http://openjpa.apache.org/entity-enhancement.html , and
> >
> >
> http://people.apache.org/~mprudhom/openjpa/site/openjpa-project/manual/ref_guide_pc_enhance.html
> >
> >
> http://people.apache.org/~mprudhom/openjpa/site/openjpa-project/manual/ref_guide_pc_enhance.html
> > , it seems fair to assume that I should not use build time enhancement of
> > my
> > entity beans.
> >
> > Quoting from openjpa manual:
> > "2.2. Enhancing JPA Entities on Deployment
> >
> > The JEE 5 specification includes hooks to automatically enhance JPA
> > entities
> > when they are deployed into a container. Thus, if you are using a JEE
> > 5-compliant application server, OpenJPA will enhance your entities
> > automatically at runtime. Note that if you prefer build-time enhancement,
> > OpenJPA's runtime enhancer will correctly recognize and skip pre-enhanced
> > classes.
> >
> > If your application server does not support the JEE 5 enhancement hooks,
> > consider using the build-time enhancement described above, or the more
> > general runtime enhancement described in the next section."
> >
> > We are running OpenJPA 1.2.2 on GlassFish 2.1.
> >
> > No build time enhancement is required correct?
> >
> >
> > /Thanks
> >
>
Re: Build time enhancement or GlassFish enhancement?
Posted by Rick Curtis <cu...@gmail.com>.
I'd recommend taking the time to setup build time enhancement. You'll save
on headaches in the long run.
Thanks,
Rick
On Thu, Feb 24, 2011 at 2:13 PM, baboune <se...@yahoo.com> wrote:
>
> H,
>
> Sorry for this stupid question but despite reading
> http://openjpa.apache.org/entity-enhancement.html
> http://openjpa.apache.org/entity-enhancement.html , and
>
> http://people.apache.org/~mprudhom/openjpa/site/openjpa-project/manual/ref_guide_pc_enhance.html
>
> http://people.apache.org/~mprudhom/openjpa/site/openjpa-project/manual/ref_guide_pc_enhance.html
> , it seems fair to assume that I should not use build time enhancement of
> my
> entity beans.
>
> Quoting from openjpa manual:
> "2.2. Enhancing JPA Entities on Deployment
>
> The JEE 5 specification includes hooks to automatically enhance JPA
> entities
> when they are deployed into a container. Thus, if you are using a JEE
> 5-compliant application server, OpenJPA will enhance your entities
> automatically at runtime. Note that if you prefer build-time enhancement,
> OpenJPA's runtime enhancer will correctly recognize and skip pre-enhanced
> classes.
>
> If your application server does not support the JEE 5 enhancement hooks,
> consider using the build-time enhancement described above, or the more
> general runtime enhancement described in the next section."
>
> We are running OpenJPA 1.2.2 on GlassFish 2.1.
>
> No build time enhancement is required correct?
>
>
> /Thanks
>