I am working on a legacy application that was written in EJB 2. I want to load it in eclipse and debug it within Eclipse. I know I can build it and deploy it in a local Jboss 5.1 installation and remote debug from Eclipse but the problem with this option is that every time i make a change i have to build and deploy it again.
Now this application is comprised of several folders and is built using ANT. A high level view of the folder structure is shown below:
MyAppServer
build
build.xml
descriptors
app1.xml
app2.xml
app3.xml
...
...
app33.xml
src
packagefolder1
com
xxx
xxx
packagefolder2
com
xxx
xxx
packagefolder3
com
xxx
xxx
test
There is a descriptor file for each component (a total of about 42 descriptor files). Each of them contain the following definitions
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">
<ejb-jar>
<description>abcd</description>
<enterprise-beans>
<session>
<display-name>xxx Bean</display-name>
<ejb-name>Xxxx</ejb-name>
<home>PackageFolder1.xxx.xxx</home>
<remote>xxx.xxx.xxx</remote>
<ejb-class>xxx.xxx.xxx</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
<resource-ref>
<res-ref-name>jdbc/myAppDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</session>
</enterprise-beans>
</ejb-jar>
In addition to the descriptor files there are also three files which seem to be generic. application.xml, application-client.xml and web.xml. The contents of these files have the following format
application.xml
<application>
<display-name>MyAppServer</display-name>
<module>
<ejb>app1.jar</ejb>
</module>
<module>
<ejb>app2.jar</ejb>
</module>
<module>
<ejb>app3.jar</ejb>
</module>
<module>
<ejb>app4.jar</ejb>
</module>
<module>
<ejb>app5.jar</ejb>
</module>
....
....
<module>
<ejb>app42.jar</ejb>
</module>
</application>
application-client.xml
<application-client>
<ejb-ref>
<ejb-ref-name>xxx</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>xxx.xxxHome</home>
<remote>xxxx</remote>
</ejb-ref>
<ejb-ref>
<ejb-ref-name>xxx</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>xxx.xxxHome</home>
<remote>xxxx</remote>
</ejb-ref>
....
....
<ejb-ref>
<ejb-ref-name>xxx</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>xxx.xxxHome</home>
<remote>xxxx</remote>
</ejb-ref>
</application-client>
Now when i use the ant build script to build it, i get an EAR file that has the following content
MyAppServer
config
META-INF
MANIFEST.MF
app1.jar
META-INF
ejb-jar.xml
packageFolder1
MyClass1.class
app2.jar
META-INF
ejb-jar.xml
packageFolder2
MyClass2.class
app3.jar
META-INF
ejb-jar.xml
packageFolder3
MyClass3.class
app4.jar
META-INF
ejb-jar.xml
packageFolder4
MyClass3.class
So it looks like the ant build sript take each module, builds a jar file, create an ejb-jar.xml and adds it to the EAR file. Each module is packaged as a jar file. I didnt see the application.xml and application-client.xml files in the ear file so im guessing these are used to craete the ear file?
I want to load this application into eclipse and try and debug it. When i create a vanialla EJB 2.1 project in Eclipse, the structure that i get is shown below:
EJB2.1Vanilla
ejbModule
META-INF
ejb-jar.xml
MANIFEST.MF
What is the best way to load that application so i can run it directly from within eclipse? I think the location of the src folders should not matter, it is how i can re-configure the descriptor files that i am struggling with.