Friday, July 18, 2008

EJB Deployment Issue

I ran into this weird ejb deployment issue lately. It was a working EJB, then I had to add new remote methods to it. So I added them to the remote interface and to the actual java implementation class. Then when I deployed it locally, it some how doesnt seem to recognize my new methods, and when I access it, it simply throws NoSuchMethodFound error. After struggling for 1.5 days , (as though I dont have enough troubles..) figured out that I have an old client jar with the same .class file,(class I am trying to modify) and the server is picking up the classes from the lib folder evern before deploying my .class files in ejb-jar.

So server always tries to read files in the following order:
1) .class files from the lib folder
2) then any of classes in ur war files webroot/web-inf/classes folder

Also in EJB2.0, you dont need to create stubs and skeletons when you make changes and deploy your ear file,

Also when you provide a service jar to any of your remote service callers, all you porvide in the jar is

1) .class files with Home and Remote interfaces.
2) And no no stubs required. :)

You can generate this jar, by selecting the java classes in your eclipse rt click--> export as jar. I would recommned automate it in ur build file so you dont have to do it everytime. :)

-Coding Rocks.. !!!

No comments: