关闭

在JDK1.6+JBoss4.2.3环境下应用和部署 SSH2

849人阅读 评论(0) 收藏 举报
 环境:JDK1.6+JBoss4.2.3+Struts2.1.8+Spring2.5.6+Hibernate3.3.2

将war包解压至“JBOSS安装目录\server\default\deploy”目录下,文件夹改名为xxx.war,或者直接将war包拷贝到该目录。

启动JBoss,报了很多错误。主要错误摘要如下:

Copy code
Caused by: org.springframework.beans.factory.
BeanCreationException: Error creating bean with name 
'transactionManager' defined in class path resource 
[spring/applicationContext-hibernate.xml]: Cannot 
resolve reference to bean 'sessionFactory' while 
setting bean property 'sessionFactory'; nested 
exception is org.springframework.beans.factory.
BeanCreationException: Error creating bean with name 
'sessionFactory' defined in class path resource 
[spring/applicationContext-hibernate.xml]: Invocation 
of init method failed; nested exception is org.
hibernate.AnnotationException: java.lang.
NoSuchMethodException: org.hibernate.validator.
ClassValidator.(java.lang.Class, java.util.
ResourceBundle, org.hibernate.validator.MessageInterpolator, 
java.util.Map, org.hibernate.annotations.common.reflection.
ReflectionManager) 
at org.springframework.beans.factory.support.
BeanDefinitionValueResolver.
resolveReference(BeanDefinitionValueResolver.java:275) 
..................... 
Caused by: org.springframework.beans.factory.
BeanCreationException: Error creating bean with name 
'sessionFactory' defined in class path resource 
[spring/applicationContext-hibernate.xml]: 
Invocation of init method failed; nested exceptionis org.
hibernate.AnnotationException: java.lang.NoSuchMethodException:
org.hibernate.validator.ClassValidator.
(java.lang.Class, java.util.ResourceBundle,org.
hibernate.validator.MessageInterpolator, 
java.util.Map, org.hibernate.annotations.common.
reflection.ReflectionManager) 
at org.springframework.beans.factory.support.
AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338) 
..................... 
Caused by: org.hibernate.AnnotationException: 
java.lang.NoSuchMethodException: org.hibernate.
validator.ClassValidator.(java.lang.Class, 
java.util.ResourceBundle, org.hibernate.validator.
MessageInterpolator, java.util.Map, org.hibernate.
annotations.common.reflection.
ReflectionManager) 
at org.hibernate.cfg.AnnotationConfiguration.
secondPassCompile(AnnotationConfiguration.java:374) 
..................... 
Caused by: java.lang.NoSuchMethodException: org.
hibernate.validator.ClassValidator.(java.lang.
Class, java.util.ResourceBundle, org.hibernate.
validator.MessageInterpolator, java.util.Map, org.hibernate.annotations.common.reflection.
ReflectionManager) 
at java.lang.Class.getConstructor0(Class.
java:2706) 
at java.lang.Class.getDeclaredConstructor(Class.java:1985) 
at org.hibernate.cfg.AnnotationConfiguration.
secondPassCompile(AnnotationConfiguration.java:362) 
... 214 more

修改“JBOSS安装目录\server\default\deploy\jboss-web.deployer\META-INF”下的jboss-service.xml文件,改属性“UseJBossWebLoader”为true。

该属性原文解释如下:

A flag indicating if the JBoss Loader should be used. 
This loader uses a unified class loader as the class 
loader rather than the tomcat specific class loader. 
The default is false to ensure that wars have isolated 
class loading for duplicate jars and jsp files.

该配置表明是否使用JBoss自身的classloader来加载webApp相关的资源;因为JBoss是通过集成Tomcat来实现Web Container的,而两者都有自己独立的classloader;

若设置为true,则表示Web应用加载时都将使用JBoss统一的classloader,即此时采用共享的扁平的UnifiedClassLoader;

若设置为false,则表示Web应用采用自己独立的WebAppClassLoader进行加载,此时Web应用和JBoss之间是完全隔离的,这也是该配置项的默认值;

重新启动正常,无错误日志。

 

 

转自:http://tech.ccidnet.com/art/3539/20101222/2276237_1.html

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:716952次
    • 积分:7246
    • 等级:
    • 排名:第3172名
    • 原创:19篇
    • 转载:238篇
    • 译文:0篇
    • 评论:37条
    最新评论