-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: CGLIB generating SecurityException on signed jars
PostPosted: Mon Aug 29, 2005 9:26 pm 
Newbie

Joined: Wed Feb 16, 2005 12:44 am
Posts: 5
I have an application using Hibernate to interface with a SQLServer database. This application has been running fine. But I have a new requirement to deploy parts of my application remotely, which requires me to sign my jar files.

Unfortunately signing my jar files seems to break Hibernate's use of CGLIB, as it generates proxy classes in the same package as the original class. But the original class is signed and the new proxy class is not, generating a java.lang.SecurityException.

I may be able to work around this by reorganising my packages and selectively signing only the jars that need to be deployed remotely (luckily all my Hibernate code will only run on the local server). But I would prefer not to have my project structure dictated by the CGLIB implementation, so if there is another solution I would appreciate the assistance.

Thanks
James

Hibernate version: 3.0.5

Full stack trace of any exception that occurs:
[junit] org.hibernate.HibernateException: CGLIB Enhancement failed: au.com.emia.claim.data.ClaimPendingEvent
[junit] at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:108)
[junit] at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:42)
[junit] at org.hibernate.tuple.PojoTuplizer.buildProxyFactory(PojoTuplizer.java:144)
[junit] at org.hibernate.tuple.AbstractTuplizer.<init>(AbstractTuplizer.java:83)
[junit] at org.hibernate.tuple.PojoTuplizer.<init>(PojoTuplizer.java:54)
[junit] at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:47)
[junit] at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:218)
[junit] at org.hibernate.persister.entity.BasicEntityPersister.<init>(BasicEntityPersister.java:400)
[junit] at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:104)
[junit] at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
[junit] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:211)
[junit] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1005)
[junit] at au.com.emia.HibernateConfigTest.testConfig(HibernateConfigTest.java:38)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[junit] at java.lang.reflect.Method.invoke(Method.java:324)
[junit] at junit.framework.TestCase.runTest(TestCase.java:154)
[junit] at junit.framework.TestCase.runBare(TestCase.java:127)
[junit] at junit.framework.TestResult$1.protect(TestResult.java:106)
[junit] at junit.framework.TestResult.runProtected(TestResult.java:124)
[junit] at junit.framework.TestResult.run(TestResult.java:109)
[junit] at junit.framework.TestCase.run(TestCase.java:118)
[junit] at junit.framework.TestSuite.runTest(TestSuite.java:208)
[junit] at junit.framework.TestSuite.run(TestSuite.java:203)
[junit] at junit.framework.TestSuite.runTest(TestSuite.java:208)
[junit] at junit.framework.TestSuite.run(TestSuite.java:203)
[junit] at au.com.emia.base.junit.LoggingTestSuite.run(LoggingTestSuite.java:36)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:297)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:672)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:567)
[junit] Caused by: net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
[junit] at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:236)
[junit] at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:368)
[junit] at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:280)
[junit] at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:597)
[junit] at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:94)
[junit] ... 30 more
[junit] Caused by: java.lang.reflect.InvocationTargetException
[junit] at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
[junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[junit] at java.lang.reflect.Method.invoke(Method.java:324)
[junit] at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:373)
[junit] at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:218)
[junit] ... 34 more
[junit] Caused by: java.lang.SecurityException: class "au.com.emia.claim.data.ClaimPendingEvent$$EnhancerByCGLIB$$f5c2fb94"'s signer information does not match signer information of other classes in the same package
[junit] at java.lang.ClassLoader.checkCerts(ClassLoader.java:611)
[junit] at java.lang.ClassLoader.defineClass(ClassLoader.java:532)
[junit] ... 39 more


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 1:01 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Isn't http://cglib.sourceforge.net/howto.html about this ?

you need to sign the cglib.jar and its output will be signed...

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 1:38 am 
Newbie

Joined: Wed Feb 16, 2005 12:44 am
Posts: 5
Thanks, that worked.
I had another look at the cglib howto, and now that I know what it is trying to say, I can see that it does in fact say this. But your explaination was a lot clearer.

Thanks
James


Top
 Profile  
 
 Post subject: Re: CGLIB generating SecurityException on signed jars
PostPosted: Wed Sep 24, 2008 3:11 pm 
Newbie

Joined: Wed Sep 24, 2008 3:01 pm
Posts: 1
Location: US
i have same kind of problem .i have changed the java.policy settings and
in other thread they asked me to update to cglib2.2beta1.jar file and i did both no progress ..it happens during only select query operation .

slect query is also very simple select * from salesDirector .

mail me :mchethu_m@yahoo.co.in ..its urgent .Appreciate your help



Caused by: java.lang.NullPointerException
at org.hibernate.tuple.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:372)
at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:3232)
at org.hibernate.event.def.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventListener.java:237)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:174)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:86)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:871)
at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:839)
at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:266)
at org.hibernate.type.EntityType.resolve(EntityType.java:303)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:116)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
at org.hibernate.loader.Loader.doQuery(Loader.java:717)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:392)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:333)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at com.express_scripts.salesdirector.hibernate.HibernateDAO.populateSalesDirector(HibernateDAO.java:108)
at com.express_scripts.salesdirector.SalesDirectorPortlet.doView(SalesDirectorPortlet.java:64)
at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:235)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:163)
at com.ibm.wps.pe.pc.std.cmpf.impl.PortletFilterChainImpl.render(PortletFilterChainImpl.java:144)
at com.ibm.wps.pe.pc.std.invoker.impl.PortletServlet.dispatch(PortletServlet.java:130)
... 153 more

[9/23/08 18:06:34:679 CDT] 00000060 ServletWrappe E SRVE0014E: Uncaught service() exception root cause SalesDirector: java.lang.NullPointerException
at org.hibernate.tuple.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:372)
at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:3232)
at org.hibernate.event.def.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventListener.java:237)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:174)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:86)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:871)
at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:839)
at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:266)
at org.hibernate.type.EntityType.resolve(EntityType.java:303)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:116)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
at org.hibernate.loader.Loader.doQuery(Loader.java:717)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:392)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:333)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at com.express_scripts.salesdirector.hibernate.HibernateDAO.populateSalesDirector(HibernateDAO.java:108)
at com.express_scripts.salesdirector.SalesDirectorPortlet.doView(SalesDirectorPortlet.java:64)
at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:235)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:163)
at com.ibm.wps.pe.pc.std.cmpf.impl.PortletFilterChainImpl.render(PortletFilterChainImpl.java:144)
at com.ibm.wps.pe.pc.std.invoker.impl.PortletServlet.dispatch(PortletServlet.java:130)
at com.ibm.wps.pe.pc.std.invoker.impl.PortletServlet.doGet(PortletServlet.java:69)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at com.ibm.wps.pe.pc.std.cache.CacheablePortlet.service(CacheablePortlet.java:393)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java(Compiled Code))
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:670)
at com.ibm.wps.pe.om.definition.impl.ServletDefinitionImpl$RDWrapper.include(ServletDefinitionImpl.java:419)
at com.ibm.wps.pe.pc.std.invoker.impl.PortletInvokerImpl.invoke(PortletInvokerImpl.java:206)
at com.ibm.wps.pe.pc.std.invoker.impl.PortletInvokerImpl.invoke(PortletInvokerImpl.java:168)
at com.ibm.wps.pe.pc.std.invoker.impl.PortletInvokerImpl.render(PortletInvokerImpl.java:97)
at com.ibm.wps.pe.pc.std.PortletContainerImpl.renderPortlet(PortletContainerImpl.java:110)
at com.ibm.wps.pe.pc.PortletContainerImpl.doRenderPortlet(PortletContainerImpl.java:587)
at com.ibm.wps.pe.ext.render.AbstractRenderManager.performService(AbstractRenderManager.java:247)
at com.ibm.wps.pe.pc.PortletContainerImpl.renderPortlet(PortletContainerImpl.java:115)
at com.ibm.wps.engine.tags.PortletRenderTag.doStartTag(PortletRenderTag.java:161)
at com.ibm._jsp._Control._jspx_meth_wps_portletRender_0(_Control.java:168)
at com.ibm._jsp._Control._jspx_meth_wps_if_0(_Control.java:200)
at com.ibm._jsp._Control._jspService(_Control.java:83)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:91)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1521)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java(Compiled Code))
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java(Compiled Code))
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:121)
at com.ibm.ws.jsp.webcontainerext.JSPExtensionServletWrapper.handleRequest(JSPExtensionServletWrapper.java:215)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:670)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:87)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:52)
at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:45)
at com.ibm.wps.engine.templates.skins.Default.render(Default.java:118)
at com.ibm.wps.engine.templates.SkinTemplate.render(SkinTemplate.java:71)
at com.ibm.wps.composition.elements.Component.render(Component.java:782)
at com.ibm.wps.composition.elements.Control.render(Control.java:132)
at com.ibm.wps.composition.Composition.render(Composition.java:2586)
at com.ibm.websphere.personalization.transformation.PznTransformationLayoutModel.render(PznTransformationLayoutModel.java:70)
at com.ibm.wps.model.wrappers.LayoutModelWrapperFactoryImpl$LayoutModelWrapperImpl.render(LayoutModelWrapperFactoryImpl.java:218)
at com.ibm.wps.model.ModelUtil$WrappedCompositionModel.render(ModelUtil.java:911)
at com.ibm._jsp._UnlayeredContainer_2D_V._jspService(_UnlayeredContainer_2D_V.java:93)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:91)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1521)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java(Compiled Code))
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java(Compiled Code))
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:121)
at com.ibm.ws.jsp.webcontainerext.JSPExtensionServletWrapper.handleRequest(JSPExtensionServletWrapper.java:215)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:670)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:87)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:52)
at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:45)
at com.ibm.wps.engine.templates.skins.Default.render(Default.java:118)
at com.ibm.wps.engine.templates.SkinTemplate.render(SkinTemplate.java:71)
at com.ibm.wps.composition.elements.Component.render(Component.java:782)
at com.ibm.wps.composition.Composition.render(Composition.java:2586)
at com.ibm.websphere.personalization.transformation.PznTransformationLayoutModel.render(PznTransformationLayoutModel.java:70)
at com.ibm.wps.model.wrappers.LayoutModelWrapperFactoryImpl$LayoutModelWrapperImpl.render(LayoutModelWrapperFactoryImpl.java:218)
at com.ibm.wps.model.ModelUtil$WrappedCompositionModel.render(ModelUtil.java:911)
at com.ibm._jsp._UnlayeredContainer_2D_H._jspService(_UnlayeredContainer_2D_H.java:105)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:91)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1521)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java(Compiled Code))
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java(Compiled Code))
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:121)
at com.ibm.ws.jsp.webcontainerext.JSPExtensionServletWrapper.handleRequest(JSPExtensionServletWrapper.java:215)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:670)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.handleRequest(DispatcherServiceImpl.java:87)
at com.ibm.wps.services.dispatcher.DispatcherServiceImpl.include(DispatcherServiceImpl.java:52)
at com.ibm.wps.services.dispatcher.Dispatcher.include(Dispatcher.java:45)
at com.ibm.wps.engine.templates.skins.Default.render(Default.java:118)
at com.ibm.wps.engine.templates.SkinTemplate.render(SkinTemplate.java:71)
at com.ibm.wps.composition.elements.Component.render(Component.java:782)
at com.ibm.wps.composition.Composition.render(Composition.java:2586)
at com.ibm.websphere.personalization.transformation.PznTransformationLayoutModel.render(PznTransformationLayoutModel.java:70)
at com.ibm.wps.model.wrappers.LayoutModelWrapperFactoryImpl$LayoutModelWrapperImpl.render(LayoutModelWrapperFactoryImpl.java:218)
at com.ibm.wps.engine.tags2.PageRenderTag.doStartTag(PageRenderTag.java:396)
at com.ibm._jsp._Home._jspx_meth_wps_pageRender_0(_Home.java:183)
at com.ibm._jsp._Home._jspService(_Home.java:96)

_________________
chethan


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 18, 2008 9:30 am 
Newbie

Joined: Tue Nov 18, 2008 9:27 am
Posts: 1
James_a_woods, how did you solve it? I have the same problem but I don't understand "max" response... My English is very poor, could you explain it to me? Thank you!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.