Tom Duckering

Icon

a web log of my technical stumblings

Weblogic NoClassDefFoundException Resolution

I’ve been meddling with Weblogic server in an attempt to migrate to it from Tomcat (don’t ask). Apart from it being a bit of a pain to get running it also seems to behave in a slightly odd way when it comes to its classloading of libraries included in the WEB-INF/lib directory of a web application.

I was getting the following error when my code was hitting string template code:

CharScanner; panic: ClassNotFoundException: org.antlr.stringtemplate.language.ChunkToken

Despite the fact that the stringtemplate jar was in WEB-INF/lib it turns out that weblogic doesn’t load them by default. I think it seems to prefer that you deploy your libraries in some central location. To get it to behave you need to add a line to the weblogic.xml – which must reside in the WEB-INF directory alongside your web.xml (if you’ve not transitioned to using annotations).

<weblogic-web-app>
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>

Not to complicated but it took me a while to get to the bit in the documentation where it mentioned this.

Filed under: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: