- This topic has 7 replies, 3 voices, and was last updated 21 years, 5 months ago by
Erez.
-
AuthorPosts
-
ErezMemberI have a J2EE application constisting of both EJB & WEB projects. How do I set each of the project so they could use shared utilities? In other words, what is the directory structure of such an application.
Thanks in advance,
Erez
Scott AndersonParticipantErez,
To use shared utilities you should place the utility jar files in the top level of your EAR project and then reference them appropriately in each web/ear project’s MANIFEST Class-Path. The MyEclipse deployer will pick up the libraries and deploy them properly and the MANIFEST Class-Path entries will tell the projects where to find them.
In order for the utilities to be found during compile time, you’ll also need to add them to the build path of your web and ejb projects through the standard Eclipse build path properties.
Making this process simpler is an open enhancement request as referenced here:
https://www.genuitec.com/forums/topic/adding-libs-to-class-path-in-manifest-mf-enhancement/&highlight=manifest–Scott
MyEclipse Support
ErezMemberIn my existing project under JBuilder I simply have a source directory under which I have all my packages:
– src
services (Session EJBs)
domain (Entity EJBs)
util (utility classes shared among all the project)
common (classes shared by all)
web (WEB module)This is the first level of my source directory, and of course I am using all sorts of third party jars from Struts etc. What is the recommended tree structure using MyEclipse to achieve this? And more specifically where do I put the packages of util and common ? Should they be in a third project ?
TIA,
Erez
support-michaelKeymasterAs Scott indicated you need to work with an Enterprise application in order to deploy you EJB and Web projects as a single application unit, i.e., an EAR. So you will need to separate your JBuilder project into 3 J2EE projects, an Enterprise project, an EJB Project, and a Web Project. The reason for not allowing EJBs and Web elements in a super project has to do with MyEclipse simulating the classpath structure of a J2EE project at design time. Here is a basic outline of steps for creating a MyEclipse Enterprise application:
1) Begin by creating 3 projects, 1 of each type described above
2) Copy the respective code into each project. Place you web content (JSPs) below the <web-root> folder that you specified when creating the Web Project.
3) Copy all required web libs into the <web project>/<webroot>/WEB-INF/lib folder
4) Place all utility jars in the root folder of you Enterprise project
5) Per Scott’s direction (see his post in this thread) add a ClassPath entry to the MANIFEST.MF file that specifies the names of the utility jars.Michael
MyEclipse Support
ErezMember4) Place all utility jars in the root folder of you Enterprise project
I don’t mean to nag, but the utility jars are not jars there are packages of my own containing source files that need to be compiled. Should I put them in a forth project or can I put them inside the EAR project as a src directory? As I undertand it, the EAR should not contain sources, or am I wrong??
Erez
ErezMemberIn my JBuilder project I had except for the EJB and WEB modules some other packages NOT in the form of JARs but loosen classes. They were shared by both the EJB and the WEB modules. What the JBuilder does is for each module (EJB and WEB) it includes those required classes from the shared packags.
How can I achieve the same? and if not what is the alternatives?
Thanks again,Erez
Scott AndersonParticipantErez,
Currently, you’ll have to jar the output of your projects and add them to the EAR as we’ve instructed. There is an open enhancement request to support ‘depende projects’ which is basically the capability you’re asking for. It’s high on the development priority list at this point. You can find several discussions about it if you use the forum search facility and look for ‘all terms’ when specifying: dependent projects
–Scott
MyEclipse Support
ErezMemberThanks Scott, I will look forward to this update, and by the way I actually solved it by using linked resource folders. Not the prettiest solution but it works.
Thanks,
Erez -
AuthorPosts