Hi,
I have a question regarding EJBs, EARs and dependant resources in WSAD 5.1. It seems when deploying EARs, sometimes I can have an
EJB WSAD project reference a jar file and it deploys ok, but in one particular case I have the bean reference a jar file and it will not deploy.
This is my situation:
I have an WSAD EJB project called MyEJBProject. This has a dependency on a very simple jar file of my own creation, called aaa.jar. By adding aaa.jar to the build path of MyEJBProject, I can compile MyEJBProject without error, add it to my EAR project and can deploy and run it succesfully. (Note: I am assuming that becuase MyEJBProject has a dependancy on aaa.jar, then aaa.jar is added to the ear and deployed.)
I now want to add Logging support to MyEJBProject, so I add a reference in MYEJBProject's build path to log4j-1.2.4.jar (a jar shipped with WSAD 5.1). I can now add logging support to MyEJBProject, but when I try to deploy the EAR, I get a ClassNotFound exception.
However, if instead of adding the jar to MyEJBProject, I add the jar to the EARProject and I place a dependancy in MyEJBProject to that jar, then it works and can be deployed succesfully. This allows me to continue working, although I am not entirely happy as it raises the following questions:
Why does one method work for aaa.jar and not for log4j-1.2.4.jar?
Should all of my dependant jar files be placed in the EAR? Is this the way I should be coding? My overall project consists of many WSAD Projects with lots of dependant jars. It seems strange to just lump everything into the EAR and work from that.
Any help anyone can shed on any of this will be greatly appreciated.
Thanks,
David