I want to change context root from "/war_name" (by default) to "/".
Thus, I created a jboss-web.xml file that I pushed in WEB-INF directory.
Content of this file is :
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>/</context-root>
</jboss-web>
Unfortunately, this causes the following error during war deployment :
ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.web.deployment.default-host./: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1780) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [:1.7.0_01]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [:1.7.0_01]
at java.lang.Thread.run(Thread.java:722) [:1.7.0_01]
Caused by: java.lang.IllegalArgumentException: Child container with name already exists
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:804)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:792)
However, when I put some directory name like : /RoomManagement, I don't have this issue.
But if I use this one, I couldn't access to JSPs that aren't in /RoomManagement.
Have you an idea for well-configuring context-root to "/" ?
It looks like there is another app that's running at the root context "/".
You may have to delete the other app or move it to a different context before you can assign your app to the root context.
If 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>
Related
I am using websphere liberty with java 8 docker image but after trying everything. i am unable to load my own bundled libs instead of liberty built-in as per my assumption and from logs
My jsp and other libs are in WEB-INF/lib directory inside my war file
Here is the config I am using
<?xml version="1.0" encoding="UTF-8"?>
<server description="Default server">
<!-- Enable features -->
<featureManager>
<feature>javaee-8.0</feature>
<feature>microProfile-3.0</feature>
</featureManager>
<basicRegistry id="basic" realm="BasicRealm">
<!-- <user name="yourUserName" password="" /> -->
</basicRegistry>
<logging traceSpecification="com.ibm.ws.webcontainer*=all:com.ibm.wsspi.webcontainer*=all:HTTPChannel=all:GenericBNF=all:HTTPDispatcher=all"
traceFileName="trace.log"
maxFileSize="20"
maxFiles="10"
traceFormat="BASIC" />
<library id="OJDBC5Lib">
<fileset dir="/config/ojdbc5.jar" includes="ojdbc5.jar"/>
</library>
<!-- To allow access to this server from a remote client host="*" has been added to the following element -->
<httpEndpoint id="defaultHttpEndpoint"
host="*"
httpPort="9080"
httpsPort="9443" />
<webApplication id="e-app" name="e-app" location="/apps/e-app.war" contextRoot="/e-app">
<classloader delegation="parentLast" />
</webApplication>
When I run. the application I get an exception
[AUDIT ] CWWKF0011I: The defaultServer server is ready to run a smarter planet. The defaultServer server started in 14.831 seconds.
[ERROR ] SRVE0271E: Uncaught init() exception created by servlet [Faces Servlet] in application [e-app]: java.lang.IllegalStateException: Could not find ba
ckup for factory javax.faces.context.FacesContextFactory.
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1004)
at [internal classes]
[ERROR ] SRVE0276E: Error while initializing Servlet [Faces Servlet]: javax.servlet.ServletException: SRVE0207E: Uncaught initialization exception created by servlet
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:360)
at [internal classes]
Caused by: java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory.
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1004)
... 1 more
Can someone tell me what needs to be done in config to make it work
The problem here is that the javaee-8.0 feature includes the jsf-2.3 feature that includes the JSF APIs and Liberty's JSF implementation. In order to provide your own JSF implementation, you will need to remove the jsf-2.3 feature and use the jsfContainer-2.3 feature instead. This doc has more details: https://www.ibm.com/support/knowledgecenter/SSEQTP_liberty/com.ibm.websphere.wlp.doc/ae/twlp_jsf23_implementations.html
The javaee-8.0 feature includes a ton of features - many of which you may not need, but unfortunately you will need to specify all of the features that you do need (in addition to jsfContainer-2.3). So your server.xml's <featureManager> element might end up looking something like this:
<featureManager>
<!-- webprofile-8.0 features but using jsfContainer instead of jsf -->
<feature>appSecurity-3.0</feature>
<feature>beanValidation-2.0</feature>
<feature>cdi-2.0</feature>
<feature>ejbLite-3.2</feature>
<feature>el-3.0</feature>
<feature>jaspic-1.1</feature>
<feature>jaxrs-2.1</feature>
<feature>jdbc-4.2</feature>
<feature>jndi-1.0</feature>
<feature>jpa-2.2</feature>
<feature>jsfContainer-2.3</feature>
<feature>jsonb-1.0</feature>
<feature>jsonp-1.1</feature>
<feature>jsp-2.3</feature>
<feature>managedBeans-1.0</feature>
<feature>servlet-4.0</feature>
<feature>transaction-1.2</feature>
<feature>websocket-1.1</feature>
<!-- full profile 8 features not in web profile -->
<feature>appClientSupport-1.0</feature>
<feature>batch-1.0</feature>
<feature>concurrent-1.0</feature>
<feature>ejb-3.2</feature>
<feature>jacc-1.5</feature>
<feature>javaMail-1.6</feature>
<feature>javax.persistence.base-2.2</feature>
<feature>jaxws-2.2</feature>
<feature>jca-1.7</feature>
<feature>jcaInboundSecurity-1.0</feature>
<feature>jms-2.0</feature>
<feature>j2eeManagement-1.1</feature>
<feature>wasJmsClient-2.0</feature>
<feature>wasJmsSecurity-1.0</feature>
<feature>wasJmsServer-1.0</feature>
</featureManager>
It's a huge list, so you'll likely want to prune it a little (for example, remove all JMS-related feature if you are not using JMS). But once you swap jsf-2.3 for jsfContainer-2.3 then Liberty should find and use the JSF implementation in your app - and you shouldn't need to use parentLast delegation in your app either.
I'm migrating from JBoss 6.4.3 to JBoss 7.2 and saw a Valves are no longer supported warning during deployment. This came from a jboss-web.xml file with:
<valve>
<class-name>org.jboss.web.rewrite.RewriteValve</class-name>
</valve>
...and a corresponding rewrite.properties file:
RewriteCond %{HTTP:X-Forwarded-Proto} http
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
Could anyone advise how to rewrite this (no pun intended) for Undertow?
You can create a rewrite filter in the Undertow subsystem, and then reference it in the server host within the configuration file (standalone.xml or domain.xml - depending on the mode in which you start the application server).
I can think of two options, which might help you:
Using the JBoss Application Server Client (should be placed in path/to/jboss-7.2/bin/)
Creating the rewrite filter with the custom name redirect-http-to-https:
./jboss-cli.sh --connect --command="/subsystem=undertow/configuration=filter/rewrite=redirect-http-to-https:add(redirect=\"true\",target=\"https://%{LOCAL_SERVER_NAME}%{REQUEST_URL}\")"
Using/referencing the filter redirect-http-to-https:
./jboss-cli.sh --connect --command="/subsystem=undertow/server=default-server/host=default-host/filter-ref=redirect-http-to-https:add(predicate=\"equals(%p,80)\")"
Manually editing the respective config file (e.g. standalone.xml)
<subsystem xmlns="urn:jboss:domain:undertow:11.0" default-server="default-server" [...]>
<buffer-cache name="default"/>
<server name="default-server">
[...]
<host name="default-host" alias="localhost">
<filter-ref name="redirect-http-to-https" predicate="equals(%p,80)"/>
</host>
</server>
[...]
<filters>
<rewrite name="redirect-http-to-https" target="https://%{LOCAL_SERVER_NAME}%{REQUEST_URL}" redirect="true"/>
</filters>
</subsystem>
Note: For the Undertow exchange attributes (e.g. LOCAL_SERVER_NAME) refer to Undertow documentation. Further, the part predicate=\"equals(%p,80)\" in the filter-refchecks the requested port (%p -> just another Undertow exchange attribute) and if it equals to 80, then it triggers our redirect filter redirect-http-to-https - you can change the port 80 as per your need.
I have created zuul proxy application using spring boot and I am able to deploy it as a spring boot and war in Wildfly server by making some changes in pom and SpringApplication class file.
Structure of my ear :
MyEE.ear
|
|__gatewayzull.war
|_WEB-INF/lib/all jar for spring boot application
|
|__EJB.jar
|
|__XX.war
|
|lib/all jar (which also includes spring jars)
I have done some changes in pom.xml to deploy spring application war in WildFly server and It is working as expected.
When I tried to add gatewayzull.war in MyEE.ear and deploy it in Wildfly server, I am getting this exception
10:08:47,108 INFO [com.hummingbird.gateway.HbgatewayApplication] (MSC service thread 1-4) No active profile set, falling back to default profiles: default
10:08:47,119 INFO [org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext] (MSC service thread 1-4) Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#51640e39: startup date [Thu Jun 01 10:08:47 UTC 2017]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext#50b75933
....
....
....
....
10:08:56,635 WARN [org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext] (MSC service thread 1-4) Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration$TransactionManagementConfiguration]; nested exception is java.lang.IllegalArgumentException: class org.springframework.transaction.annotation.TransactionManagementConfigurationSelector is not assignable to interface org.springframework.context.annotation.ImportSelector
10:08:56,711 ERROR [org.springframework.boot.SpringApplication] (MSC service thread 1-4) Application startup failed: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration$TransactionManagementConfiguration]; nested exception is java.lang.IllegalArgumentException: class org.springframework.transaction.annotation.TransactionManagementConfigurationSelector is not assignable to interface org.springframework.context.annotation.ImportSelector
at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:546) [spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:286) [spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
.....
.....
.....
Caused by: java.lang.IllegalArgumentException: class org.springframework.transaction.annotation.TransactionManagementConfigurationSelector is not assignable to interface org.springframework.context.annotation.ImportSelector
at org.springframework.util.Assert.isAssignable(Assert.java:376) [spring-core-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.util.Assert.isAssignable(Assert.java:359) [spring-core-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:124) [spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:511) [spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
... 30 more
WildFly was trying to start Gatewayapplication but failed to start it.
jar inside gatewayzull.war.WEB-INF.lib not loaded.
deployment.MyEE.ear.lib also has spring related jar. I have added exclusion tag in jboss-deplyment-structure.xml inorder to exclude while loading but this also did not helps.
Snipper of jboss.xml :
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
..
..
<sub-deployment name="gateway.war">
<exclusions>
<module name="deployment.MyEE.ear.XX.war" />
<module name="deployment.MyEE.ear.EJB.jar" />
<module name="deployment.MyEE.ear.lib" />
<module name="javax.ws.rs.api" />
</exclusions>
<exclude-subsystems>
<subsystem name="jaxrs" />
</exclude-subsystems>
</sub-deployment>
</jboss-deployment-structure>
I am assuming that core issue would be due to application server not able to load jar inside war/web-inf/lib and in turn server not intializing SpringBootServeletIntializer.
Any idea to resolve this ?
I read in other topics, but I can't quite figure this out. I have an EJB module that uses log4j. I want to package that EJB into a JAR file and put in the WEB-INF/lib path of a web project. The web project has a servlet that executes a function from the EJB, and that's it. But seems that the appender doesn't work, for the file is created but not written.
I read that a deployment descriptor for JBoss, so I created one based on one of the previous posts. But i get a "Failed to process phase STRUCTURE of deployment" error.
12:04:44,905 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."SampleWeb.war".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."SampleWeb.war".STRUCTURE: Failed to process phase STRUCTURE of deployment "SampleWeb.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_21]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_21]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_21]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Sub deployment SampleEJB.jar in jboss-structure.xml was not found. Available sub deployments:
at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.subDeploymentNotFound(DeploymentStructureDescriptorParser.java:233) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.deploy(DeploymentStructureDescriptorParser.java:159) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
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
Here's the jboss-deployment-structure.xml I created. Because the web project only uses the EJB jar file I created I assumed that the deployment tag is not used.
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<sub-deployment name="SampleEJB.jar">
<exclusions>
<module name="org.apache.log4j"/>
<module name="org.slf4j" />
<module name="org.apache.commons.logging"/>
<module name="org.log4j"/>
<module name="org.jboss.logging"/>
</exclusions>
</sub-deployment>
</jboss-deployment-structure>
I'm using JBoss 7.1.1, by the way.
It seems like eclipse issue, may happen when dependant project of an ear not built properly.
In my case I was getting the same error with reason that ear was unable to find one included dependency jar.
Just check that dependent project and check it's target directory where maven creates jar after building the project. It would be empty if maven does not build that project properly.
Build that dependent project separately by "mvn install" and then try deploying ear on your server.
It worked for me.
org.jboss.as.server.deployment.DeploymentUnitProcessingException: Sub deployment SampleEJB.jar in jboss-structure.xml was not found.
It seems SampleEJB.jar is not deployed yet. Create deployment structure file to deploy components in order.
This question already has answers here:
Spring3.2 and jboss as 7
(4 answers)
Closed 9 years ago.
Since, Spring 3.2 GA release is out I wanted to upgrade my Spring 3.1.2 application to the newest release. The application runs on JBoss 7.1.1.Final. Everything else went fine except that I get the below JBoss error message which I find annoying (though the app runs ok). Any idea?
15:50:06,865 WARN [org.jboss.as.ee] (MSC service thread 1-13) JBAS011006: Not installing optional component org.springframework.web.context.request.async.StandardServletAsyncWebRequest due to exception: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011054: Could not find default constructor for class org.springframework.web.context.request.async.StandardServletAsyncWebRequest
at org.jboss.as.ee.component.ComponentDescription$DefaultComponentConfigurator.configure(ComponentDescription.java:606)
at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.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]
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.7.0_05]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_05]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_05]
In order to suppress this warning message add following lines to your Jboss config (standalone.xml if you're using it in standalone mode)
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns="urn:jboss:domain:1.1">
...
<profile>
<subsystem xmlns="urn:jboss:domain:logging:1.1">
<console-handler name="CONSOLE">
<level name="INFO"/>
<filter>
<not>
<match pattern="JBAS011006"/>
</not>
</filter>
...
As you can check in javadocs, there's no default constructor for this class.
Since it's just a warning and everything goes fine, you can ignore it.