I have a Spring MVC project that I've been deploying to Tomcat (installed both locally and on a server). I'm using Eclipse Indigo as my IDE. To deploy, I had been right clicking and choosing "run on server", which would run fine on localhost. For deploying a WAR to the actual server, I had been right clicking on Project, selecting Export, and going through the wizard to deploy a WAR file.
My Eclipse/Java is rusty, but I did remember that when I used it a couple of years back, I was using the Sysdeo plugin for Tomcat that would give me an option for Deploy to War right from the right click context. So, I poked around and found "Mongrel", which I installed. With that in place, I went to Mongrel under preferences, and set up my Tomcat version, so that I can click the little start/stop Tomcat icons and start/stop the server. This was successful.
What I can't now do for the life of me is, in Project Properties->Tomcat, choose "Is a Tomcat Project". I check the checkbox and then click Apply and/or OK to dismiss the window, and when I open it again, my setting is not recorded. I have tried checking the box and adding other options (like context name, path for a WAR file export, root sub-directory, and activating dev loader), but nothing I do "sticks".
Can someone tell me what I'm missing, or at least point me in the right direction? I'm stumped.
Thanks in advance.
I know this may be a late answer, but as I had the same issue today, I figure I could post my findings here.
I had the exact same problem as yours when I installed mongrel from the eclipse marcket place.
The solution for me was to uninstall mongrel, delete the plugin folder in the plugin directory of eclipse and then get the plugin from the project page on sourceforge.
Related
I successfully cloned an web application project from Github to eclipse Luna.
When I try to deploy the cloned project to google app engine, eclipse does not recognise it as a web project. I realised that it was missing the appengine-web.xml file.
I created one under directory WEB-INF in War,
I saved it but when I try again to deploy, still eclipse says that the project is not an app engine project.
What could I be possibly doing wrong?
Since you do not provide the exact error message, I list several possible causes:
Right click on your project, select "Google" option, then "App Engine". Make sure that "Use Google App Engine" checkbox is checked.
In your build path, make sure that "Allow output folders for source folders" is checked and the correct folder is specified (i.e. "MyProject/war/WEB-INF/classes".
Make sure that you are logged in Google with the correct account before you try to deploy - your current account is shown in the bottom right corner.
UPDATE:
This error indicates that your project is not a Java project. Select Project Facets in Properties. On the right side make sure that on the left side Java 1.7 is selected.
I'm using eclipse indigo and I'm trying to follow this tutorial to set up jBoss. It says...
When installing software from this site, some different categories are shown to install - I have chosen the first one which is “Abridged JBoss tools 3.3”
which I have installed. Then, it says:
The next step after the plugins have been installed is again to install the application server itself.
Which I have (jBoss 4.2.2.GA). So now I'm supposed to do this:
Now, define the server runtime in Eclipse. Open "Window => Preferences" and navigate to the "Server => Runtime Environments" node. Press the "Add" button and in the "New Server Environment" dialog, choose "JBoss Community => JBoss 7.1 runtime". Press the "Next >" button. In the next dialog, enter the path to the directory where you have unpacked the JBoss server earlier.
And I'd love to do that, but I don't see the jBoss Runtime Option. I only see "Basic" and then HTTP Preview and HTTP Server (also J2EE Runtime). Plus, I don't have a JBoss perspective, which I should have, and JBoss Central didn't show up when I restarted eclipse. I tried searching my jBoss folder for runtime environments...I got nothing. It's like I don't have the JBoss Tools.
Apparently, this tutorial is exactly what I need to do to set up my server (says my co-worker). But I'm failing and I'm not sure why. I did set-up a JBoss server once before on a different (and also, now broken) laptop with no problem, but now I'm having trouble since nothing seems to be working correctly. Does anyone else know why this is failing/what's going on?
In eclipse, after clicking on "ADD" you can "download additionnal server adapters" on the top right of your frame! try to click on this and select "JBOSS" if it was not present!
By default i had Jboss in the list...
hope this helps!
I am using the sample project code here that i've downloaded from the following:
http://javahash.com/spring-4-mvc-hello-world-tutorial-full-example/
Direct link here:
http://javahash.com/wp-content/uploads/2014/02/Spring4MVCHelloWorld.zip
I have Eclipse Kepler SR2 (J2EE), Tomcat 7 64-bit, Java 7.
The project does not appear to be a web project, so I add "Dynamic Web Module" version 3.0 and "Java" (version 1.7) to it. I right click, maven install, which appears to run fine. When I try to actually deploy it on tomcat, it does not give any errors in the console, but when the browser window pops up it shows a 404
http://localhost:8080/Spring4MVCHelloWorld/
HTTP Status 404 - /Spring4MVCHelloWorld/
--------------------------------------------------------------------------------
type Status report
message /Spring4MVCHelloWorld/
description The requested resource is not available.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.39
That said, how do I get this "basic" example running in eclipse? Anyone able to get this working successfully? It feels like it should be more trivial than the 5 hours I've spent on trying to get this sample code working to no avail.
UPDATE:
Still continues to fail despite using Tomcat 7.0 server.
Download the sample, extract contents to workspace directory.
"Import Existing Project" in Eclipse
Since there is no "Run On Server" option, I right click on the imported project directory and hit "Properties".
I go to "Project Facets" and check 2 things: "Dynamic Web Module" (3.0) and "Java" (1.7) and hit apply then "Ok".
I right click on the project Spring4MVCHelloWorld and click "Maven"->"Update Project". Then I click "Run On Server".
There are no errors in the console, but the web browser that pops up in eclipse shows a HTTP STATUS 404.
I tried going to:
http://localhost:8080/Spring4MVCHelloWord/hello
and the same:
HTTP Status 404 - /Spring4MVCHelloWorld/hello
shows up, but the tomcat shows up as:
Apache Tomcat/7.0.53
Note that this is the 64-bit version. What steps am I missing? How do I get around this silent failing?
Apart from what Dimitri stated, your log seems to indicate that you are using
Apache Tomcat/6.0.39
That version of Tomcat does not support ServletContainerInitializer which your Spring web application depends on for configuration. Upgrade to a Tomcat version 7+.
It seems like the Maven update doesn't work for you (or for me).
First, go into Properties -> Deployment Assembly. You need to get rid of Web Content if it's there and add src/main/webapp (which is a maven convention). You also need to add the Maven Dependencies as shown below.
Finally, and this might not be necessary, delete the web.xml provided to you and re-create it by selecting and right clicking Deployment Descriptor in the Project Explorer and clicking Generate Deployment Descriptor Stub.
Also, make sure your Java Build Path in the Properties has a Java 7+ version of the JRE.
As far as I can see your controller only maps to /hello, which means your URL should be:
http://localhost:8080/Spring4MVCHelloWorld/hello
Another thing that might be interesting to you is that if your having problems with certain project facets (like Dynamic Web Module) not being recognized, you can usually fix them by righ clicking your project, opening the Maven menu and choosing Update Project.
I currently have a sprimgmvc app that uses maven. I am currently using mvn:package to build war and deploy it to tomcat to develop and this is getting very cumbersome. I dont have the eclipse configured to automatically build and deploy to tomcat for that matter?
Can anyone please provide me steps that I need to take so that if I make any changes in my project I can just hit save and run and it will deploy to the tomcat OR a way in which I dont use tomcat but use maybe jetty or something else to build and test my app?
Thank you
download STS > Import your project as maven project to the new workspace > mvn install (only once to download all your dependencies) > run AS > Server > baam!
For any other eclipse version pretty much the same but you need to open the server window and configure tomcat , basically open the server tab > new > select your tomcat installation path and then .. just run it on the server. You can even modify code while running your app.
I was able to make this work using some helpers from: Running Tomcat from within Eclipse always gives me 404 (but index.html works) and following these steps:
I suspected that there was something wrong with the initial set up in eclipse. So, I closed the project in eclipse using: Right Click project > Close Project
Then I deleted any files related with eclipse from the folder. These were: .settings, .project, .classpath
I then Re-imported the project as maven project.
I used Window > Show view > server view
In the server view I created a new server and pointed it to XAMPP > tomcat since I already had tomcat.
Right click on the project > Run As > Run on Server.
It should run properly at that point in the browser as well
Make sure to check Right Click Project > Properties > Deployment Assembly - There should be Maven Dependencies added to the project and the deploy path for that should be "WEB-INF/lib"
here is a my way to debug and run maven web project with eclipse. though code is not hot deployed but it works fine for me.
Steps are as follows
open command prompt and go to your project directory. Lets say it is /opt/myhome/myproj
run mvnDebug tomcat:run command, make sure you have mvn and mvnDebug at system path
A message will be appeared like one mentioned in screenshot attached below, this states that maven is waiting for remote connection.
Now we need to Remotely connect to maven from IDE. To do that
Right click on the project and select "DebugAs" ---> "Debug configuration"
Add an new entry under Remote Java application with highlighted details and then select Debug button.
switch back to your terminal and you will get a screen like one displayed below
your web app is ready to debug, put a break point and call it and your IDE will switch to debug perspective
We are done with it. now if you make some changes in your code. you need to stop it from terminal with Ctrl-C and re-execute mvnDebug tomcat:run and then Remote Debug from IDE.
As i mentioned in starting code is not hot deployable as in local debug mode but it is pretty much better approach than rebuilding war and deploy it to external tomcat instance.
I hope this targets your query
I'm not entirely sure why this happens.
Right now I'm able to build the project without running into any issues, and it deploys to the eclipse tomcat server that I have running
So with that kept in mind, the index here is hera.jsp, which I have set in my web.xml file:
to make matters worse it seems like no matter what I try I always get this same error message:
All I can think to include to make this more complete before posting is my build path and the server settings, so here's those as well.
I had similar problem. First of all:
Check if all the sources are copied to tomcat7 webapps, especially hera/WEB-INF/web.xml.
If its not there, try to create dummy folder in your project, e.g. "hera/fix", and in your
"project properties->deployment assembly" add this folder (as a result, "hera/fix -> /" mapping should be created). This worked for me when the eclipse plugin didn't want to copy web.xml.
Check in "project properties->deployment assembly" if all needed libraries are there, if not, add them.
Check why you have problems in src in your eclipse project, as that may interrupt or conflict the dynamic project deployment from eclipse.
Hope it helps.