tomcat 项目迁移到jboss5.1
1、拷贝tomcat\bin目录下两个jar到项目lib
目的:解决jboss java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory异常
2、persistence.xml文件增加空<non-jta-data-source></non-jta-data-source> ,如下
<persistence-unit name="appUnit" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<non-jta-data-source></non-jta-data-source>
</persistence-unit>
目的:解决Specification violation [EJB3 JPA 6.2.1.2] - You have not defined a non-jta-data-source for a RESOURCE_LOCAL异常
3、WEB-INF目录下增加jboss-web.xml文件,内容如下
<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 5.0//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
<jboss-web>
<class-loading java2ClassLoadingCompliance="true">
<loader-repository>
com.example:archive= unique-archive-name
<loader-repository-config>
java2ParentDelegation=true
</loader-repository-config>
</loader-repository>
</class-loading>
</jboss-web>
<class-loading java2ClassLoadingCompliance="true">
<loader-repository>
com.example:archive= unique-archive-name
<loader-repository-config>
java2ParentDelegation=true
</loader-repository-config>
</loader-repository>
</class-loading>
</jboss-web>
目
的:解决LifecycleException: Error initializaing :
javax.management.ReflectionException: Cannot find method addChild with
this signature问题,关于这个问题可能有很多原因,网上大部分说缺包或包冲突,这个问题最头痛,我是增加jboss-web.xml文件解决的。
4、增加jar
5、web.xml增加以下代码
<context-param>
<param-name>contextClass</param-name>
<param-value>org.jboss.spring.vfs.context.VFSXmlWebApplicationContext</param-value>
</context-param>
6、如果在其它的spring 配置文件(如applicationContext.xml等文件)中引用了xml 文件,如下
<import resource="quartz.xml"/>
则要将改为如下引入方式:
<import resource="classpath:quartz.xml"/>
<import resource="quartz.xml"/>
则要将改为如下引入方式:
<import resource="classpath:quartz.xml"/>
7、删除jboss/common/lib/hibernate-validator.jar
java.lang.NoSuchMethodError: org.hibernate.event.PreInsertEvent.getSource()Lorg/hibernate/engine/SessionImplementor;
8、
替换jboss/common/lib的以下几个jar,解决Caused by:
java.lang.IllegalArgumentException: Unknown entity:
com.gzbugu.dzz.domain.DzzClientAuthority异常
9、jboss5.0.1 [STDOUT] Hibernate: select max(id)异常
(来自:http://note.youdao.com/share/web/file.html?id=f5a4030796ffbdabf8aae3fc6dbfda8f&type=note)