Error deploying jar file on jboss-as-7.1.1 - java

I have the following situation:
I have a java application with three projects:
Java Project
EJB Module
Web Project
using net beans, I build the three projects and upload them on the server.
The Java Project deploy successfully but the EJB Module which depends on the Java Project gives the following error:
12:35:00,811 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."MyApp.jar".POST_MODULE: org.jboss.msc.service$
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.6.0_20]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.6.0_20]
at java.lang.Thread.run(Thread.java:636) [rt.jar:1.6.0_20]
Caused by: java.lang.RuntimeException: Error getting reflective information for class gss.myapp.sessions.CardValidatorBean with ClassLoader ModuleClassLoader for Module "deplo$
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:85)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:70)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:55)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more
Caused by: java.lang.NoClassDefFoundError: gss/commons/exceptions/BusinessEntityFindException
at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.6.0_20]
at java.lang.Class.privateGetDeclaredFields(Class.java:2308) [rt.jar:1.6.0_20]
at java.lang.Class.getDeclaredFields(Class.java:1760) [rt.jar:1.6.0_20]
at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 10 more
Caused by: java.lang.ClassNotFoundException: gss.commons.exceptions.BusinessEntityFindException from [Module "deployment.MyApp.jar:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
... 15 more

The exception clearly states that it could not find the class
gss.commons.exceptions.BusinessEntityFindException
Your ejb jar file MANIFEST.MF should contain the classpath it needs
e.g
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.1
Created-By: 1.6.0_25-b06 (Sun Microsystems Inc.)
Class-Path: your-java-project.jar
and make sure you include your your-java-project.jar in your server classpath.

You need add gss.commons.exceptions.BusinessEntityFindException class to JBoss:
I'll call YOUR_JAR.jar to the jar that contains gss/commons/exceptions/BusinessEntityFindException
1: Add a Module to JBoss
Stop your JBoss Server
Find YOUR_JAR.jar on your directory
Make the next directory on your JBoss: JBOSS_HOME/modules/org/gss/main
Put YOUR_JAR.jar on this directory
Make a file called module.xml and add:
<
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.gss">
<resources>
<resource-root path="YOUR_JAR.jar"/>
</resources>
</module>
*
2: Call your new module from your project:
On your web project make a file WEB-INF/jboss-deployment-structure.xml
add:
<
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.gss" meta-inf="export">
<imports>
<include path="META-INF" />
</imports>
</module>
</dependencies>
</deployment>
</jboss-deployment-structure>
start your Jboss Server

Related

ClassNotFoundException: java.net.http.HttpResponse in WF 18 / Java 11

In a JEE app deployed in Wildfly 18.0.1.Final with OpenJDK 64-Bit Server VM 11.0.15+9-LTS, I run into a ClassNotFoundException on java.net.http.HttpResponse (actually, one of the dependency is using it, and fails on java.net.http.HttpResponse$BodyHandler but I tried using java.net.http.HttpResponse directly in my code and ran into the same issue).
I tried to add the java.net.http module in WEB-INF/jboss-deployment-structure.xml in the WAR but it does not change a thing.
<jboss-deployment-structure>
<module name="deployment.java.net.http" />
</jboss-deployment-structure>
The stacktrace ends with:
Caused by: java.lang.NoClassDefFoundError: java/net/http/HttpResponse$BodyHandler at deployment.orbis-events-4u.war//io.apicurio.registry.rest.client.impl.RegistryClientImpl.<init>(RegistryClientImpl.java:67)
at deployment.orbis-events-4u.war//io.apicurio.registry.rest.client.impl.RegistryClientImpl.<init>(RegistryClientImpl.java:63)
at deployment.orbis-events-4u.war//io.apicurio.registry.rest.client.RegistryClientFactory.create(RegistryClientFactory.java:34)
at deployment.orbis-events-4u.war//io.apicurio.registry.serde.AbstractSchemaResolver.configure(AbstractSchemaResolver.java:84)
at deployment.orbis-events-4u.war//io.apicurio.registry.serde.DefaultSchemaResolver.configure(DefaultSchemaResolver.java:59)
at deployment.orbis-events-4u.war//io.apicurio.registry.serde.SchemaResolverConfigurer.configure(SchemaResolverConfigurer.java:75)
at deployment.orbis-events-4u.war//io.apicurio.registry.serde.AbstractKafkaSerDe.configure(AbstractKafkaSerDe.java:68)
at deployment.orbis-events-4u.war//io.apicurio.registry.serde.avro.AvroKafkaSerializer.configure(AvroKafkaSerializer.java:81)
at deployment.orbis-events-4u.war//org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:375)
... 62 more
Caused by: java.lang.ClassNotFoundException: java.net.http.HttpResponse$BodyHandler from [Module "deployment.orbis-events-4u.war" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
... 71 more
I'm very surprised that access to java.net.http module is not available out of the box.
Is there something I can do in the configuration of my app?
Is it a known WF issue?
The content of jboss-deployment-structure.xml I was using is incorrect.
Issue is solved with the following content:
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="java.net.http"/>
</dependencies>
</deployment>

Wildfly 9.0.2-Final ClassNotFoundException for Struts 1.x

While deploying app.war (Struts 1.x) on my Wildfly this information appears:
Cannot upload deployment: {"WFLYCTL0080: Failed services" =>
{"jboss.deployment.unit.\"app.war\".POST_MODULE" =>
"org.jboss.msc.service.StartException in service
jboss.deployment.unit.\"app.war\".POST_MODULE: WFLYSRV0153: Failed to
process phase POST_MODULE of deployment \"app.war\" Caused by:
java.lang.RuntimeException: WFLYSRV0177: Error getting reflective
information for class org.ajaxtags.tags.AjaxDisplayTag with
ClassLoader ModuleClassLoader for Module \"deployment.app.war:main\"
from Service Module Loader Caused by: java.lang.NoClassDefFoundError:
au/id/jericho/lib/html/Segment Caused by:
java.lang.ClassNotFoundException: au.id.jericho.lib.html.Segment from
[Module \"deployment.app.war:main\" from Service Module Loader]"}}
I have downloaded jericho-html-2.6.1-sources.jar and placed this as a module into ${wf-dir}\modules\system\layers\base\au\id\jericho\lib\html\main\ with an module.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="au.id.jericho.lib.html">
<resources>
<resource-root path="jericho-html-2.6.1-sources.jar"/>
</resources>
<dependencies>
</dependencies>
</module>
And there's still same issue...
Thanks for any help! :)
This was fixed by changing build system from Ant to Maven - looks like Wildfly has some problem while resolving directory conventions. On Glassfish 3.1.1 this worked with Ant

EAR built using build.gradle not deploying properly

I'm using build.gradle to build an EAR.
buildscript
{
repositories
{
mavenCentral();
maven{url "https://repository.jboss.org/nexus/content/repositories/releases/"}
}
configurations
{
compile
testCompile
testRuntime
jacoco
}
dependencies{classpath 'org.ajoberstar:gradle-jacoco:0.3.0'}
}
allprojects
{
group='com.sial.ecommerce'
version=''
repositories
{
mavenCentral();
maven{url"https://repository.jboss.org/nexus/content/repositories/releases/"}
}
apply plugin:'java'
apply plugin:'jacoco';
apply plugin: 'ear'
dependencies
{
deploy project(path:':app', configuration: 'archives');
deploy project(path:':firstEJB', configuration: 'archives');
}
ear
{
version = "";
archiveName ="XYZ.ear";
appDirName 'EarContent'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE;
caseSensitive = true;
rootSpec.exclude("**/activation-1.1.jar");
rootSpec.exclude("**/asm*.jar");
rootSpec.exclude("**/jboss-*.jar");
rootSpec.exclude("**/org.jacoco*.jar");
rootSpec.exclude("**/wildfly-*.jar");
rootSpec.exclude("**/hibernate-*.jar");
rootSpec.exclude("**/gradle-*.jar");
rootSpec.exclude("**/cdi-*.jar");
rootSpec.exclude("**/org.osgi.*.jar");
rootSpec.exclude("**/serializer-*.jar");
rootSpec.exclude("**/arquillian-*.jar");
rootSpec.exclude("**/resteasy-*.jar");
rootSpec.exclude("**/guava-*.jar");
rootSpec.exclude("**/jackson-jaxrs-*.jar");
rootSpec.exclude("**/jackson-core-asl-*.jar");
rootSpec.exclude("**/jackson-mapper-asl-*.jar");
rootSpec.exclude("**/reflections-*.jar");
rootSpec.exclude("**/metrics-core-*.jar");
rootSpec.exclude("**/servo-core-*.jar");
rootSpec.exclude("**/aspectjweaver-*.jar");
rootSpec.exclude("**/javax.json-*.jar");
rootSpec.exclude("**/jaxrs-api-*.jar");
rootSpec.exclude("**/javax.mail-*.jar");
rootSpec.exclude("**/validation-api-*.jar");
rootSpec.exclude("**/javassist-*.jar");
rootSpec.exclude("**/dom4j-*.jar");
rootSpec.exclude("**/annotations-*.jar");
rootSpec.exclude("**/javax.inject-*.jar");
rootSpec.exclude("**/xalan-*.jar");
rootSpec.exclude("**/el-api-*.jar");
rootSpec.exclude("**/jsr250-api-*.jar");
rootSpec.exclude("**/xml-apis-*.jar");
rootSpec.exclude("**/slf4j-api-1.7.6.jar");
}
}
Its built structure:
XYZ.ear
|
|------------- lib
|-------------META-INF
|--------------firstEJB.jar
|--------------app.war
When I try to deploy, classes in firstEJB.jar cannot be accesed.
I'm getting an error:
15:49:24,583 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC000001: Failed to start service jboss.deployment.subunit."XYZ.ear"."app.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."XYZ.ear"."app.war".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of subdeployment "app.war" of deployment "XYZ.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.0.Final.jar:1.2.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.0.Final.jar:1.2.0.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_71]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_71]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_71]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: java.lang.ClassNotFoundException: com.sial.ecommerce.core.init.DeepInit from [Module "deployment.XYZ.ear.app.war:main" from Service Module Loader]
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.checkDeclaredApplicationClassAsServlet(JaxrsScanningProcessor.java:292)
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.scanWebDeployment(JaxrsScanningProcessor.java:154)
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.deploy(JaxrsScanningProcessor.java:105)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.0.0.Final.jar:8.0.0.Final]
... 5 more
Caused by: java.lang.ClassNotFoundException: com.sial.ecommerce.core.init.DeepInit from [Module "deployment.XYZ.ear.app.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final]
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.checkDeclaredApplicationClassAsServlet(JaxrsScanningProcessor.java:290)
DeepInit class is in firstEJB.jar
When I started the Wildfly server in debug mode and tried to debug, I found that the directory looking for the class is different from the expected one.
It looks in :
C:/Apps/wildfly-8.0.0.Final/bin/content/XYZ.ear/lib
which is invalid.
Expected directory is :
C:/Apps/wildfly-8.0.0.Final/standalone/deployments/XYZ.ear
While doing deployment using exploded method(i.e. right clicking and adding the project in wildfly server) it works fine.
application.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_7.xsd" id="Application_ID" version="7">
<display-name>ABC</display-name>
<module>
<web>
<web-uri>app.war</web-uri>
<context-root>app</context-root>
</web>
</module>
<module><ejb>myfirstEJB.jar</ejb></module>
</application>
I wonder how "C:/Apps/wildfly-8.0.0.Final/bin/content/XYZ.ear/lib" is being used, since I'm not setting this anywhere.
Can someone please help me find a way to change the directory to
C:/Apps/wildfly-8.0.0.Final/standalone/deployments/XYZ.ear
so I can access classes in firstEJB.jar?

Java .war deployment issues on jboss-as-7.1.1.Final

I am working on a dynamic web project (StudentManagement.war) which relies on an EJB (StudentManagementEJB.jar) for database interfacing. The EJB project has been added to the web project's class path. On deployment, however, the following exceptions are thrown:
22:23:21,275 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."StudentManagement.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."StudentManagement.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "StudentManagement.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_45]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_45]
Caused by: java.lang.RuntimeException: Error getting reflective information for class student.management.ManageStudentServlet with ClassLoader ModuleClassLoader for Module "deployment.StudentManagement.war:main" from Service Module Loader
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:85)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:70)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:55)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more
Caused by: java.lang.NoClassDefFoundError: Lstudent/management/ManageStudentSessionBeanLocal;
at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.7.0_45]
at java.lang.Class.privateGetDeclaredFields(Unknown Source) [rt.jar:1.7.0_45]
at java.lang.Class.getDeclaredFields(Unknown Source) [rt.jar:1.7.0_45]
at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 10 more
Caused by: java.lang.ClassNotFoundException: student.management.ManageStudentSessionBeanLocal from [Module "deployment.StudentManagement.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
... 15 more
This shows that the web module cannot find classes defined within the bean. I've changed my default: %JBOSS_HOME%\standalone\deployments\StudentManagement.war\META-INF\MANIFEST.MF to:
Manifest-Version: 1.0
Class-Path: file:/C:/Utils/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final/standalone/deployments/StudentManagementEJB.jar
In spite of this the exception persists. There are two spaces between Class-Path: and the URI and a space after the end of the URI(../standalone) followed by a new line character.
Is there something wrong in my syntax?
I am using java ee 7, jboss-as-7.1.1.Final and Win 7 x64.
It turns out that the StudentManagementEJB.jar file is not copied into the /lib directory upon deployment. Aside from adding it to the Class-Path, it must also be copied to
%JBOSS_HOME%\standalone\deployments\<ProjectName>.war\WEB-INF\lib
directory(if the project is deployed as .war). In this case ProjectName is StudentManagement.
Do not reference to the deployments-folder (standalone/deployments). The deployed applications are not really deployed there, but copied from there to the data-directory, or they are not even in the deployments-folder, if you use other forms of deployment, e.g. jboss-cli.bat
There are some ways you can solve this.
1) Don't package the EJB separately, but include it into the WAR (the easiest).
2) Create an EAR and package the WAR and EJB-JAR together into the EAR (the classic).
3) Create a module from the interface-classes and reference from EJB.jar and WAR to the module. See e.g. "Dependencies:" in https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7
4) Reference in the WARs MANIFEST to the EJB-deployment like:
Dependencies:deployment.StudentManagementEJB.jar
From https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7:
Module names for top level deployments follow the format
deployment.myarchive.war while sub deployments are named like
deployment.myear.ear.mywar.war.
This means that it is possible for a deployment to import classes from
another deployment using the other deployments module name, the
details of how to add an explicit module dependency are explained
below.

Service jboss.web.deployment.default-host./.realm is already registered

I'm trying to deploy three different ear files to the same Jboss server...
One of them doesn't have a context root, and the other two have it, but it's different. I mean, let's take the three ears as one.ear, two.ear and three.ear:
one.ear has:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>/</context-root>
</jboss-web>
two.ear has:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>/two</context-root>
</jboss-web>
three.ear has none.
When I try to star Jboss (7 AS), I got this:
16:01:31,962 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.deployment.subunit."one-ear.ear"."one.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."one-ear.ear"."one.war".INSTALL: Failed to process phase INSTALL of subdeployment "one.war" of deployment "one-ear.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [rt.jar:1.6.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.6.0_45]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.6.0_45]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS018027: Failed to add JBoss Web deployment service
at org.jboss.as.web.deployment.WarDeploymentProcessor.processDeployment(WarDeploymentProcessor.java:320)
at org.jboss.as.web.deployment.WarDeploymentProcessor.deploy(WarDeploymentProcessor.java:114)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more
Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.web.deployment.default-host./.realm is already registered
at org.jboss.msc.service.ServiceRegistrationImpl.setInstance(ServiceRegistrationImpl.java:154) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl.startInstallation(ServiceControllerImpl.java:227) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceContainerImpl.install(ServiceContainerImpl.java:560) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:201) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2228) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:201) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2228) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceBuilderImpl.install(ServiceBuilderImpl.java:307) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.as.web.deployment.WarDeploymentProcessor.processDeployment(WarDeploymentProcessor.java:269)
... 7 more
I have read that this error could be thrown when two apps in the same server have the same context root, but this is not the case... what is happening?
Generally the containers such as Jboss have a context root of
<context-root>/</context-root>
to intercept all the incoming requests and pass on to the application server. In your I suspect the conflicting app is JBoss AppServer root itself, you can disable that using the following (enable-welcome-root="false")
<subsystem xmlns="urn:jboss:domain:web:1.0">
<connector name="http" protocol="HTTP/1.1" socket-binding="http" scheme="http"/>
<virtual-server name="localhost" enable-welcome-root="false">
<alias name="example.com"/>
</virtual-server>
</subsystem>
Try to remove .war archive from web server, then deploy again. You can do this through jboss management console. It also could be that you have deployed another application with same value of <context-root> element in jboss-web.xml.
Check which --server-config file is used to start the server. In my case that was standalone-ha.xml instead of the expected standalone.xml.
As of to me, restarting the JBoss Server was enough.
No idea why.
this solved my problem - go to your standalone.xml - the one which is being reffered by JBoss
In the standalone.xml - you will find the deployment section
<deployments>
<deployment name="YOUR_APP.ear" runtime-name="YOUR_APP-version-SNAPSHOT.ear">
<fs-archive path="C:\YOUR_APP-version-SNAPSHOT.ear"/>
</deployment>
</deployments>
if you are trying to deploy the newer versions or different version of your ear - the it will give such error.
Remove this part from the deployments section and keep it empty
<deployments>
<!-- remove the deployment from here -->
</deployments>
then just restart your server - it will deploy the YOUR_APP.ear again
and now it will show it with - NEW version
<deployments>
<deployment name="YOUR_APP.ear" runtime-name="YOUR_APP-NEW_version-SNAPSHOT.ear">
<fs-archive path="C:\YOUR_APP-_NEW_version-SNAPSHOT.ear"/>
</deployment>
</deployments>

Categories

Resources