SSH整合JAR

struts的jar多而且都在一个lib里面,让人一下以为都要加入的(一般都会加入的,那些是必须的自己测):

commons-fileupload-x.x.jar;
commons-io-x.x.jar;
commons-lang3-x.x.jar;
commons-loggin-x.x.jar;
freemarker-x.x.jar;
javassist-x.x.jar;
ognl-x.x.jar;
strut2-core-x.x.jar;
xwork-core-x.x.jar;
asm-x.x.jar;

还有其他的组件看自己需要;

还有commons-lang3-x.x.jar这个包和commons-lang-x.x.jar如果是使用json的话,注意这里是后面那个包,有一个异常类是因为缺少后面那个包。

spring的jar我一般全部加入。

hibernate一般加入的jar:required(必须);optional/c3p0(连接池);optional/ehcache(二级缓存有关,暂时没用到,不过防止以后用);jpa;

一些常见的jar异常:

=====================缺少:aopalliance-1.0.jar=====================

 org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [file:/*/applicationContext.xml]; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor
 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
 at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
 at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
 at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
 ...

=====================缺少:aopalliance-1.0.jar=====================

=====================缺少:dom4j-x.x.x.jar=====================

{main} java.lang.ClassNotFoundException: org.dom4j.io.SAXReader in EnvironmentClassLoader[web-app:http://localhost:8080]
{main}   at com.caucho.loader.DynamicClassLoader.loadClass(DynamicClassLoader.java:1224)
{main}   at com.caucho.loader.DynamicClassLoader.loadClass(DynamicClassLoader.java:1203)

=====================缺少:dom4j-x.x.x.jar=====================

=====================缺少:jaxen-x.x.x.jar=====================

{main} java.lang.ClassNotFoundException: org.jaxen.JaxenException in EnvironmentClassLoader[web-app:http://localhost:8080]
{main}   at com.caucho.loader.DynamicClassLoader.loadClass(DynamicClassLoader.java:1224)
{main}   at com.caucho.loader.DynamicClassLoader.loadClass(DynamicClassLoader.java:1203)
{main}   at org.dom4j.DocumentFactory.createXPath(DocumentFactory.java:230)
{main}   at org.dom4j.tree.AbstractNode.createXPath(AbstractNode.java:207)

=====================缺少:jaxen-x.x.x.jar=====================

很少报错,但是还是有,我在resin里面就遇到这个问题

=====================缺少:jstl-x.x.x.jar=====================

{http-dm-8080-12$2901755} java.lang.NoClassDefFoundError: org/apache/taglibs/standard/tag/rt/fmt/FormatDateTag
{http-dm-8080-12$2901755}        at _jsp._army._activity__jsp.init(_activity__jsp.java:245)
{http-dm-8080-12$2901755}        at com.caucho.jsp.JspManager.preload(JspManager.java:320)
{http-dm-8080-12$2901755}        at com.caucho.jsp.JspManager.compile(JspManager.java:218)
{http-dm-8080-12$2901755}        at com.caucho.jsp.JspManager.createPage(JspManager.java:171)
{http-dm-8080-12$2901755}        at com.caucho.jsp.JspManager.createPage(JspManager.java:150)
{http-dm-8080-12$2901755}        at com.caucho.jsp.PageManager.getPage(PageManager.java:248)
{http-dm-8080-12$2901755}        at com.caucho.jsp.PageManager.getPage(PageManager.java:178)
{http-dm-8080-12$2901755}        at com.caucho.jsp.PageManager.getPage(PageManager.java:161)
{http-dm-8080-12$2901755}        at com.caucho.jsp.QServlet.getSubPage(QServlet.java:295)
{http-dm-8080-12$2901755}        at com.caucho.jsp.QServlet.getPage(QServlet.java:210)

=====================缺少:jstl-x.x.x.jar=====================

不要忘记jdbc驱动。
带有-sources-是源码,不用加。
x.x代表版本号。

下图为我的jar:
SSH整合JAR