SSH整合Jar

0

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

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

还有其他的组件看自己需要;
还有commons-lang3-x.x.jar这个包和commons-lang-x.x.jar如果是使用JSON的话,注意这里是后面那个包,有一个异常类是因为缺少后面那个包。

springjar我一般全部加入。

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

一些常见的缺少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)
 ...

缺少: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)

缺少: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)

缺少: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)

不要忘记jdbc驱动,带有-sources-是源码,不用加。

下图是我的jar

SSH整合Jar

20220518批注
当年还是手动管理jar,还没有使用Maven😁😁😁
struts应该没有新项目会使用这个框架了,基本上都是使用SpringMVC了。