Java 将在 JBoss 4.2 上运行良好的应用程序部署到 JBoss 5 时出错
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/530735/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error deploying an app to JBoss 5 that was working fine on JBoss 4.2
提问by
Im trying to deploy an application (.ear file) to JBoss 5, and I'm receiving the following error. The app deploys fine under 4.2.2.
我正在尝试将应用程序(.ear 文件)部署到 JBoss 5,但收到以下错误。该应用程序在 4.2.2 下部署良好。
15:31:33,172 ERROR [AbstractKernelController] Error installing to Real: name=vfszip:/C:/ASE/ext/jboss-5.0.0.GA/server/all/dep
loy/UGC-WS.ear state=PreReal mode=Manual requiredState=Real
org.jboss.deployers.spi.DeploymentException: Error during deploy: vfszip:/C:/ASE/ext/jboss-5.0.0.GA/server/all/deploy/UGC-WS.
ear/ugc-ws.war
at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:177)
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:1210)
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:1598)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
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:545)
at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:304)
at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:205)
at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:405)
at org.jboss.Main.boot(Main.java:209)
at org.jboss.Main.run(Main.java:547)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassCastException: org.jboss.metadata.ear.spec.JavaModuleMetaData
at org.jboss.wsf.container.jboss50.deployment.metadata.JSEArchiveMetaDataAdapter.buildMetaData(JSEArchiveMetaDataAdap
ter.java:76)
at org.jboss.wsf.container.jboss50.deployment.metadata.ContainerMetaDataAdapter.buildContainerMetaData(ContainerMetaD
ataAdapter.java:76)
at org.jboss.wsf.container.jboss50.deployment.metadata.ContainerMetaDataDeploymentAspect.create(ContainerMetaDataDepl
oymentAspect.java:51)
at org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl.create(DeploymentAspectManagerImpl.java:121)
at org.jboss.wsf.container.jboss50.BareWSFRuntime.create(BareWSFRuntime.java:61)
at org.jboss.wsf.container.jboss50.deployer.ArchiveDeployerHook.deploy(ArchiveDeployerHook.java:84)
at org.jboss.wsf.container.jboss50.deployer.AbstractDeployerHookEJB.deploy(AbstractDeployerHookEJB.java:43)
at org.jboss.wsf.container.jboss50.deployer.AbstractWebServiceDeployer.internalDeploy(AbstractWebServiceDeployer.java
:60)
at org.jboss.wsf.container.jboss50.deployer.WebServiceDeployerEJB.internalDeploy(WebServiceDeployerEJB.java:112)
at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
... 19 more
15:31:33,203 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS F
OR DETAILS):
*** CONTEXTS IN ERROR: Name -> Error
vfszip:/C:/ASE/ext/jboss-5.0.0.GA/server/all/deploy/UGC-WS.ear -> java.lang.ClassCastException: org.jboss.metadata.ear.spec.J
avaModuleMetaData
That's the error message from the console, and I can't figure out much from that...
那是来自控制台的错误消息,我无法从中弄清楚很多......
The application just contains web services and a servlet that loads on startup to initialize and cache some data.
该应用程序仅包含 Web 服务和一个在启动时加载以初始化和缓存一些数据的 servlet。
We have an EAR file which contains a few JAR files (one of them being named ugc-ws.jar) for libraries that we use, and also a WAR file which has the web.xml to load a servlet - this WAR file also has the same ugc-ws.jar in it's lib directory because the servlet is inside that JAR. So basically we have the main EAR file, and within it multiple jar files, as well as a WAR file - which also has a JAR file inside it's lib directory. And the error looks like it's coming from the WAR.
我们有一个 EAR 文件,其中包含我们使用的库的一些 JAR 文件(其中一个名为 ugc-ws.jar),还有一个 WAR 文件,其中包含用于加载 servlet 的 web.xml - 这个 WAR 文件也有相同的 ugc-ws.jar 在它的 lib 目录中,因为 servlet 在该 JAR 中。所以基本上我们有主 EAR 文件,其中有多个 jar 文件,以及一个 WAR 文件 - 在它的 lib 目录中还有一个 JAR 文件。错误看起来像是来自 WAR。
This is the output from "jar -tf ugc-ws.war":
这是“jar -tf ugc-ws.war”的输出:
>jar -tf ugc-ws.war
META-INF/
META-INF/MANIFEST.MF
WEB-INF/
WEB-INF/web.xml
WEB-INF/lib/
WEB-INF/jboss-web.xml
WEB-INF/lib/ugc-ws.jar
Just for testing, I remvoed the .WAR file from the .EAR and the application deploys without any errors, but obviously w/out the data from the WAR, i can't use the application. The way I'm deploying is just dropping the .EAR file into the server\all\deploy directory.
只是为了测试,我从 .EAR 中删除了 .WAR 文件,应用程序部署时没有任何错误,但显然没有 WAR 中的数据,我无法使用该应用程序。我部署的方式只是将 .EAR 文件放到 server\all\deploy 目录中。
I've tried splitting up the ugc-ws.jar into two separate jars, one with just the webservices and the other w/ just the servlet, but I still receive the same error.
我试过将 ugc-ws.jar 分成两个单独的 jar,一个只有 webservices,另一个只有 servlet,但我仍然收到相同的错误。
Just weird that this worked fine in JBoss 4 but not on JBoss 5.
奇怪的是,这在 JBoss 4 上运行良好,但在 JBoss 5 上却没有。
Thanks
谢谢
回答by kazanaki
It is not weird.
这并不奇怪。
JBoss 4.2 was NOT Java5EE compliant. JBoss 5.0 IS compliant.
JBoss 4.2 不符合 Java5EE。JBoss 5.0 是兼容的。
It seems to me that you have a problematic setting somewhere in your war. The error appears only in JBoss 5 since correctness is enforced in this version.
在我看来,你在战争中的某个地方有一个有问题的环境。该错误仅出现在 JBoss 5 中,因为此版本强制执行正确性。
Just a quick guess. Your jboss-web.xml might have the wrong dtd. Check this out.
只是一个快速的猜测。您的 jboss-web.xml 可能有错误的 dtd。 看看这个。
I also advise you to re-read JBoss documentation and especially the release notes for 5.0 and any migration tips they have for users of 4.2
我还建议您重新阅读 JBoss 文档,尤其是 5.0 的发行说明以及他们为 4.2 用户提供的任何迁移技巧