构建SSH时,Commons项目中两个包冲突问题的解决

commons-beanutil.jar与commons-collections.jar包中由于结构中都有相同的collections包发生冲突。

解决方法使用commons-beanutil-1.6.1及其之前的版本整合SSH。下面是利用log4监测j时,该问题抛出的异常。

 

[framework] 2008-04-02 14:09:00,765 - org.springframework.web.struts.ContextLoaderPlugIn -47265 [main] ERROR org.springframework.web.struts.ContextLoaderPlugIn  - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/cfg/cfg_spring/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.SecurityException: class "org.apache.commons.collections.CursorableLinkedList"'s signer information does not match signer information of other classes in the same package
java.lang.SecurityException: class "org.apache.commons.collections.CursorableLinkedList"'s signer information does not match signer information of other classes in the same package
 at java.lang.ClassLoader.checkCerts(ClassLoader.java:775)
 at java.lang.ClassLoader.preDefineClass(ClassLoader.java:487)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:614)
 at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
 at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1634)
 at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:860)
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1307)
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
 at org.apache.commons.pool.impl.GenericObjectPool.<init>(GenericObjectPool.java:392)
 at org.apache.commons.pool.impl.GenericObjectPool.<init>(GenericObjectPool.java:258)
 at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:795)
 at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
 at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)
 at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:72)
 at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881)
 at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174)
 at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:822)
 at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:748)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1099)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:400)
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:234)
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:144)
 at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:277)
 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:321)
 at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:139)
 at org.springframework.web.struts.ContextLoaderPlugIn.createWebApplicationContext(ContextLoaderPlugIn.java:353)
 at org.springframework.web.struts.ContextLoaderPlugIn.initWebApplicationContext(ContextLoaderPlugIn.java:296)
 at org.springframework.web.struts.ContextLoaderPlugIn.init(ContextLoaderPlugIn.java:225)
 at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:869)
 at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336)
 at javax.servlet.GenericServlet.init(GenericServlet.java:211)
 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1029)
 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862)
 at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4013)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357)
 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
 at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277)
 at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
 at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
 at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
 at org.apache.catalina.core.StandardService.start(StandardService.java:480)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)

你可能感兴趣的:(java,apache,Hibernate,struts,ssh)