yes and no: you can't guarantee it works in application servers.

There are patches for it and open jiras on commons-lang, not sure the state
of it

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/2/21 <[email protected]>

> Thank you for explanation.
>
> I have used commons-lang for Serialization-Deserialization. Many other
> libraries and applications are using it too, or deserializing objects
> without respecting the TCCL.
> Does it mean that all this Applications and libraries will not work in
> TomEE?
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Romain Manni-Bucau [mailto:[email protected]]
> Gesendet: Mittwoch, 20. Februar 2013 20:44
> An: [email protected]
> Betreff: Re: AW: Class loading problem in TomEE 1.5.1
>
> sad to say you didn't reproduce it completely but i got the issue.
>
> first i don't think it is linked to tomcat (if you use tomcat clustering
> classes you'll not get it).
>
> the fix is simply to not use an ObjectInputStream but this child (in dirty
> mode):
>
> in = new ObjectInputStream(inputStream) {
>                 @Override
>                 protected Class<?> resolveClass(ObjectStreamClass desc)
>                         throws IOException, ClassNotFoundException {
>                     return
> Thread.currentThread().getContextClassLoader().loadClass(desc.getName());
>                 }
>             };
>
> if you update your sample with this code it will work fine.
>
> Tomcat more or less does it automatically.
>
> I don't have time to go further right now but i think somebody else is
> serializing without respecting the TCCL.
>
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> *Blog: **http://rmannibucau.wordpress.com/*<
> http://rmannibucau.wordpress.com/>
> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> *Github: https://github.com/rmannibucau*
>
>
>
> 2013/2/20 <[email protected]>
>
> > Hi,
> >
> > I have just reproduced an issue which I have in my Application.
> > Steps to reproduce:
> >
> > *Checkout project from https://github.com/eiskonzept/tomee/
> > *Start TomEE maven plugin with node1 profile *Open in browser:
> > /<application_context_root>/index.xhtml
> > *Press submit button.
> > *Following code will be executed:
> >         ByteArrayOutputStream byteArrayOutputStream = new
> > ByteArrayOutputStream();
> >         SerializationUtils.serialize(new DefaultRequestTypeResolver(),
> > byteArrayOutputStream);
> >         byte[] bytes = byteArrayOutputStream.toByteArray();
> >         try {
> >             byteArrayOutputStream.close();
> >         } catch (IOException e) {
> >             e.printStackTrace();        }
> >         Object deserialize = SerializationUtils.deserialize(bytes);
> >
> > Exception:
> > org.apache.commons.lang.SerializationException:
> > java.lang.ClassNotFoundException:
> > org.apache.myfaces.extensions.cdi.jsf2.impl.request.DefaultRequestType
> > Resolver
> >
> > org.apache.commons.lang.SerializationUtils.deserialize(SerializationUt
> > ils.java:166)
> >
> > org.apache.commons.lang.SerializationUtils.deserialize(SerializationUt
> > ils.java:193)
> >
> > de.test.PassivationCapableBean.submit(PassivationCapableBean.java:55)
> >         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j
> > ava:57)
> >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >         java.lang.reflect.Method.invoke(Method.java:601)
> >
> > org.apache.webbeans.intercept.InterceptorHandler.invoke(InterceptorHan
> > dler.java:322)
> >
> > org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.invok
> > e(NormalScopedBeanInterceptorHandler.java:117)
> >
> > org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.invok
> > e(NormalScopedBeanInterceptorHandler.java:108)
> >
> >
> de.test.PassivationCapableBean_$$_javassist_27.submit(PassivationCapableBean_$$_javassist_27.java)
> >         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j
> > ava:57)
> >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >         java.lang.reflect.Method.invoke(Method.java:601)
> >         org.apache.el.parser.AstValue.invoke(AstValue.java:278)
> >
> > org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:27
> > 4)
> >
> > org.apache.myfaces.view.facelets.el.ContextAwareTagMethodExpression.in
> > voke(ContextAwareTagMethodExpression.java:96)
> >
> > org.apache.myfaces.application.ActionListenerImpl.processAction(Action
> > ListenerImpl.java:68)
> >
> > org.apache.myfaces.extensions.cdi.jsf.impl.security.SecurityViolationA
> > wareActionListener.processAction(SecurityViolationAwareActionListener.
> > java:56)
> >
> > org.apache.myfaces.extensions.cdi.jsf.impl.config.view.ViewControllerA
> > ctionListener.processAction(ViewControllerActionListener.java:68)
> >
> >
> org.apache.myfaces.extensions.cdi.jsf.impl.listener.action.CodiActionListener.processAction(CodiActionListener.java:58)
> >         javax.faces.component.UICommand.broadcast(UICommand.java:120)
> >
> > javax.faces.component.UIViewRoot._broadcastAll(UIViewRoot.java:1028)
> >
> > javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:286)
> >
> > javax.faces.component.UIViewRoot._process(UIViewRoot.java:1375)
> >
> > javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:75
> > 2)
> >
> > org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeA
> > pplicationExecutor.java:38)
> >
> > org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.
> > java:170)
> >
> > org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:
> > 117)
> >
> >
> org.apache.myfaces.extensions.cdi.jsf2.impl.listener.phase.CodiLifecycleWrapper.execute(CodiLifecycleWrapper.java:95)
> >         javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Romain Manni-Bucau [mailto:[email protected]]
> > Gesendet: Mittwoch, 6. Februar 2013 14:42
> > An: [email protected]
> > Betreff: Re: AW: Class loading problem in TomEE 1.5.1
> >
> > yep, i just commited it today so it will be available tomorrow
> >
> > *Romain Manni-Bucau*
> > *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> > *Blog: **http://rmannibucau.wordpress.com/*<
> > http://rmannibucau.wordpress.com/>
> > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> > *Github: https://github.com/rmannibucau*
> >
> >
> >
> > 2013/2/6 <[email protected]>
> >
> > > What should I rebuild from sources? :) I just replaced as proposed:
> > >
> > > org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4J
> > > Lo
> > > gger
> > > by
> > > org.apache.commons.logging.Log=org.apache.openejb.log.commonslogging
> > > .L
> > > og4J4AppOpenEJB4ContainerLog
> > >
> > > in my commons-logging.properties.
> > > Or I got you wrong and this workaround will work only in future builds?
> > >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Romain Manni-Bucau [mailto:[email protected]]
> > > Gesendet: Mittwoch, 6. Februar 2013 12:09
> > > An: [email protected]
> > > Betreff: Re: AW: Class loading problem in TomEE 1.5.1
> > >
> > > you rebuilt it from sources?
> > >
> > > *Romain Manni-Bucau*
> > > *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> > > *Blog: **http://rmannibucau.wordpress.com/*<
> > > http://rmannibucau.wordpress.com/>
> > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> > > *Github: https://github.com/rmannibucau*
> > >
> > >
> > >
> > > 2013/2/6 <[email protected]>
> > >
> > > > Just tried proposed workaround and got exception:
> > > >
> > > > Error configuring application listener of class
> > > > com.opensymphony.webwork.lifecycle.SessionLifecycleListener
> > > > java.lang.ExceptionInInitializerError
> > > >         at
> > > > sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> > > > Method)
> > > >         at
> > > >
> > > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruc
> > > to
> > > rAccessorImpl.java:57)
> > > >         at
> > > >
> > > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Delegating
> > > Co
> > > nstructorAccessorImpl.java:45)
> > > >         at
> > > java.lang.reflect.Constructor.newInstance(Constructor.java:525)
> > > >         at
> > > >
> > > org.apache.webbeans.inject.InjectableConstructor.doInjection(Injecta
> > > bl
> > > eConstructor.java:89)
> > > >         at
> > > >
> > > org.apache.openejb.cdi.ConstructorInjectionBean.createInstance(Const
> > > ru
> > > ctorInjectionBean.java:77)
> > > >         at
> > > >
> > > org.apache.webbeans.component.AbstractOwbBean.create(AbstractOwbBean
> > > .j
> > > ava:186)
> > > >         at
> > > > org.apache.openejb.core.WebContext.newInstance(WebContext.java:107)
> > > >         at
> > > >
> > > org.apache.tomee.catalina.JavaeeInstanceManager.newInstance(JavaeeIn
> > > st
> > > anceManager.java:55)
> > > >         at
> > > >
> > > org.apache.tomee.catalina.JavaeeInstanceManager.newInstance(JavaeeIn
> > > st
> > > anceManager.java:48)
> > > >         at
> > > >
> > > org.apache.catalina.core.StandardContext.listenerStart(StandardConte
> > > xt
> > > .java:4727)
> > > >         at
> > > >
> > > org.apache.catalina.core.StandardContext.startInternal(StandardConte
> > > xt
> > > .java:5285)
> > > >         at
> > > > org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> > > >         at
> > > >
> > > org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.
> > > java:901)
> > > >         at
> > > >
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
> > > >         at
> > > > org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
> > > >         at
> > > >
> > > org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.j
> > > av
> > > a:657)
> > > >         at
> > > >
> > > org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConf
> > > ig
> > > .java:1637)
> > > >         at
> > > >
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
> > > >         at
> > > > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
> > > >         at java.util.concurrent.FutureTask.run(FutureTask.java:166)
> > > >         at
> > > >
> > > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor
> > > .j
> > > ava:1110)
> > > >         at
> > > >
> > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.
> > > java:603)
> > > >         at java.lang.Thread.run(Thread.java:722)
> > > > Caused by: org.apache.commons.logging.LogConfigurationException:
> > > > User-specified log class
> > > > 'org.apache.openejb.log.commonslogging.Log4J4AppOpenEJB4ContainerLog'
> > > > cannot be found or is not useable.
> > > >         at
> > > >
> > > org.apache.commons.logging.impl.LogFactoryImpl.discoverLogImplementa
> > > ti
> > > on(LogFactoryImpl.java:874)
> > > >         at
> > > >
> > > org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactor
> > > yI
> > > mpl.java:604)
> > > >         at
> > > >
> > > org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactor
> > > yI
> > > mpl.java:336)
> > > >         at
> > > >
> > > org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactor
> > > yI
> > > mpl.java:310)
> > > >         at
> > > > org.apache.commons.logging.LogFactory.getLog(LogFactory.java:685)
> > > >         at
> > > >
> > > com.opensymphony.webwork.lifecycle.SessionLifecycleListener.<clinit>
> > > (S
> > > essionLifecycleListener.java:28)
> > > >         ... 24 more
> > > >
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Romain Manni-Bucau [mailto:[email protected]]
> > > > Gesendet: Mittwoch, 6. Februar 2013 11:21
> > > > An: [email protected]
> > > > Betreff: Re: AW: Class loading problem in TomEE 1.5.1
> > > >
> > > > that's more or less a bug in commons-logging which respects
> > > > classloading but uses the current class loader configuration even
> > > > when instantiating classes from upper classloader.
> > > >
> > > > It means it works for your app but not for the container part
> > > > (myfaces) which will reuse your config but the parent classloader.
> > > >
> > > > The workaround i added is the following one:
> > > >
> > > > replace
> > > > org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log
> > > > 4J
> > > > Lo
> > > > gger
> > > > by
> > > > org.apache.commons.logging.Log=org.apache.openejb.log.commonslogging.
> > > > Log4J4AppOpenEJB4ContainerLog
> > > >
> > > > i opened https://issues.apache.org/jira/browse/TOMEE-758 about it
> > > >
> > > > PS: you can implement any other facade you'd like to match your
> > > > need
> > > >
> > > > *Romain Manni-Bucau*
> > > > *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> > > > *Blog: **http://rmannibucau.wordpress.com/*<
> > > > http://rmannibucau.wordpress.com/>
> > > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> > > > *Github: https://github.com/rmannibucau*
> > > >
> > > >
> > > >
> > > > 2013/2/5 <[email protected]>
> > > >
> > > > > just have reproduced not exactly the same issue, but very
> > > > > similar, in my test project:
> > > > > https://github.com/eiskonzept/tomee
> > > > > Just package the app and start tomee-plugin with node1 profile.
> > > > >
> > > > > Explanation:
> > > > > I have two dependencies in my project: commons-logging and log4j.
> > > > > If I package both libraries in my webapp I become:
> > > > > "LogConfigurationException: User-specified log class
> > > > > 'org.apache.commons.logging.impl.Log4JLogger' cannot be found or
> > > > > is not useable"
> > > > > which means that commons-logging can't find Log4JLogger class.
> > > > >
> > > > > When I put log4j.jar in tomee's lib folder it works just fine.
> > > > > But I can't do this with other libraries in real Project,
> > > > > because we use some special versions of libraries(quartz for
> > > > > example) which are
> > > > provided by tomee too.
> > > > >
> > > > > is there any possibility to use my own versions of libraries
> > > > > which already provided by tomee?
> > > > >
> > > > > -----Ursprüngliche Nachricht-----
> > > > > Von: [email protected]
> > > > > [mailto:[email protected]]
> > > > > Gesendet: Montag, 4. Februar 2013 13:12
> > > > > An: [email protected]
> > > > > Betreff: AW: AW: Class loading problem in TomEE 1.5.1
> > > > >
> > > > > I got further by copying log4j.jar in CATALINA_BASE/lib folder,
> > > > > but then I got next NoClassDefFoundError.
> > > > > Most confusing is that the same application deployed in TomEE
> > > > > Version 1.5.0 works perfectly.
> > > > > I believe it is some kind of class loader issue. Are there some
> > > > > significant class loader changes between version 1.5.0 and 1.5.1?
> > > > > It looks like that container is loading some classes from
> > > > > container provided commons-logging.jar first, and then can't
> > > > > find some classes in WEB-APP/lib which needed by commons-logging.
> > > > >
> > > > > -----Ursprüngliche Nachricht-----
> > > > > Von: Romain Manni-Bucau [mailto:[email protected]]
> > > > > Gesendet: Montag, 4. Februar 2013 12:13
> > > > > An: [email protected]
> > > > > Betreff: Re: AW: Class loading problem in TomEE 1.5.1
> > > > >
> > > > > Hard to help since we dont "see" the issue
> > > > >
> > > > > You probably have some conflict in your app.
> > > > >
> > > > > Check your deps maybe
> > > > > Le 4 févr. 2013 12:11, <[email protected]> a écrit :
> > > > >
> > > > > > I have tried both: with commons-logging in my war file and
> without.
> > > > > > With same result(exception) in both cases.
> > > > > > I have tried to isolate the issue in small sample app, but
> > > > > > without success. Unfortunately I can't provide full
> > > > > > application for
> > > > reproduction.
> > > > > > Could you give some hints, how can I help you to reproduce the
> > > > > > problem on your side or solve the issue by myself?
> > > > > >
> > > > > >
> > > > > > > Note: did you put commons-logging in your app too?
> > > > > >
> > > > > > > can you reproduce it in a sample webapp?
> > > > > >
> > > > >
> > > >
> > >
> >
>

Reply via email to