Friday, August 19, 2011

jboss web.xml

<jboss-web>
<context-root><name-of-app></name-of-app>
</context-root>
</jboss-web>

Put the above snippet into a file called jboss-web.xml in your WEB-INF directory of your war to give it a new context root. Replace with whatever your app is called. Without this file, jboss will use whatever the name of your WAR file is as the context root of your application.


Note: This was used with JBOSS 5.1.0 EAP. I believe it works with most new versions of jboss though.

jboss classloading

<classloading xmlns="urn:jboss:classloading:1.0"
name="<war-name>"
domain="<domain-name>"
export-all="NON_EMPTY"
import-all="true">
</classloading>

Put the above snippet in a file called jboss-classloading.xml within your WEB-INF directory and jboss will use your WARs jars instead of it's own when classloading for your application. Of course, be sure to substitute with your applications war file name and with whatever domain you decide to use. You can use any domain, but any two applications on the server sharing a domain name will both have access to eachother's classes.


Note: This was used with JBOSS 5.1.0 EAP. I believe it works with most new versions of jboss though.

Finding out what ports a particular process is listening on in UNIX

run netstat -tulpn | grep PID and substitute PID with your process' PID. This should give you a listening of ports in the third column of the output that your process is listening on.

Tuesday, July 12, 2011

Jboss EAP 5.1.0GA and Spring

We were having trouble incorporating our version of Spring with Jboass EAP 5.1.0GA. We kept getting this exception:

java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)

What is that??
It turns out that if you're using
or scanning for @Component-annotated beans
in your spring xml files or your bean classes, spring can't find what it's looking for because of the way Spring's PathMatchingResourcePatternResolver behaves with JBoss' VFS.

To get around this you have to add Snowdrop-vfs-1.0.1.GA and tell spring to use the 0org.jboss.spring.vfs.context.VFSXmlWebApplicationContext class instead of it's default class when loading the Web Application Context.

More details can be found here:

https://issues.jboss.org/browse/JBPAPP-5051 (The 5th comment down details the work around)
Link
This link describes the problem in detail for those that are curious: http://www.redhat.com/f/pdf/jbw/mbogoevici_1050_spring_on_jboss.pdf

I've also read that upgrading to Spring 3.0 fixes the issue but I haven't tried it myself.


Intro

This blog is where I'm going to be posting about the various things I've learned pertaining to my work as a computer programmer. I need a place to keep track of all the little hints and magical incantations I've learned. Who knows, posting it publicly might help others along the way too.