How do I undeploy all artifacts from WildFly? - java

I am developing a web application and deploying (with IntelliJ) to WildFly 10.1. I recently renamed my webapp module, which results in renaming my war file from foo.war to bar.war. Every time I start up, I get this error:
12:24:15,899 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.deployment.unit."foo_war_exploded.war".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."foo_war_exploded.war".STRUCTURE: WFLYSRV0153: Failed to process phase STRUCTURE of deployment "foo_war_exploded.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYSRV0160: Failed to mount deployment content
at org.jboss.as.server.deployment.module.DeploymentRootMountProcessor.deploy(DeploymentRootMountProcessor.java:95)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
... 5 more
Caused by: java.io.FileNotFoundException: /.../foo_war_exploded (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at org.jboss.vfs.spi.RootFileSystem.openInputStream(RootFileSystem.java:51)
at org.jboss.vfs.VirtualFile.openStream(VirtualFile.java:318)
at org.jboss.vfs.VFS.mountZipExpanded(VFS.java:533)
at org.jboss.as.server.deployment.DeploymentMountProvider$Factory$ServerDeploymentRepositoryImpl.mountDeploymentContent(DeploymentMountProvider.java:108)
at org.jboss.as.server.deployment.module.DeploymentRootMountProcessor.deploy(DeploymentRootMountProcessor.java:91)
... 6 more
...
[2017-04-23 12:24:18,957] Artifact bar:war exploded: Artifact is deployed successfully
Notice that deploying (and undeploying) the renamed war works fine. I just can't undeploy the leftover of the old war.
How do I undeploy all artifacts from WildFly to make a fresh start?

You have multiple options here:
via Maven:
add the wildfly plugin parameters matchPattern and matchPatternStrategy to your pom.xml in the section <project><build><plugins>:
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<configuration>
<!-- use regular expressions here -->
<matchPattern>(foo|bar).war</matchPattern>
<matchPatternStrategy>all</matchPatternStrategy>
</configuration>
</plugin>
(unfortunately there are no predefined corresponding CLI properties)
and run from a console
mvn wildfly:undeploy -Dwildfly.hostname=XXX -Dwildfly.port=9993 -Dwildfly.username=XXX -Dwildfly.password=XXX -Dwildfly.protocol=https-remoting
(or setup an equivalent run configuration in your IDE)
via WildFly Command Line Interface (CLI):
run jboss-cli -c controller=https-remoting://XXX:9993 -u=XXX
type in your password and then
undeploy (discover artifacts by pressing TAB)
via WildFly Web Management Interface:
visit e.g. https://XXX:9993/console/App.html#standalone-deployments
select the artifact and choose 'Remove' from the dropdown menu

I have logged in through wildfly web console panel (http://127.0.0.1:9990/console/index.html) and then removed old deployed SNAPSHOT from deployment tab, then Re-run my wildfly server from Intellij again and now it is works for me. When i re-run my wildfly server from intellij, it it deployed new SNAPSHOT to the server, so it is working fine and problem is solved for me.

Related

I cannot deploy a war file to the wildfly 10

I am currently learning the Java EE and wanted to follow a tutorial, who uses cargo tracker as an example.
I could import the maven project to the eclipse successfully and can build it with mvn clean install successfully.
At the end of the day, there is a war file in the target folder of the project but wildfly 10 could not start it.
In the readme of the project, I have read such a sentence and would like to issue it;
mvn -Pwildfly package cargo:run
however, in this case, maven gives the following error;
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.14:run (default-cli) on project cargo-tracker: Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.14:run failed: Failed to create a GlassFish 4.x standalone configuration: GlassFish admin command with args (--interactive=false --user admin --passwordfile /home/laptop/Schreibtisch/cargo-tracker-ee-master/target/cargo/configurations/glassfish4x/password.properties create-domain --adminport 4848 --instanceport 8080 --domainproperties jms.port=7676:orb.listener.port=3700:orb.ssl.port=3820:http.ssl.port=8181:orb.mutualauth.port=3920:domain.jmxPort=8686:java.debugger.port=9009:osgi.shell.telnet.port=6666
--domaindir /home/laptop/Schreibtisch/cargo-tracker-ee-master/target/cargo/configurations/glassfish4x cargo-domain) failed: asadmin exited 1 -> [Help 1]
If you need more info, I can supply.
Edit
When I deploy the war file manually as K5 mentioned in this comment, I get the following error from wildfly;
19:18:36,042 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."cargo-tracker.war".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."cargo-tracker.war".PARSE: WFLYSRV0153: Failed to process phase PARSE of deployment "cargo-tracker.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.msc.service.ServiceNotFoundException: Service service jboss.ejb.default-resource-adapter-name-service not found
at org.jboss.msc.service.ServiceContainerImpl.getRequiredService(ServiceContainerImpl.java:669)
at org.jboss.as.ejb3.deployment.processors.MessageDrivenComponentDescriptionFactory.getDefaultResourceAdapterName(MessageDrivenComponentDescriptionFactory.java:274)
at org.jboss.as.ejb3.deployment.processors.MessageDrivenComponentDescriptionFactory.processMessageBeans(MessageDrivenComponentDescriptionFactory.java:154)
at org.jboss.as.ejb3.deployment.processors.MessageDrivenComponentDescriptionFactory.processAnnotations(MessageDrivenComponentDescriptionFactory.java:81)
at org.jboss.as.ejb3.deployment.processors.AnnotatedEJBComponentDescriptionDeploymentUnitProcessor.processAnnotations(AnnotatedEJBComponentDescriptionDeploymentUnitProcessor.java:57)
at org.jboss.as.ejb3.deployment.processors.AbstractDeploymentUnitProcessor.deploy(AbstractDeploymentUnitProcessor.java:76)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
... 5 more
19:18:36,050 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "cargo-tracker.war")]) - failure description: {
"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"cargo-tracker.war\".PARSE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"cargo-tracker.war\".PARSE: WFLYSRV0153: Failed to process phase PARSE of deployment \"cargo-tracker.war\"
Caused by: org.jboss.msc.service.ServiceNotFoundException: Service service jboss.ejb.default-resource-adapter-name-service not found"},
"WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"cargo-tracker.war\".PARSE"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined
}
19:18:36,080 INFO [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "cargo-tracker.war" (runtime-name : "cargo-tracker.war")
19:18:36,083 INFO [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0186: Services which failed to start: service jboss.deployment.unit."cargo-tracker.war".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."cargo-tracker.war".PARSE: WFLYSRV0153: Failed to process phase PARSE of deployment "cargo-tracker.war"
On the download page of the wildfly, there are several download options. It is possible that you have downloaded a version, which does not have the needed service for your application. In order to find if the problem is because of your wildfly version, download the Java EE7 Full & Web Distribution and see if something will change.
add dependency :
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.12.1.1</version>
<scope>test</scope>
</dependency>
update maven project and built it and recreate the jar file and try to deploy.

Maven EAR dependency structure

I'm trying to deploy an EAR to Wildfly 10 via Eclipse Neon with the latest JBoss Tools. This is my first attempt with EARs, so I documented myself and this is the structure I came up with:
Maven modules:
api (type jar, no deps): contains the interfaces MyService and Person.
ejb (type ejb, depends on api): contains a #Stateless implementation of MyService and an #Entity implementation of Person.
war (type war, depends on api): contains a JAX-RS resource which uses MyService.
ear (type ear, depends on ejb and war): the EAR module.
(See here for the full source: https://github.com/heruan/maven-ear-example)
The problem is when I deploy this to Wildfly, I get:
java.lang.NoClassDefFoundError: Failed to link ejb/MyServiceImpl: api/MyService
Full stack trace:
INFO [org.jboss.weld.deployer] (MSC service thread 1-6) WFLYWELD0003: Processing weld deployment ear-1.0.0.ear
WARN [org.jboss.modules] (MSC service thread 1-6) Failed to define class ejb.MyServiceImpl in Module "deployment.ear-1.0.0.ear.ejb-1.0.0.jar:main" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link ejb/MyServiceImpl (Module "deployment.ear-1.0.0.ear.ejb-1.0.0.jar:main" from Service Module Loader): api/MyService
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.__newInstance(DelegatingConstructorAccessorImpl.java:45)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)
at org.jboss.modules.Module.loadModuleClass(Module.java:606)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.jboss.as.ee.utils.ClassLoadingUtils.loadClass(ClassLoadingUtils.java:21)
at org.jboss.as.ee.utils.ClassLoadingUtils.loadClass(ClassLoadingUtils.java:14)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:84)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:76)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
What am I missing? My goal is to have the most basic EAR with a common JPA Persistence Unit shared by its modules.
I found out what the problem was: duplicate .class files. Seems like the Maven EAR plugin isn't clever enough to avoid duplicate dependencies, so you need to explicitly set them as provided.
For example, the solution in the example project is to set the api module as provided in the war's pom.xml:
<dependency>
<groupId>com.example</groupId>
<artifactId>api</artifactId>
<version>1.0.0</version>
<scope>provided</scope>
</dependency>

Spring Boot - Convert Jar Packaging to War Packaging

I'm working on a web application build with the Spring Boot-Framework... Comming to end, I wanted to start my application from terminal with
java -jar application.jar
Then I identify that jar-files can not handle JSP-Files. With this mind I edited my POM-file from Maven like this here:
<project>
....
<groupId>com.test.test</groupId>
<artifactId>Application</artifactId>
<version>0.1.0</version>
<packaging>war</packaging>
....
</project>
When building the application this error-statement is shown:
------------------------------------------------------------------------ Building Testbackend 0.1.0
------------------------------------------------------------------------ Downloading:
file://C://mod_repository/org/apache/maven/plugins/maven-war-plugin/2.6/maven-war-plugin-2.6.pom
Exception in thread "pool-1-thread-1" java.lang.NoClassDefFoundError:
org/apache/commons/lang/StringUtils at
org.apache.maven.wagon.providers.file.FileWagon.resolveDestinationPath(FileWagon.java:206)
at
org.apache.maven.wagon.providers.file.FileWagon.resourceExists(FileWagon.java:265)
at
org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:577)
at
org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745) Caused by:
java.lang.ClassNotFoundException: org.apache.commons.lang.StringUtils
at
org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at
org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at
org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
... 7 more
Do someone know this error-statement in combination with war-files?
I don't have enough points to comment but here's a resource that I think will help: https://spring.io/guides/gs/convert-jar-to-war/
Select the "Packaging executable jar and war files with Maven" link. I hope this points you in the right direction.
I did something like this for a personal project. You need to do some changes:
Add some dependencies to pom:
groupId: org.springframework.boot
artifactId: spring-boot-starter-web
groupId: javax.servlet
artifactId: jstl
Change the package jar to war: <packaging>war</packaging>
Extend from SpringBootServletInitializer your 'SpringBootWebApplication' class.
Create the following folders structure to add the *.jsp files : src/main/webapp/WEB-INF/jsp/
In /src/main/resources/static/ folder you can add the *.css files.
In application.properties file add the following:
spring.mvc.view.prefix: /WEB-INF/jsp/
spring.mvc.view.suffix: .jsp
I used the following references:
Spring Boot example JSP
Convert JAR to WAR

Grails Application doesn't deploy in tomcat

I have my grails app converted to maven project. In my pom.xml I have the below dependency
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.2.1.RELEASE</version>
</dependency>
My application starts with grails run-app but when I build war through maven compile install , deployment fails in tomcat with below error
ERROR context.GrailsContextLoaderListener - Error initializing Grails: class org.springframework.core.LocalVariableTableParameterNameDiscoverer$ParameterNameDiscoveringVisitor has interface org.springframework.asm.ClassVisitor as super class
java.lang.IncompatibleClassChangeError: class org.springframework.core.LocalVariableTableParameterNameDiscoverer$ParameterNameDiscoveringVisitor has interface org.springframework.asm.ClassVisitor as super class
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
If your app runs with run-app, you should be able to build with grails war and deploy that way instead of using Maven.
https://grails.github.io/grails-doc/latest/ref/Command%20Line/war.html
By default the war command creates a web application archive (WAR) file using the application name and version number. The war command is different from most commands since it runs in the production environment by default instead of development, but like any script the environment can be specified using the standard convention:

A component named 'XXX' is already defined in this module in JBoss 7.1.1

I did not create the spring bean name with TimerServiceDispatcher in my application. But, the JBoss throw exception because of TimerServiceDispatcher is already defined in this module.
I don't know what is the problem. What I am missing? What I need to do?
My application use Seam 2.3, Spring 3.0 and JPA 2.0. I don't use EJB.
11:29:01,531 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "MRBS.war"
11:29:04,217 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.deployment.unit."MRBS.war".PARSE: org.jboss.msc.service.StartExcept
ion in service jboss.deployment.unit."MRBS.war".PARSE: Failed to process phase PARSE of deployment "MRBS.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$Worker.runTask(Unknown Source) [rt.jar:1.6.0_23]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.6.0_23]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.6.0_23]
Caused by: java.lang.IllegalArgumentException: JBAS011046: A component named 'TimerServiceDispatcher' is already defined in this module
at org.jboss.as.ee.component.EEModuleDescription.addComponent(EEModuleDescription.java:137)
at org.jboss.as.ejb3.deployment.processors.EJBComponentDescriptionFactory.addComponent(EJBComponentDescriptionFactory.java:60)
at org.jboss.as.ejb3.deployment.processors.SessionBeanComponentDescriptionFactory.processSessionBeans(SessionBeanComponentDescriptionFactory.java:157)
at org.jboss.as.ejb3.deployment.processors.SessionBeanComponentDescriptionFactory.processAnnotations(SessionBeanComponentDescriptionFactory.java:86)
at org.jboss.as.ejb3.deployment.processors.AnnotatedEJBComponentDescriptionDeploymentUnitProcessor.processAnnotations(AnnotatedEJBComponentDescriptionDeploymentUnitProcessor.java:
58)
at org.jboss.as.ejb3.deployment.processors.AbstractDeploymentUnitProcessor.deploy(AbstractDeploymentUnitProcessor.java:81)
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
11:29:04,230 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "MRBS.war" was rolled back with failure message {"JBAS014671: Failed servi
ces" => {"jboss.deployment.unit.\"MRBS.war\".PARSE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"MRBS.war\".PARSE: Failed to process phase PARSE of d
eployment \"MRBS.war\""}}
11:29:04,292 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015877: Stopped deployment MRBS.war in 61ms
11:29:04,294 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.deployment.unit."MRBS.war".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."MRBS.war".
PARSE: Failed to process phase PARSE of deployment "MRBS.war"
jboss-deployment-structure.xml
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<deployment>
<dependencies>
<module name="org.hibernate" export="true"/>
<module name="javax.faces.api" export="true" />
<module name="com.sun.jsf-impl" export="true"/>
<module name="org.dom4j" export="true"/>
<module name="org.hibernate.validator" export="true"/>
</dependencies>
<exclusions>
<module name="org.apache.log4j" />
</exclusions>
</deployment>
</jboss-deployment-structure>
Deplyment Structure
MRBS.war
-index.html
+web-page-pakage
+META-INF
+WEB-INF
+classes
+lib
aopalliance.jar
commons-beanutils.jar
commons-codec.jar
commons-lang-2.5.jar
drools-compiler.jar
drools-core.jar
drools-decisiontables.jar
drools-templates.jar
eclipselink.jar
el-api.jar
guava.jar
guice.jar
hibernate-ehcache.jar
httpclient.jar
httpcore.jar
javax.persistence_2.0.1.v201006031150.jar
jboss-el.jar
jboss-seam-debug.jar
jboss-seam-excel.jar
jboss-seam-ioc.jar
jboss-seam-mail.jar
jboss-seam-pdf.jar
jboss-seam-ui.jar
jboss-seam.jar
junit-4.8.1.jar
log4j-1.2.14.jar
mysql-connector-java-5.1.6-bin.jar
primefaces-3.3.1.jar
sac.jar
spring-aop.jar
spring-asm.jar
spring-beans.jar
spring-context.jar
spring-core.jar
spring-expression.jar
spring-jdbc.jar
spring-orm.jar
spring-tx.jar
spring-web.jar
urlrewritefilter.jar
xercesImpl.jar
xml-apis.jar
-components.xml
-faces-config.xml
-jboss-deployment-structure.xml
-pages.xml
-web.xml
I had a bean annotated with #Singleton and #Stateless that triggered this error. My code was of course wrong but the message and posts like this lead me down the wrong path for a while.
I know the answer to this one. Spent weeks with JBoss Support on it due to my stubborness. They plan on providing fix or at least better messaging with EAP 6.2.x release.
The problem arises with the EJB Annotation preprocessors - which take your war, and the libs compiled into it and scans them for EJB annotations. Some Jar files can have an entry in the Manifest for "Classpath: ." (or whatever but with '.' as one of the entries). This causes the annotation preprocessor to idiotically process all the jar files in the web-inf lib again. Finally it will get around to a jar file with an EJB annotation in it that it has already seen, because it was already processed earlier - this causes it to complain with "A component Named xxx is already defined".
So the most frustrating part here is that it's probably some old jar file that you don't even care about that has this unnecessary Classpath manifest entry in it - and causes JBoss to recurse on itself.
I had the same problem but for me none of the suggested solutions helped.
I noticed that the EJB JAR was present twice (newest version and older version) in the WEB.WAR.
This was because the maven clean operation on the parent project in eclipse didn't cascade to the child projects.
I fixed it by doing a simple "mvn clean" on the child project.
I had the same problem in IntelliJ. The reason was that IntelliJ created a WAR file with my classes both in WEB-INF/classes AND as a separate Jar file in WEB-INF/lib.
It took me some time to find out why IntelliJ did this.
The reason lay in the dialogue File -> Project Structure -> Artifacts:
After removing the 'vertrag-ui-war' compile output, the error did not occur anymore.
P.S. I have no idea why IntelliJ made this setting - I definitively did not set this.
Running the Maven goals:
wildfly:undeploy
clean
wildfly:deploy
helped in our case:
[ERROR] Caused by: java.lang.IllegalArgumentException: WFLYEE0040: A component named 'xxx' is already defined in this module"}}
Removing #Singleton fixed this error for me. No idea why though.
The problem is not that you dint create TimeServiceDispatcher it is a class part of seam framework org.jboss.seam.async.TimerServiceDispatcher , its a seam fw class.
Now about the error.
These kind of error occur when there are conflicts in libraries provided with application and by server. Its seriously very common with JBoss 7.1 and very frustrating as well.
You need to know
What all Libraries and there version are u packaging inside your application ?
what all of above libraries and version are provided by JBoss 7.1
Now for libraries that are on both side
check for version
if version of application and JBoss is same , then remove that jar from Application (suggested) (else you can configure in the deployment-structure.xml which one to use)
if version of application jar and jboss is different, in that case , you will need to configure in deployment descriptor which one to pick.
While copy pasting and creating new components, I forgot to update the value that the #Stateless(value) annotation accept in the new components. This meant I had two components with the same name and I got this error. Hope it helps someone.
It can be caused by a previous version of the jar being deployed instead of the correct one. It was solved when I deleted all the contents of the target folder.
The answers helped me locate the root cause of my issue.
I am using Arquillian and I was adding to the Web archive a class through the
JavaArchive ja = ShrinkWrap.create(JavaArchive.class, "myejb.jar")
.addPackages(true, "a.package.name")
and as a maven dependency
File[] files = Maven.resolver()
.addDependencies(
MavenDependencies.createDependency("G:A:V", ScopeType.COMPILE, false),
Hence the previously described error.
I left only the maven dependency and the error disappeared.

Categories

Resources