Jboss 启动问题

1.web.xml元素先后顺序

  我的Jboss是5.1GA, Error Message:

AXException: The content of element type "web-app" must match "(icon?,display-na
me?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*
,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,erro
r-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-confi
g?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)". @ vfsfile:/D:/jboss-5.0.
0/server/default/deploy/myapp.war/WEB-INF/web.xml[28,11]

answer:

tomcat對web.xml的元素順序不作校驗,但jboss严格校验各元素的先后順序,只有元素順序正確,才可能部署成功。以下是web.xml的元素順序:

web.xml的元素順序:

 icon?,
display-name?,
description?,
distributable?,
context-param*,
filter*,
filter-mapping*,
listener*,
servlet*,
servlet-mapping*,
session-config?,
mime-mapping*,
welcome-file-list?,
error-page*,
taglib*,
resource-env-ref*,
resource-ref*,
security-constraint*,
login-config?,security-role*,
env-entry*,
ejb-ref*,
ejb-local-ref* 

2.jboss 5 报错:Failed to create a new SAX parser

一个项目,在TOMCAT下运行正常,但移植到JBOSS5下就报错:
10:45:52,109 ERROR [JBossContextConfig] XML error parsing: context.xml
org.jboss.xb.binding.JBossXBRuntimeException: Failed to create a new SAX parser
at org.jboss.xb.binding.UnmarshallerFactory$UnmarshallerFactoryImpl.newUnmarshaller(UnmarshallerFactory.java:100)
at org.jboss.web.tomcat.service.deployers.JBossContextConfig.processContextConfig(JBossContextConfig.java:549)
at org.jboss.web.tomcat.service.deployers.JBossContextConfig.init(JBossContextConfig.java:536)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:279)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.StandardContext.init(StandardContext.java:5436)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4148)
at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:310)
at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)
at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
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:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
at $Proxy38.start(Unknown Source)
at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
at org.jboss.dependency.plugins.act ion.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
at org.jboss.dependency.plugins.act ion.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
at org.jboss.system.ServiceController.start(ServiceController.java:460)
at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:361)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
at org.jboss.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306)
at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271)
at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
at org.jboss.Main.boot(Main.java:221)
at org.jboss.Main$1.run(Main.java:556)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.jboss.xb.binding.JBossXBException: Failed to create a new SAX parser
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.<init>(SaxJBossXBParser.java:97)
at org.jboss.xb.binding.UnmarshallerImpl.<init>(UnmarshallerImpl.java:56)
at org.jboss.xb.binding.UnmarshallerFactory$UnmarshallerFactoryImpl.newUnmarshaller(UnmarshallerFactory.java:96)
... 73 more
Caused by: java.lang.ClassCastException: org.apache.xerces.parsers.XML11Configuration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.<init>(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source)
at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown Source)
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.<init>(SaxJBossXBParser.java:92)
... 75 more



很奇怪,经过千辛万苦的查找原因,最终把它解决了。
解决办法:删掉项目中的 xerces-2.6.2.jar和xml-apis.jar两个文件!(我的是XerceImpl....jar, xml-api...jar, 删除, 就不会提示ClassCastException).


3. teiid驱动包, 和数据源配置.

驱动包, 放在server下的lib中就ok. 如teiid, oracle...

数据源放在和war包相同的包下.


============================================================================================================

下面是网上摘的, 共参考:

   Jboss从4到5的版本的变化是比较大的,主要是它对包的冲突限制非常严格,在4版本中基本上不是非常严格,如果有包冲突,会自动选择,但在5中回出非常多的转换异常错误,导致项目无法发布,或是发布完成后无法访问,现把这次升级中遇到的错误及解决办法记录如下.

1 The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory

 

将工程路径下的WebRoot下的WEB-INF下的lib里的jsp-api-2.0.jar,servlet-api-2.4.jar删除就OK 了,应该是工程里自带的这两个文件和TOMCAT里的文件冲突导致的ok!

2 org.jboss.util.NestedSQLException: Could not create connection; - nested throwable: (java.lang.NullPointerException); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.lang.NullPointerException))
这个是由于配置了数据库的连接池,但是lib中没有相应的连接数据库的驱动,无法产生连接.

 3

1,Jboss 在启动时报Failed to create a new SAX parser 错误。

2,Jboss 在启动时报(java.lang.ClassNotFoundException:   JACC:Error   PolicyConfigurationFactory   :   cannot   find   class   :   null)   

 

解决方案

1,删除 xerces*.jar 和xml-apis*.jar,解决XML 解析器实现冲突。

2,删除jaas.jar and jcr*.jar,解决jaas 实现冲突。

 

4

java.lang.ClassCastException: gnu.xml.aelfred2.JAXPFactory cannot be cast to javax.xml.parsers.SAXParserFactory

原因为:

   项目中的gnujaxp.jar和服务器上的java xml解析器冲突.

 

5

Getting java.lang.ClassCastException: org.apache.catalina.connector.RequestFacade cannot be cast to javax.servlet.http.HttpServletRequest

这个是由于项目中包含的Servlet.jar和服务器上的jar发生了冲突.

 

6 JBoss是自带Hibernate的绝大多数库文件的,所以IDE引入的Hibernate相关库绝对不能随着项目打包,做法同上,把“package”的勾选去掉即可。我曾被这个问题困扰,因为将Hibernate打进war包的结果就是JBoss将在程序运行的时候报出下面的错误信息:

org.jboss.resource.adapter.jdbc.WrapperDataSource cannot be cast to javax.sql.DataSource

这个问题非常的搞,即使把hibernate等的包都搞掉可能还会出问题,我在这边被搞了好久,还好解决了,

总结一下

1 可能是hibernate包冲突问题.

2 可能是项目中的数据库驱动和服务器上数据库驱动重复,导致冲突

3 这个很隐蔽,可能有的包中含有Javax.sql.DataSource,也会冲突,我查到的就有一个,class12.jar

 

总之来说Jboss5是一个很让人头疼的版本.


©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页