日期:2014-05-17  浏览次数:20917 次

Class文件加密后,tomcat启动异常,如何解决?
项目需要进行代码加密,采用代码混淆方式,结果启动tomcat后异常,问题可能是spring-asm中的ClassReader类需要加载字节码的时候,但是得到的是加密后的Class文件,所以抛出异常,大家有没有遇到类似问题,请指点一下,小弟谢过了
异常如下:
2012-11-14 10:09:48,890 ERROR FrameworkServlet.java:315     - Context initialization failed
java.lang.ArrayIndexOutOfBoundsException: 31653
        at org.springframework.asm.ClassReader.<init>(Unknown Source)
        at org.springframework.asm.ClassReader.<init>(Unknown Source)
        at org.springframework.asm.ClassReader.<init>(Unknown Source)
        at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:48)
        at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)
        at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:82)
        at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:76)
        at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.checkConfigurationClassCandidate(ConfigurationClassBeanDefini
tionReader.java:302)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:15
7)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.ja
va:132)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:584)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:405)
        at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:443)
        at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:459)
        at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:340)
        at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:307)
        at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
        at javax.servlet.GenericServlet.init(GenericServlet.java:212)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1172)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:992)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4058)
   &