Eclipse + Tomcat: Web app checks for TLD, how to stop? - eclipse

I've got a Maven project the gives me a war file.
If I deploy this was direct to Tomcat7.0.33 it seems to work fine.
If I start tomcat from inside eclipse, then I get errors to do with looking up TLD's
i.e. JSTL tld missing and "http://www.springframework.org/security/tags cannot be resolved in either web.xml or the jar files deployed with this application"
Can anyone give me a clue as to why?
It almost like the property '
< constant name="struts.devMode" value="false" />' has been set to true.
Any ideas would be great!
Thanks
Jeff Porter
Edit: The wars were the same. Checked via BeyondCompare.
If I find a solution, I will post it.

Are you using the same instance of tomcat in both cases (standalone/ eclipse)?
Are you sure are you deploying exactly the same jars set in both cases?
Check in eclipse what is deployment assembly ( Click on Web-Project -> Choose properties for the web project -> click Deployment Assembly ) for your web project, there can you see what is deployed when using eclipse)?
It is hard to say exactly what is wrong, but if you have the same tomcat instances in both cases should be a problem only in deployed jars (not all is deployed in eclipse, or in wrong version is deployed, or too much is deployed and some jars conflict tomcat jars).
I had similar problem but long time ago. As I remember there was a library version problem. This what I deployed was in conflict with some tomcat jars.

Related

Eclipse's Tomcat gives a 404 while the WAR file works-previous solutions don't work

So when I'm running my project through Eclipse's "Run on server" the 'server' doesn't work (when trying the URI http://localhost:8080/simpleapp/ there is an automated 404 Tomcat's webpage), but when compiling and deploying the WAR file through Tomcat's app manager it works fine (the exact same URI gives the response I expected).
How can I systematically solve the issue?
It's important for me to solve it since debugging is a living hell this way right now (can't do a step-by-step debugging,every time that I want to check something I have to re-deploy my project :( ).
I've looked for hours for a solution so I've tried lots of different settings, and the proposed solutions don't work here.
Specifically,when changing the server's configuration in Eclipse to 'use tomcat installation', it doesnt work through eclipse (and the WAR file cannot be undeployed and doesn't work either!),switch location doesn't work either...
More details which are optional but might help:
I have another project where the server through Eclipse does function, I've just used a different Maven archetype this time. When Eclipse's server 'worked' I used jersey-quick start-web app but this time I had to use (org.glassfish.jersey.archetypes:jersey-heroku-webapp (An archetype which contains a quick start Jersey-based web application project capable to run on Heroku)) and added dynamic web module through project facets and as I said now the Eclipse server doesn't work (oh and I've tried to delete the server and reset the configuration too, but no luck).
Try to deploy your WAR using "Add and Remove" from the Servers view instead of using "Run on Server". If the WAR doesn't appear check the Project Facets and ensure that Dynamic Web module is enabled.

How to set deployment folder in Eclipse? (with JBoss-Wildfly)

I have made a couple of test projects with JavaEE / Jboss for learning purpose. In this 3rd project something is going wrong. My project is "ignored" by JBoss Wildfly. Looking inside the JBoss's deployment folder i can't see my 3rd project, no .war folder. How can i tell eclipse to deploy as usual, resulting in a new project folder in the right place under Wildfly?
I have started a new project as usual (New => Dynamic Web Project), or maybe i missed something / i have made a mistake during project creation (if yes, where?)
Solution found. The project was never run, but only saved, so it was never deployed. Now i have the WAR folder in the selected server, and everything works!

Running helloworld-rs from JBoss quickstarts in eclipse

I am trying to learn JAX-RS using JBoss quickstarts.
When I deployed the application "helloworld-rs" through command-line, it ran successfully. Then I created a maven project in Eclipse, copied files from "helloworld-rs" at proper locations and it worked fine. Then I went ahead to add a form to the existing index.html file and something went wrong. Instead off deploying "jboss-as-helloworld-rs", Eclipse started deploying "jboss-as-helloworld-osgi" for some unknown reasons. Obviously, it produced error when I tried to access "localhost:8080/jboss-as-helloworld-rs/index.html"
So I created a new Maven project in Eclipse with following details:
Group Id:org.jboss.as.quickstarts.rshelloworld
Artifact Id: jboss-hello
I have also made changes in pom.xml as follows:
<artifactId>jboss-hello</artifactId>
Still I am facing the same problem. I have made a copy of "helloworld-rs", made same changes in the pom.xml and deployed and ran it successfully through command-line using
http://localhost:8080/jboss-hello/index.html
Strangely, this very link does not work in eclipse!!!
I have zeroed-in that there is some problem in deploying th app in Eclipse. Can anybody please help me solve this? Thank you!!!
I went to the 'jboss-as-7.1.1.Final\standalone\deployments' folder, deleted all the deployed war files. Then in Eclipse, right-click on servers -> clean . Then, I started the JBoss server and everything went fine.

Eclipse + JBoss - some JAR files not deployed

I have an Eclipse Indigo installation with a JBoss 6 server managed by it. I have a Maven project with a few modules. These modules all build just fine from the command line.
One of the modules is an EAR. This is dependent on two JAR modules and a couple of WAR modules. When I package the EAR from the command line (mvn clean package), the EAR contains all the necessary JAR and WAR files. However, when I deploy it from Eclipse, the two module JAR files are missing from JBoss. The WAR files are just fine. Inside the "Add and Remove..." dialog the JAR files are also present, but not when deployed. I've checked JBoss' deployments folder and there they are indeed missing. The strange thing is, with the exact same POMs and code, all of my colleagues with the same(?) setup don't have this problem.
The two JAR modules are listed in the dependency management part of the parent POM. They are also listed as dependencies in the EAR POM. Still, Eclipse refuses to deploy them with the EAR.
Does anybody have any idea how I can solve this issue? I can manually package and deploy the EAR, but 1) that takes longer, and 2) I can't use Eclipse's debugging functionality this way.
Note: previously asked at http://www.coderanch.com/t/580959/vc/Eclipse-JBoss-some-JAR-files
Right mouse button on project -> Maven -> Update project
I experienced the exact same issue, different eclipse (Eclipse Mars, WildFly 8.1 ).
The unsettling part was that I didn't change anything in the code or in the IDE (that I am aware of) and it started malfunctioning.
I suspect it has something to do with the cached memory of eclipse for it's plugins, anyway, after many hours of trying different things we fixed it by deleting the folder .eclipse under your user in windows.
Seems silly, but we tried everything except that, and that thing did the trick
I'm encountering a similar issue, however my environment is much, much simpler - being a web project, with a utility project. Not using maven at all and deploying to tomcat7.
The class file is not being deployed to the web-inf as expected, although the utility project is referenced, and marked as to be exported.
However with your issue, I came across this post:
http://blog.frankel.ch/better-maven-integration-leads-to-unforeseen-consequences-bugs#comments
which might provide a clue. Hope this helps.
I had the same issue. I didn't modify my code at all, I deleted all the projects from the work space, closed eclipse and reopened it. Then I did a clean and build of the project (which took much longer than before). This time when I went to add the EAR project, it had all the dependencies listed and actually worked.

missing classes after publish web project into tomcat using eclipse wtp

I have several dynamic web projects in my workspace, each contains classes and refers to other utility projects (simple Java Projects), and to 3rd party jars.
These apps (dynamic web projects) are deployed on tomcat v6.0.6 using eclipse WTP (Helios 3.6)
When I update my workspace and new classes/resources/jars are extracted from the SVN repository, I re-publish my apps in tomcat apps, and restart it.
Occasionally, when tomcat starts one of my apps, it throws ClassNotFoundException, or complains about other missing resource. Sometimes I see that the a deployed resource (spring beans xml for example) is not up to date, and has 'old' content in it.
The common anti-voodoo-black-magic treatment I use:
* stop / start tomcat
* clean (when right click on the server configuration)
* clean tomcat work directory
* remove all apps from tomcat, clean, restart tomcat, add all apps
I need to run this 'procedure' several time until problem is solved.
Do you guys suffer from it as well ? Is this a known bug ?
Any suggestions how to tackle it ? is using jars instead of utility projects will solve/reduce this problems?
I would consider using Embedded Jetty instead, I just want to avoid from proprietary scripts for running Jetty on a 'production' environment.
-- Yonatan
It happened to me a lot. I wouldn't call that Voodoo. I think that Eclipse WTP doesn't work well when you change stuff in the background (e.g. a maven build).
What I do to solve this is to avoid using it altogether. Instead I use Maven WAR plugin to deploy the application:
mvn war:inplace tomcat:inplace -DskipTests=true
This works very fast, as it doesn't need to assemble, and package the war.
Then to undeploy the application:
mvn tomcat:undeploy
I have scripts that
deploy and start tomact
undeploy and stop tomcat
It looks something like this:
Start tomcat and deploy app:
#!/bin/sh
if [ -f $CATALINA_PID ]; then
echo "tomcat already running with pid " `cat $CATALINA_PID`
exit 1
fi
java -Dmy.arg=val -Dcatalina.home=<catalina-home> -Dlog4j.configuration=file:///log4j.xml -classpath <path-to-tomcat-lib>/bootstrap.jar:/usr/lib/jvm/java-6-sun-1.6.0.20/lib/tools.jar org.apache.catalina.startup.Bootstrap start &
echo $! > $CATALINA_PID
mvn war:inplace tomcat:inplace -DskipTests=true
Undeploy and Stop tomcat:
#!/bin/sh
mvn tomcat:undeploy
<path-to-tomcat>/shutdown.sh -force
rm $CATALINA_PID
The same with probably any other build script - its just a matter of how much code you will have to write.
I chose Maven's war:inplace goal is since it does very little, and thus runs very quickly. See here: maven.apache.org/plugins/maven-war-plugin/usage.html.
BTW, ANT and Gradle have a war task/plugin which can probably be configured to do something similar (I don't really remember...)
Hope this helps.
Another thing to look out for is that Project -> Build Automatically should be enabled and the project should not have any build path problems.
Open the navigator view and confirm that the build folder is having generated class files.
If the files are not being built they won't be published. Though this seems obvious it is easy to over look and wasted a lot of my time.
Interesting behaviour.... Something similar was happening on my Linux machine due to permission issues.
Anyway, i suggest not to use WTP. Try ant build script instead. Its simple and for me it works brilliant.
Been working with Eclipse since it came out, these problems have always existed. Arrived here because atm my web.xml doesn't get deployed anymore. Especially in combination with m2eclipse you'll never know what happens when you try to start your Tomcat. Everybody I know how has worked with Eclipse has these problems, I don't understand why they don't get fixed...and unfortunately working as a contractor means I can't choose my IDE or the container or the way publishing is done, so most of the time I'm stuck with WTP.
I had a similar problem. When I published a web application, Eclipse was not including one of the jar and hence publish to sever through Eclipse fails. I corrected this by modifying the .classpath file of the project to correct dependency as below. To makes sure that its in sync with other jars configuration.
<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.17/log4j-1.2.17.jar" sourcepath="M2_REPO/log4j/log4j/1.2.17/log4j-1.2.17-sources.jar">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
It seems progress is being made on solving this problem.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=365748
Hopefully it will be fixed for the next release of Eclipse.
one possible solution could be that your bin folder is not getting created. check that you have not deleted build/bin folder and it does exists in your work space.