Thursday, February 14, 2013

Setting context-root of a web application in JBOSS

Modify jboss-web.xml file under WEB-INF directory of your application


<jboss-web>
<context-root>/</context-root>
</jboss-web>


Remove or rename ROOT.war application from
server/default/deploy/jboss-web.deployer directory

run application by giving http://<IP>:<port>
no need to give application name.

You can also change the port of your application to run it on default port i.e. 80
by changing in server.xml under server\default\deploy\jboss-web.deployer

<Connector port="80" address="${jboss.bind.address}"
maxThreads="250" maxHttpHeaderSize="8192"
emptySessionPath="true" protocol="HTTP/1.1"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
To enable STDOUT messages in console log

Change in jboss-service.xml under server\default\conf


<mbean code="org.jboss.logging.Log4jService"
name="jboss.system:type=Log4jService,service=Logging"
xmbean-dd="resource:xmdesc/Log4jService-xmbean.xml">
<attribute name="ConfigurationURL">resource:jboss-log4j.xml</attribute>
<!-- Set the org.apache.log4j.helpers.LogLog.setQuiteMode. As of log4j1.2.8
this needs to be set to avoid a possible deadlock on exception at the
appender level. See bug#696819.
-->
<attribute name="Log4jQuietMode">true</attribute>
<!-- How frequently in seconds the ConfigurationURL is checked for changes -->
<attribute name="RefreshPeriod">60</attribute>
<attribute name="CatchSystemOut">true</attribute>
</mbean>
Now all your System.out.println messages will be written in server.log file that is in

server\default\log



This is in the reference of JBOSS version 4.2.3 GA

No comments: