提问人:uday 提问时间:10/20/2023 更新时间:10/20/2023 访问量:39
获取嵌套异常为:IllegalArgumentException:Java 中超出了代码大小限制
getting nested exception is: IllegalArgumentException: code size limit exceeded in Java
问:
我有一个 Java 项目,其中包含多个模块(休眠、对象和存储方法)作为项目,所有这些项目类和方法都通过物流层(包含接口和实现的方法)作为 Weblayer 的 RemoteException 访问,其中包含 bean 和 xhtml 文件。 (Java 1.8、apache tomcat8、eclipse luna)
在中间的物流层包含许多接口,并通过相互扩展的模块来实现方法。
public interface LogisticsManager extends LogisticsValidationManager,
LogisticsPOManager, LogisticsSessionManager, LogisticsDrivManager,
LogisticsTripManager, LogisticsRoundManager, LogisticsTaxManager,
LogisticsContainerManager, LogisticsCompanyManager,
LogisticsLocationManager, LogisticsCardManager,
....{
public void start() throws RemoteException, LogisticsException;
public void stop() throws RemoteException, LogisticsException;
public LogisticsConfig getLogisticsConfig()
throws RemoteException, LogisticsException;
public String getStatisticsString() throws RemoteException;
public String getMessage(String componentName, String messageCode, Object[] args)
throws RemoteException, LogisticsException;
}
//Sample Interface file
public interface LogisticsCompanyManager extends java.rmi.Remote {
public String createCompany(String sessionId, CompanyObject companyObject)
throws RemoteException, LogisticsException, CompanyException,
CompanyExistsException;
public void activateCompany(String sessionId, String companyId)
throws RemoteException, LogisticsException, CompanyException,
CompanyNotFoundException;
public void inactivateCompany(String sessionId, String companyId)
throws RemoteException, LogisticsException, CompanyException,
CompanyNotFoundException;
public void updateCompany(String sessionId, CompanyObject companyObject)
throws RemoteException, LogisticsException, CompanyException,
CompanyNotFoundException;
public void removeCompany(String sessionId, String companyId)
throws RemoteException, LogisticsException, CompanyException,
CompanyNotFoundException;
public CompanyObject getCompany(String sessionId, String companyId)
throws RemoteException, LogisticsException, CompanyException,
CompanyNotFoundException;
public CompanyObject getCompanyByName(String sessionId, String companyName)
throws RemoteException, LogisticsException, CompanyException,
CompanyNotFoundException;
public java.util.List<CompanyObject> getCompanies(String sessionId)
throws RemoteException, LogisticsException, CompanyException;
}
public abstract class LogisticsCompanyManagerImpl
extends LogisticsContainerManagerImpl {
//... have method implementations...
}
现在我正在尝试在 Interface 和 impl 类中添加更多方法。在 Ant 中编译时没有错误。但是,在 ApacheTomcat 8 中部署时,它不会部署,而是获得以下错误日志:
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'logisticsManager' defined in class path resource [com/cosoft/logistics/logisticsClient.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: code size limit exceeded
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:742)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4812)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:939)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1812)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: code size limit exceeded
at sun.misc.ProxyGenerator.generateStaticInitializer(ProxyGenerator.java:1261)
at sun.misc.ProxyGenerator.generateClassFile(ProxyGenerator.java:484)
at sun.misc.ProxyGenerator.generateProxyClass(ProxyGenerator.java:339)
at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:639)
at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:557)
at java.lang.reflect.WeakCache$Factory.get(WeakCache.java:230)
at java.lang.reflect.WeakCache.get(WeakCache.java:127)
at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:419)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:719)
at org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:122)
at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:109)
at org.springframework.remoting.rmi.RmiProxyFactoryBean.afterPropertiesSet(RmiProxyFactoryBean.java:72)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)`
我尝试了增加VM大小的选项 在 Eclipse INI 文件中
-vmargs -XMX2400米 -XMS1024米 -XX:PermSize=512m -XX:MaxPermSize=1023m
同样在 Tomcat Web 文件中 JAVA_OPTS=“$JAVA_OPTS -XX:MaxInlineSize=1000 $LOGGING_CONFIG”
还尝试在单独的文件中创建 New Interface 和 Impl 方法并扩展到 LogisticsManager,但仍然出现相同的错误。
我想在物流中添加更多模块及其接口和 Impl 方法。
答: 暂无答案
评论