关于cglib的问题,各位老大帮忙看一下

ygniu 发布于 2009/07/07 10:13
阅读 1K+
收藏 0

纯web项目,项目中用到了cglib中的部分功能,代码如下:
private Object getInstrumentedClass(Class clz)
{
enhancer = new Enhancer();
enhancer.setSuperclass(clz);
enhancer.setCallback(this);
return enhancer.create();
}

奇怪的事情出现了,相同的包,当发布到sges-2_1-solaris上时,系统运行正常,当发布到sges_ee-2_1-solaris上时,程序走到enhancer = new Enhancer();报错,提示信息如下:
[#|2009-07-05T15:12:19.773+0800|SEVERE|sun-appserver2.1|javax.enterprise.system.container.web|_ThreadID=15;_ThreadName=h
ttpSSLWorkerThread-8080-1;_RequestID=a3458278-b2de-4e8e-9616-e3516430293d;|StandardWrapperValve[OBDispatcherServlet]: PW
C1406: Servlet.service() for servlet OBDispatcherServlet threw exception
java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer
        at com.iss.sysframe.base.aop.BizAopInstrumenter. <init>(BizAopInstrumenter.java:26)
        at com.iss.draftoperation.draftebank.systemManage.openbanksetting.action.OpenBankSettingAction. <init>(OpenBankSe
ttingAction.java:13)
        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 java.lang.Class.newInstance0(Class.java:355)
        at java.lang.Class.newInstance(Class.java:308)
        at com.iss.sysframe.servlet.OBDispatcherServlet.executeClassMethods(OBDispatcherServlet.java:187)
        at com.iss.sysframe.servlet.OBDispatcherServlet.doPost(OBDispatcherServlet.java:123)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
        at sun.reflect.GeneratedMethodAccessor163.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:292)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
        at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:325)
        at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:208)
        at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:420)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:333)
        at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:91)
        at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
        at com.iss.sysframe.filter.EncodingFilter.doFilter(EncodingFilter.java:26)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
        at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:91)
        at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:313)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:288)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:647)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:579)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:831)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
|#]

查了好多资料,甚至将cglib的源码考到项目中,修改了包名都解决不了,请各位帮忙看一下这个问题该怎么解决?

个人感觉是不是sges_ee-2_1-solaris比sges-2_1-solaris在安全配置上需要进行一些调整,才能支持cglib?

多谢多谢!

加载中
0
红薯
红薯

这应该是一个 ClassLoader 的问题吧,问题集中下面这句错误信息上

java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer

0
y
ygniu

多谢楼上回复,正如楼上所说确实是ClassLoader 的问题,但是为什么非企业版上就可以,企业版就会报错?net.sf.cglib.proxy.Enhancer 这个类我甚至把cglib整个的源代码放到项目里面仍然还报这个错实在是没辙了,大家帮帮忙!

返回顶部
顶部