Thursday, 6 December 2018

Doh, WebSphere Application Server, Resource Environment Providers and Not-so-Shared Libraries

I'm fiddling with old-school Java again, reminding myself how Resource Environment Providers work in WebSphere Application Server (WAS) 9.

Using this : -

Using resource environment providers in WebSphere Application Server

and this: -

Resource Environment Provider in EJB-jar xml

as inspiration, I'd written a very basic servlet, that reads from a Resource Environment Entry, setup using a Resource Environment Provider, ably provided by a Java class.

When I attempted to use my servlet ( the Resource Environment Entry is retrieved during the doGet() method, I saw this in the logs: -

[06/12/18 18:05:46:969 GMT] 00000098 annotation    W inject(mo) SRVE8042E: An internal error caused the reference context that enables injection to not be initialized properly.
[06/12/18 18:05:47:539 GMT] 00000098 ServletWrappe E service Uncaught service() exception thrown by servlet com.davehay.Hello: java.lang.NoClassDefFoundError:
at com.davehay.Hello.doGet(
Caused by: java.lang.ClassNotFoundException:

Guess what ?

I bet you can't....

It was (l)user error.

Although I'd included my "utility" JAR as a Shared Library in WAS, I'd forgotten to "bind" it to the application : -

So, even though my application "knew" about the Resource Environment: -

it couldn't marry the two together i.e. the exception: -

Caused by: java.lang.ClassNotFoundException:

took me right back to my beginnings with J2EE and WAS 2.X in the early noughts - it's always the class path, dummy

No comments:

Grokking grep

A colleague was tinkering with grep  and, thanks to him, I discovered a bit more about the trusty little utility. I had not really explored ...