- This topic has 23 replies, 7 voices, and was last updated 20 years, 8 months ago by
Riyad Kalla.
-
AuthorPosts
-
breynoldMemberI’ve got a plain java project and a web module that depends on that java project. The web app compiles fine, but when I deploy it, the classes of the plain java project (and all the external libraries that they use) don’t get copied over to the web server. The end effect is that the JSPs won’t compile on the server.
I set the plain java project as a dependency in the web application (properties->java build path->project dependencies tab). I’m not sure what else I have to do to get the classes and libraries to go into the web app.
Anyone got any ideas?
Brian
Riyad KallaMemberThis is one of the biggest requests that we are addressing in MyEclipse 2.8, more generally, deployment of project dependencies. We appologize for the inconvenience and would suggest that you JAR the dependant project and add it to the web module project in its WEB-INF/lib dir for the time being.
Steve TrudelMemberHas this been resolved in Eclipse v3.0/RC1 – MyEclipse v3.8 Beta-1?
I am having a similar issue deploying an EJB project that depends on a
Java project that has been packaged into a jar. The EJB compiles fine
since the Java jar/project are referenced in the build path but when deployed
to the WebLogic 8.1 server the server throws a java.lang.NoClassDefFoundError
exception regarding a class that should be found in that jar.Any help would be appreciated.
Thanks,
Steve
Armen YampolskyMemberCan someone please let us know how to get “Web Project Dependent Project” and “External Libraries” deployment policy preferences to work? Is there a secret hoop through which we need to jump? The preference sounds so sweet! I see that folks have been asking for this “feature” for over a year, and it’s always discussed as if it’s a high priority for the MyEclipse team. Well here I am with a fresh install of 3.8 beta 2, a fresh web project with only JSP pages (no java sources), and one simple EJB project, and the former is set to depend on the latter. The EJB project has a couple of dependent jars. All are set to be exported. The web project has its dependencies properly set. However, 0 classes and 0 jars get deployed with the web project! I’ve tried your “smart” deployment preference, and I’ve tried “always”. I’ve re-installed and re-created projects from scratch. Now that my hair is gone, I think I’m ready for the answer. Please tell me: what can I do to get the preference to work?
Thank you,
-Armen
Riyad KallaMemberShoot guys I don’t know how I missed the replies to this thread but yes this has been in MyEclipse since Beta 1. For the EJB or Web Module project that relies on a Java Project, make sure to set in the Project Properties that your EJB or Web Project depends on another project, and then under MyEclipse-Web, adjust the deployment settings to use Smart Deployment and additionally if you want, set how you want External JARs to be deployed as well.
Well here I am with a fresh install of 3.8 beta 2, a fresh web project with only JSP pages (no java sources), and one simple EJB project, and the former is set to depend on the latter
This is different, is the EJB project a Plain Java project or is it a EJB Module Project? We don’t support the deployment of deliant EJB projects because there is nothing in the spec defining how they projects should be ‘combined’. The problem above that Steve is having is what was such a popular request, either (a) the deployment of external libraries along with a project, or (b) the packaging and deployment of Java Projects along with a project… we don’t support the case where the dependent project is a EJB Module Project.
Armen YampolskyMember@support-rkalla wrote:
make sure to set in the Project Properties that your EJB or Web Project depends on another project, and then under MyEclipse-Web, adjust the deployment settings to use Smart Deployment and additionally if you want, set how you want External JARs to be deployed as well.
Well here I am with a fresh install of 3.8 beta 2, a fresh web project with only JSP pages (no java sources), and one simple EJB project, and the former is set to depend on the latter
This is different, is the EJB project a Plain Java project or is it a EJB Module Project? We don’t support the deployment of deliant EJB projects because there is nothing in the spec defining how they projects should be ‘combined’.
No problem! I have created a regular java project with the sources. Now I have 3 projects:
(1) PLAIN. It has a source dir, a classes dir, and a lib dir with a single jar. All dependency and export settings correct.
(2) EJB. It has nothing but a dependency to PLAIN. It has a project reference set to PLAIN.
(3) WEB. It only has a webroot dir that contains jsp’s, and has a project reference set to PLAIN.Guess what? When I deploy EJB, nothing gets deployed at all — nada. It creates a jar that contains nothing and weblogic throws a zip exception. When I deploy WEB, the jar the PLAIN depends on does not get deployed. So, I am thinking that there must be something I have missed. I am sure of it! You folks have the premier J2EE plugin for Eclipse, so surely deployment works properly by now. What is it that I’m doing wrong?
Thanks!
-Armen
Riyad KallaMember(1) This sounds pretty good, does this project depend on any external JARs?
(2) If you click on the project root (right click) and go to Properties > MyEclipse-Web, what are the settings for “Dpendent Project Deployment” and “External Library Deployment”? Does this project reference any external JARs? Did you setup the PLAIN Project under the “Project References” settings as well as the Java Build Path > Projects tab?
(3) Is this project a normal web application with a working web.xml file, and classes and a lib dir, or is it JUST some JSP files and that’s it? If its JUST some JSP files, then we are currently working on fixing a bug where deploying a Web Project with only static content in it causes deployment to fail, so that *might* be the problem you are seeing.
Scott AndersonParticipantAll,
A minor correction: dependent Java project deployment is supported only for Web projects, not EJB projects, since there is no standard location in an EJB jar file in which we could add the libraries, unlike WEB-INF/lib in web projects. A thread detailing how to use this feature is available here:
http://www.myeclipseide.com/PNphpBB2+file-viewtopic-t-2626-highlight-dependent+java+web+project.html
Riyad KallaMemberGood followup, thanks for the clarification.
Armen YampolskyMember@support-rkalla wrote:
(1) This sounds pretty good, does this project depend on any external JARs?
Yes it does. It has one jar. I have made it a User Library, however I can also make it an external jar. MyEclipse fails to deploy it to the web project in either case.
(2) If you click on the project root (right click) and go to Properties > MyEclipse-Web, what are the settings for “Dpendent Project Deployment” and “External Library Deployment”? Does this project reference any external JARs? Did you setup the PLAIN Project under the “Project References” settings as well as the Java Build Path > Projects tab?
I now understand that dependent jars will not get deployed to EJB deployments due to lack of standard location. However there remain a number of problems:
(a) you still do not support multiple appserver configurations for a given appserver. so if i add dependent jars to the classpath here, all deployments get them. Even worse, I can not work on different domains without reconfiguring the entire appserver preference. Major drag is an understatement.
(b) I have no souce code that is specific to the EJB project — it depends entirely on this PLAIN project. However, no classes from this project get deployed.To answer your question, the EJB project does not reference external jars, only the PLAIN project, and yes it references it in both places. Yet no classes get deployed.
(3) Is this project a normal web application with a working web.xml file, and classes and a lib dir, or is it JUST some JSP files and that’s it? If its JUST some JSP files, then we are currently working on fixing a bug where deploying a Web Project with only static content in it causes deployment to fail, so that *might* be the problem you are seeing.
It is a normal web project with a working web.xml file and has a classes directory to which classes from the PLAIN project get deployed. However, the jar from the PLAIN project does not get deployed. Further, if I manually reference the jar as a User Library and add it as a project dependency, it still does not get deployed. The only way to deploy a dependent jar, as far as I can tell, is to manully place it into WEB-INF/lib. This is not the behavior your new deployment preference system leads one to expect.
I thought this was one of the simplest enterprise-style apps I could come up with: some central source code, a single dependent library in a jar, a servlet container and an ejb container. Yet setting this simple system up is an enormous headache, and even if one tweaks the WEB-INF/lib directory with the necessary dependency manually, the project sees those classes twice — once from the WEB-INF/lib jar, and once from the PLAIN project’s dependency. They show up twice if you browse types. As far as I can tell, you do not properly support this simple scenario AT ALL.
Scott AndersonParticipantI have made it a User Library, however I can also make it an external jar. MyEclipse fails to deploy it to the web project in either case.
When deploying dependent Java projects, we don’t deploy the ‘full closure’ of the classpath as this could cause a myriad of problems. If you have any jars that are also needed at deployment, you can add them as ‘External Libraries’ to your Web project’s (not Java project’s) classpath. This will cause them to also be deployed with your web application.
I have no souce code that is specific to the EJB project — it depends entirely on this PLAIN project. However, no classes from this project get deployed.
Do you really mean that? What about the EJB’s? No classes from the dependent project will be deployed with the EJB project as dependent project support is only currently implemented for web projects.
It is a normal web project with a working web.xml file and has a classes directory to which classes from the PLAIN project get deployed. However, the jar from the PLAIN project does not get deployed. …The only way to deploy a dependent jar, as far as I can tell, is to manully place it into WEB-INF/lib.
Adding the jar to the web project as an External Library will deploy it without adding it to WEB-INF/lib.
the project sees those classes twice — once from the WEB-INF/lib jar, and once from the PLAIN project’s dependency.
Once you add the External Library to the web project’s build path, stop exporting it from the plain dependent Java project’s build path.
Armen YampolskyMember@support-scott wrote:
I have no souce code that is specific to the EJB project — it depends entirely on this PLAIN project. However, no classes from this project get deployed.
Do you really mean that? What about the EJB’s? No classes from the dependent project will be deployed with the EJB project as dependent project support is only currently implemented for web projects.
Sure I mean that. Is this not common? We have a single project — most of the code is common to both tiers. It is MyEclipse that forces me to make 3 projects out of one. That’s OK. So I have followed your advice, and now I have what follows:
(1) A core PLAIN project with all source code, with a single dependency — a jar. This jar is not exported, as no other projects can take advantage of it being set to be exported.
(2) An EJB Project. I am forced to create a linked source folder to the PLAIN project’s source folder. I am forced to add the dependent jar to the appserver’s classpath via preferences.
(3) A WEB project with a dependency on the PLAIN one, and the lib added as an External Jar. Can’t even take advantage of making the jar a User Library to save time/energy, because User Libraries don’t get deployed.You want to have me believe that this is an easy, normal setup for the simplest of 2-tier apps? This is elegant in your opinion? Just wondering….
Scott AndersonParticipantYou want to have me believe that this is an easy, normal setup for the simplest of 2-tier apps?
If it’s a two-tier app, why do you even have an EJB project? They’re not required.
A core PLAIN project with all source code
If it really has all your Java code, why not just have the Java code as part of the web project? Web projects can have Java source directories. From the description you just gave, it sounds like you could have one project, a Web project, with a java source directory to contain all your code, a web root directory to contain all your web content, and either a dependent library in it’s WEB-INF/lib dir or listed as an external library on the classpath. You can then simply deploy as a web project. Is there some reason this won’t work for you if it’s a simple two-tier app?
Armen YampolskyMember@support-scott wrote:
You want to have me believe that this is an easy, normal setup for the simplest of 2-tier apps?
If it’s a two-tier app, why do you even have an EJB project? They’re not required.
A core PLAIN project with all source code
From the description you just gave, it sounds like you could have one project, a Web project
Scott, sorry, there’s been some miscommunication. By two-tier I mean an EJB container and a web container. A business tier, and presentation tier. The business tier has business logic in a variety of EJB’s, a DAO layer, all that good stuff. The presentation tier has the servlets and MVC architecture and jsp’s that we all know and love. And there’s loads of classes that are common and required by both, and are not packaged up into separate jars but simply part of the source tree — stuff like constants and interfaces. It is a single application, stored in source control as a single project, and historically treated by developers as a single project in our old IDE’s such as JBuilder (where you have one project, with a single source tree, you define your libs once, and there are two nodes underneath the project tree structure which define the two deployments — to an EJB container and a servlet container). And this is what our developers are used to. The package naming defines what goes into which tier and what is common. To go through the trouble of actually dividing up the souce tree into three projects is an unnecessary pain. We don’t care to go through the trouble, as we gain nothing by doing so. We want to know how YOU guys recommend we do it in MyEclipse. I want to be able to define libraries once, for instance, and set dependencies so these libs get deployed with the app. Some apps have 10-20 jars — we don’t want to define them 3 times — twice for PLAIN and WEB, once in the EJB appserver’s prefs. What is the easy and clean and proper way to deal with a single app that has an EJB tier and servlet tier, the source code stored in a single place in source control and a single place on the developer’s file system? I need to get our developers to move to MyEclipse properly and avoid having them balk at the awkwardness of the approach described in my previous post.
I appreciate your quick responses, but the way, and apologize if I sound annoyed. I actually am very enthusiastic about MyEclipse, and want to see similar enthusiasm among my developers, whom I am asking to migrate to this IDE.
Scott AndersonParticipantThe business tier has business logic in a variety of EJB’s, a DAO layer, all that good stuff.
Sorry for the confusion. Just to be clear, the above is traditionally referred to as a three-tier app. Presentation / Logic / Persistence. A two-tier app is basically Presentation & Logic / Persistence, like a web application that directly accesses a database.
To go through the trouble of actually dividing up the souce tree into three projects is an unnecessary pain. We don’t care to go through the trouble, as we gain nothing by doing so. We want to know how YOU guys recommend we do it in MyEclipse.
Actually, it is required by the Eclipse (not MyEclipse) project structure so that the projects’ classpath and class loading structure can exactly mirror what you’ll see at runtime. With everything under one project, you could easily create an application that compiled correctly but wouldn’t run when deployed because the classloading characteristics would be different. You’ll notice that we didn’t make this up as all Eclipse-based J2EE IDEs (WSAD, etc) use a similar multi-project setup for exactly this reason.
Now that I understand your project structure better, I think I can make a better recomendation for you. There are two main concerns with setting up the project structure. Once is that everything builds correctly in the dev environment and the second is that it deploys and that the classpath mirrors the dev environment. For large projects, here’s what I’d recommend.
-
1)Take all your library jars and add them to the root level of your EAR project using the Navigator View.
2) For each web or EJB project that needs these libraries
a) Use Properties > Java Build Path > Add Jar… to add each required jar from the EAR project. This allows development-time visibility
b) Modify the Class-Path entry in the project’s MANIFEST.MF file to point to the same jars. This will allow them to be loaded when the application is deployed.
3) Turn off “Smart Deployment” for the web projects since you’ve handled the libraries manually by the above. The ‘Smart Deployment’ feature is really intended to facilite the packaging of two-tier applications only. With common code shared by an EJB layer, it’s really not appropriate.The above will work for EARs no matter how many EJB and Web project they contain and is the most flexible solution.
As an alternative, forgetting about the above and simply placing all the common Jars at the top level of the EJB project and common source code in the EJB project itself. You’ll still need to modify the MANIFEST.MF of the EJB project to point to the jars it contains, but the web projects will be able to reference them automatically. This will work correctly since classloaders for web projects within the same EAR have access to any class that a classloader within an EJB jar they reference can load.
-
AuthorPosts