Java – Error deploying an app to JBoss 5 that was working fine on JBoss 4.2


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.

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.
at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(
at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(
at org.jboss.deployers.plugins.deployers.DeployersImpl.install(
at org.jboss.dependency.plugins.AbstractControllerContext.install(
at org.jboss.dependency.plugins.AbstractController.install(
at org.jboss.dependency.plugins.AbstractController.incrementState(
at org.jboss.dependency.plugins.AbstractController.resolveContexts(
at org.jboss.dependency.plugins.AbstractController.resolveContexts(
at org.jboss.dependency.plugins.AbstractController.change(
at org.jboss.dependency.plugins.AbstractController.change(
at org.jboss.deployers.plugins.deployers.DeployersImpl.process(
at org.jboss.deployers.plugins.main.MainDeployerImpl.process(
at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(
at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(
at org.jboss.bootstrap.AbstractServerImpl.start(
at org.jboss.Main.boot(
at org.jboss.Main$
Caused by: java.lang.ClassCastException: org.jboss.metadata.ear.spec.JavaModuleMetaData
at org.jboss.wsf.container.jboss50.deployment.metadata.JSEArchiveMetaDataAdapter.buildMetaData(JSEArchiveMetaDataAdap
at org.jboss.wsf.container.jboss50.deployment.metadata.ContainerMetaDataAdapter.buildContainerMetaData(ContainerMetaD
at org.jboss.wsf.container.jboss50.deployment.metadata.ContainerMetaDataDeploymentAspect.create(ContainerMetaDataDepl
at org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl.create(
at org.jboss.wsf.container.jboss50.BareWSFRuntime.create(
at org.jboss.wsf.container.jboss50.deployer.ArchiveDeployerHook.deploy(
at org.jboss.wsf.container.jboss50.deployer.AbstractDeployerHookEJB.deploy(
at org.jboss.wsf.container.jboss50.deployer.AbstractWebServiceDeployer.internalDeploy(
at org.jboss.wsf.container.jboss50.deployer.WebServiceDeployerEJB.internalDeploy(
at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(
... 19 more
15:31:33,203 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS F

*** 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

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.

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.

This is the output from "jar -tf ugc-ws.war":

>jar -tf ugc-ws.war

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.

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.

Just weird that this worked fine in JBoss 4 but not on JBoss 5.


Best Solution

It is not weird.

JBoss 4.2 was NOT Java5EE compliant. JBoss 5.0 IS compliant.

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.

Just a quick guess. Your jboss-web.xml might have the wrong dtd. Check this out.

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

Related Question