I've inherited a Spring web app. It's a gradle web app project that I've imported into Eclipse. We're using Eclipse 4.7.3, Tomcat 7.0.47 and JDK 1.8.0.151.
The problem is that when I deploy the project to Tomcat from Eclipse, some of the dependency jars are not copied to the project lib directory. When TC tries to start the web app, there are ClassNotFoundException errors.
I'm new to Java web apps, so what I need is some tips for verifying my project import/build/deploy.
Here's what I've done so far:
Install Tomcat 7.0.47 (don't start it after install) Install Eclipse
4.7.3 JavaEE flavor (which comes with Buildship Gradle integration 2.0 installed)
Import my project as a Gradle project (File -> Import -> Gradle ->
Existing Gradle Project). I point at the project root, choose the
web project for deployment, and use the default settings.
Add a server to the project (from Server view click Add -> choose
Tomcat 7.0 -> point to TC root)
Right click the web target and select Run As -> Run As Server and
choose the TC 7 server I added.
At this point the project builds and deploys. The console shows the TC log. TC starts but the shows an error when it attempts to start the web app (for example):
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level
I could copy jars but it's my impression Gradle should be grabbing the dependency jars during deployment. I can verify that some are copied, but others are missing. How can I debug this issue?
Here's part of my build.gradle file
buildscript {
repositories {
maven {
url projectDownloadUrl
}
}
dependencies {
classpath lib_license_gradle_plugin
}
}
The web app is deployed to ...eclipse-workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0. The lib directory here contains some of the deployed dependency jars. The gradle.properties file contains a list of dependencies, for example
lib_apache_tomee=org.apache.openejb:apache-tomee:1.7.1
This is apparently not the place to ask and answer Gradle/Tomcat questions. I figured out the issue shortly after posting, and not wanting to disappoint the 40 people who've come here for help since then, thought I should finally answer my own question.
First, I was on the right track on how to debug deployment of a gradle/maven app in Eclipse. After it deploys you can check which jars are in the deployment directory. Eclipse deploys locally to a place similar to c:\users\\eclipse-workspace.metadata.plugins\org.eclipse.wst.server.core.
Second, the immediate problem I was having was due to using Tomcat instead of Tomcat EE. The answer to this was right in the question:
lib_apache_tomee=org.apache.openejb:apache-tomee:1.7.1
Tomee is Tomcat + Java Enterprise Edition, which includes some extra logging and other jars, the ones I was missing.
Related
I have a problem with deploy of web application to the server locally eclipse.
I imported a new project to the workspace. It is maven project, so updated all dependencies, snapshots and releases. The project has properties set Dynamic Web Module 3.1, Java 8 and even selected runtime server.
Then I add it to the server and run the server problem is that project is added "empty" nothing is deployed. To say the truth I have no idea where can be problem/mistake.
Here is image, hot it looks like in eclipse:
Would appreciate if someone can give me any advice.
Have you tried to right-click on your project and select Maven --> Update Project?
This will import your Maven project setup to eclipse. After trying this out, restart the application server and tell us if that worked.
I'm working with Maven and WebLogic. When building my application with Maven, I can successfully install it manually on my local Weblogic, using the Admin Console.
When trying to deploy this same application on the server using Eclipse IDE, I get a NoClassDefFoundError. (I tried both with "Publish as virtual application" and "Publish as an exploded archive" in the Oracle Weblogic Server tools in Eclipse).
The structure of my application is the following:
MyApp.ear contains:
- MyWar1.war
- MyWar2.war
- MyEjb.jar (ejb module, using maven-ejb-plugin)
- MyJar.jar (another project, as dependency)
And it's this MyJar.jar that seems to be not found in the classpath. I've checked that in the Eclipse settings, this project is include in the Java Build Path\Project, Java Build Path/Order and Export and in the Deployment Assembly for the MyEjb project.
I've also checked the folder build by Eclipse, eclipse-workspace\.metadata\.plugins\org.eclipse.core.resources\.projects\MyApp, where I can see the folder APP-INF\lib\MyJar.jar with the corresponding .class files. And when I try to manually manually install this folder, I got the same error (NoClassDefFoundError).
I'm using Weblogic 10.3.3, Maven 3.2.1, Eclipse 4.4.0 (20140612-0600) and Oracle WebLogic Server Tools 7.2.1.201407111426.
Any ideas how I can investigate this problem ?
Moving the dependencies from APP-INF/lib/ to lib/ folder seems to fix the problem, but I have no idea why.
I have a web application (Eclipse's Dynamic Web App) which uses Maven (m2e-wtp) for the build and dependencies management. This web app's POM references a few other projects in my workspace, which happen to be eclipse plugins built with maven as well (built using Tycho), and also other third party libraries which come from Maven's repository.
Everything works fine when I run maven from the CLI. All dependencies are included in the WEB-INF/lib directory just as expected.
The problem is when I attempt to run the project using Eclipse. I run the app in a configured Tomcat server inside Eclipse, but the referenced projects in my workspace are not added to the deployed war.
I tried adding them to the Deployment Assembly (under project preferences), and that works perfectly, but those settings get wiped out by m2e every time the maven configurations are updated. I read in a few places that we should not manually add entries there since all dependencies should be managed by m2e...
The question is: How to make Eclipse add the workspace project dependencies to the WEB-INF/lib of my web app when I run it from Eclipse?
I'm using Eclipse J2EE 4.3.1 (Kepler SR1).
I also tried right-clicking the project and selecting Export -> WAR file, but the exported WAR file doesn't include the referenced workspace projects either. I'm assuming the issue is affecting both cases.
This is extremely annoying ans is slowing me down quite a bit.. at this time I have to re-add the projects to the Deployment Assembly page several times a day to keep it going...
UPDATE: The workspace projects I added as dependencies in the POM appear in the list of Referenced Projects, under the project's properties. But when I expand the Maven Dependencies in the Project Explorer, the workspace project dependencies are missing from the list! Only the ones in the Maven repository show up. They local ones seem to be silently ignored...
I had similar problem because I created the project outside eclipse, and them imported it. What worked for me was to add the right project facet: Project context menu -> properties -> Project Facets -> Dynamic Web Module (choose right version). I was using Eclipse ADT (version 4.2.0), but, to avoid having multiple installations, I use the same eclipse for Android and other kind of apps.
I have a web application(Myapp) configured in eclipse.
So in order to Deploy it in Websphere v5.1 I have to export it to EAR.
Scenario 1: In eclipse--> new --> Enterprise Application Project
-->Named as MyappEAR--> Selected Existing Module(Myapp)--> Finish. Now I got MyappEAR in Project Explorer. Right click on MyappEAR export to
EAR. Done. Got MyappEAR.ear file with Myapp.war inside it.(Includes
META-INF and xml)
Deployed MyappEAR.ear in Websphere, Deployed Successfully. But when i
tried to start MyappEAR it ends up with this error SRVE0054E: An error
occurred while loading Web application (No more information found).
Scenario 2: Eclipse--> right click on Myapp export to war--> Got
Myapp.war--> Deleted existing myapp from Project explorer.
File-->Import-->WAR--> enabled Add project to an EAR and named it as
MyappEAR-->finish Right click on MyappEAR-->export to EAR. Done . Got
MyappEAR.ear with same stuff as above.
Deloplyed and Started working fine.
Now my question is What's the difference in both ways causing that error? (even checked with beyond compare, everything is same).
Websphere app server v5.1,
Java 1.4,
Eclipse Indigo.
We have a Maven project and it builds the EAR after we run mvn clean install.Then I take EAR from target folder and deploy it in server.
In local setup,Just add the project in server and start the server.Normally it works.
I have a maven war module which run eclipse WTP tomcat server like normal. Now i want to reuse that module artifact by using maven war overlay: i just create a new war project and include that module in project dependencies. The problem is now i cannot use eclipse "Run on server" anymore because i don't have any resource or config file (like web.xml) in the new project, everything is in the war dependencies but eclipse cannot resolve it.
Is there anyway to use a maven war overlay project run with eclipse ?
Thank you.
If you're trying to have a war dependency on a war project, in other words doing a "war overlay", then it's not currently supported by m2eclipse
Jer developped a plugin to implement this feature, you can give it a try : http://code.google.com/p/m2eclipse-wtp-ext/
I've test this(to debug my first JASIG CAS server), and found it works in eclipse:
Using Jetty Maven Plugin to run/debug war overlayed web apps.
Hope helpful~
I am having the same issue here. I agree with you that it's not supported yet (and has not been for almost 2 years!). There seems to be an alternative using q4e version 0.11.0+: http://wiki.eclipse.org/IAM_WTP_support which you can download from https://code.google.com/p/q4e/ or using the update site http://q4e.googlecode.com/svn/trunk/updatesite-iam/ . I'll give it a try and see whether and how it works (with m2eclipse at the same time active).