For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub
- This topic has 4 replies, 3 voices, and was last updated 22 years ago by
Riyad Kalla.
-
AuthorPosts
-
cruitenMemberI am using MyEclipse version 3.7.200, build Id 200407091200-3.8-Beta2 with Eclipse version 3.0.0, build 200406251208.
I am using the WebLogic 8 integrated server capabilities provided by MyEclipse.
I created J2EE Enterprise Application Project with an EJB Module project (betaEJB) and a Web Module project (betaWeb).
I added Struts capabilities to the betaWeb project.In addition I also created a new Java Project called betaJava. This project contains utility classes that will be referenced
from the EJB Module project as well as from the Web Module project.In order for the Web Module project to “see” the EJB classes, I added the following entry in the WebRoot/META-INF/MANIFEST.MF file: betaEJB.jar.
All the projects are configured properly by updating the Java Build Path > Projects setting and all appears well from the perspective of the IDE.
Here are the settings just in case this might help:
betaEJB requires the betaJava project.
betaWeb requires the betaJava project.
betaJava requires the betaEJB project.Again, all appears well with the expection of the warning about Eclipse detecting a cycle, but that is ok.
Here is the first test scenario:
1. The JSP page calls a class method in a class that resides in the betaWeb project.
2. The betaWeb class method gets a reference to a Session Bean from the betaEJB project.
3. The betaWeb class method invokes a method on the Session Bean and returns the String value.
4. The JSP page displays the String value.This first test scenario works as expected.
Here is the second test scenario:
1. The JSP page calls a class method in a class that resides in the betaJava project, not the betaWeb project.
1a. The class is direct copy of the class in the first test scenario; it was “moved” to the betaJava project.
2. The betaJava class method gets a reference to a Session Bean from the betaEJB project.
3. The betaJava class method invokes a method on the Session Bean and returns the String value.
4. The JSP page displays the String value.This is where things break down in step 2 because the system complains that it is unable to obtain a reference to
the remote interface for the Session Bean in a java.lang.NoClassDefFoundError exception.Why does this happen? If I look at the user_projects directory for my WebLogic 8.1.3 system, I see the class for
the second scenario in the WEB-INF/classes directory right along the class from the first scenario. (I renamed the
class in the second scenario). Even though it is in the same location as the class file in the first scenario, it is
unable to reference the EJB home class.The only way I can “fix” this problem is by adding the EJB compiled classes directory to the classpath in
Preferences > MyEclipse > Application Servers > WebLogic 8 > Paths. However I don’t believe that this is the “right”
thing to do since WebLogic complains with this warning message:
<While deploying EJB ‘RuitenBean’, class com.mitrix.ejb.RuitenBeanSession was loaded from the system classpath. As a result, this class cannot be reloaded while the server is running. To prevent this behavior in the future, make sure the class is not located in the server classpath.>My other question deals with the proper way to have the Session Beans in the betaEJB project reference the classes in the betaJava project. I have tried
several approached by updating the betaEJB/src/META-INF/MANIFEST.MF with references to the betaWeb project since the classes are automatically deployed
in the betaWeb project since I have the Smart Deployment setting set as the Web Project Dependent Deployment Policy and I always deploy the external
libraries for the Web Project External Libraries Deployment Policy.Your help would be greatly appreciated.
Cor
July 22, 2004 at 5:42 pm #210741
Riyad KallaMemberCor,
I’ve asked Scott to take a look at this for you, thank you for such indepth detail, it will help us figure out the problem faster.July 23, 2004 at 9:15 am #210773
Scott AndersonParticipantCor,
Wow. Ok, here’s where I’d start.
betaEJB requires the betaJava project.
betaWeb requires the betaJava project.
betaJava requires the betaEJB project.Again, all appears well with the expection of the warning about Eclipse detecting a cycle, but that is ok.
No, the cycle really isn’t OK. It might be OK with Eclipse, but it’s definately not a good thing for the J2EE classloader hierarchy in WebLogic to have to deal with. You really need to either refactor your code so that the betaJava project is not dependent on the betaEJB project, or you need to merge the betaJava project into the betaEJB project, which is the easier approach. Next, you didn’t mention if you’re deploying everything within an EAR or not. If you’re not, I’d suggest that you do as a second step because each web module in an EAR has access to all classes in the EJB projects automatically. So, once you’ve merged the betaJava project into the betaEJB project and deploy as an EAR you won’t need any manifest class-path entries and everything will “just work”.
July 29, 2004 at 10:41 am #211128
cruitenMemberScott,
Sorry for not getting back with you earlier.
I changed the project hierarchy per your suggestion, and that took care of the problems.
Since I am not deploying the application as an EAR on the development environments I did make an entry in the classpath definition in the MANIFEST.MF file of the web-application in order to see the classes in the EJB application.
We are deploying the EJB and Web application independently on the development environments since we have about 30 session beans which means that redeploying the entire EAP takes considerately longer than just redeploying the Web application which we have to do quite often after we make changes in the Struts configuration files.
Thanks again.
Cor
July 29, 2004 at 11:10 am #211133
Riyad KallaMemberCor,
Glad to hear everything is working. -
AuthorPosts
