Dynamic web application in eclipse cannot be run on apache server - eclipse

The pic explains more.
First I added tomcat 7 server through Window > Preferences(Pic-1).
Then I created a 'Dynamic Web Project' with tomcat 7 as runtime.
When I run the project on server Apache Tomcat 7 is absent(Pic-2). Some other server is listed. I opted 'J2EE preview at localhost'.
Boom, the page shows error 500.
What may the possible cause?
!

Open the "Servers" view: "Window" -> "Show view" -> "Other" -> "Servers". After that, drag your project to the Tomcat server in that list.

Solution is:
Create a new server with Cntrl+n and select apache tomcat.
Right click and run on server.
Now Apache tomcat appears on the list. Choose it and run it.
Happy coding!

Related

Tomcat server 9.0 not starting in eclipse It showing error "Server Tomcat v9.0 Server at localhost failed to start."

Tomcat server 9.0 not starting in eclipse It showing error "Server Tomcat v9.0 Server at localhost failed to start.", I have tried everything from changing port to killing process and I also uninstalled tomcat and eclipse and installed again but it is same error, Help me with it ,or show any path to free my occupied port if it reserved ,thanks in advance for your time and help.
The most easiest solution to this problem is (this worked for me) :
Follow the steps :
1.In eclipse go to the servers tab and delete the server by right click on it and delete.
(Tomcat v9.0 Server at localhost [Stopped,Republish]).
2.Now right click there go to new then click Server.
3.Now go to Configure run time environments and select Apache Tomcat v9.0 and remove it and click ok.
4.Now click next and finish.
5.Now go to the project and try to run it using right click on the project and run as , run on Server.
That's it(this will work). I'm definitely sure this should work. Hope
this answer is helpful to you.
On the server tab click on the first line and remove (right click) any children projects that can conflict with your project

Running GWT on tomcat in eclipse

I am trying to get a GWT Project running on a Tomcat 7 server in eclipse. I installed Tomcat and i can run other web application out of eclipse on Tomcat without a problem.
Now i generated a gwt maven project for eclipse with the following command and importet it as maven project to eclipse:
"mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin"
I can run this now as Web application (with the google plugin) and i can build a "war" with maven and deploy this with the Tomcat management console on the server. Both is working. But if i choose the option in eclipse "Run on server" and choose tomcat than just the html is loaded but not the application itself. See the screenshot: It doesn't find the "GWTModule.nocache.js".
This file is available in the target folder. What do i have to change to tell tomcat to look in the correct directory?
Tomcat is not able to run GWT code in development mode. You can use Tomcat for server side code, but in this case you need to run GWT development mode with -noserver option (to prevent built-in Jetty instance from running). See this article for more details.
I would recommend using the wtp plugin for eclipse. If you do this you can add your project/resource to tomcat when adding a new server. Here are the steps to use if you already have your project imported into eclipse.
Window -> Show View -> Servers
In Servers
New -> Server -> Choose apache tomcat
Point to the location of your tomcat installation/download
Next
At this point you should be able to add your gwt-maven project which will add the target/project.war to the tomcat modules.
Save it
Click on the newly added server, then click the modules tab at the bottom kind of hard to see.
This should have your project shown in the list of web modules.
Start your tomcat instance then on your gwt application right click and choose Run As -> Web application. Make sure your configuration settings are correct and when the development server starts it should give you the development url to browse to.
You can configure some aspects of tomcat in the overview tab, I would recommend making sure that "Modules auto reload by default" is checked so that tomcat will watch the filesystem for class changes.

Eclipse + JBoss Tools won't run webapp to configured JBoss AS

I am using Eclipse 3.7.2 with JBoss Tools 3.3 under Ubuntu 12 and have configured a locally installed copy of JBoss AS 7.1.1 in Eclipse under "Preferences::Server::Runtime" Environments.
However, when trying to run a Java EE application by double-clicking on the project or an .xhtml page I only see "Run As / Run" on Server as an option and I get an HTTP 404 from Apache Tomcat/7.0.26 at localhost:8080. That is, it seems like Eclipse is trying to deploy to a Tomcat server as opposed to the JBoss AS I have configured in "Preferences::Server::Runtime" and I don't get an option like "Run on JBoss" or anything. When I export my application as a war and manually deploy to JBoss AS the app runs fine.
The idea is to add your application to a specific server that you have configured. Additionally; just adding the server runtime isn't enough.
You need to open the Servers view, and from there right click on the background and select New, and then Server. If you choose JBoss Community -> JBoss AS 7.1 here, you can select your previously created Server runtime in the Server runtime environment, or optionally create a new one.
Then comes the mental twist that you need to make. In WTP you don't use the Run As command, but instead right click the server in the Servers view (default name should be JBoss 7.1 Runtime Server, and select Add and Remove. Select one or more applications from your workspace that you would like to run on your server. Click finish when done.
Now right click again on your server, and choose either Start or Debug.

Tomcat and Eclipse server configuration

I installed tomcat on my ubuntu. When i create a new Dynamic Web Project I choose the tomcat 7 server. When I launch my page it works on localhost:8080/app/page but if I go on localhost:8080 it give me a 404 error.
If i start tomcat server with an external script like /etc/init.d/tomcat start, it works but I cannot launch my app because it says that the port 8080 is already occupied (by the other instance of tomcat).
I'm confused on how set everything, I would start tomcat at boot and link that instance for my apps.
Can you explain how I hato to do?
Open the server configuration in the Servers tab on Eclipse. On "Server Locations", mark "Use Tomcat installation".
EDIT: to be more precise, this will make Eclipse "take control" of your Tomcat folder. So it will not just make a replica on eclipse .metadata and deploy only your apps on it; instead it will be like if you ran bin/startup, but using some of the configuration defined on Servers view. So if you go localhost:8080 you will see the Welcome page, because /ROOT is now started by Eclipse.
So, I am not against "Starting/Stopping" the server from eclipse but to keep it simple, I think you can stop the server from eclipse (Click on windows/showview/Servers and then stop the server). Then I think you should not get an error if you start tomcat again from external script. Then you can right click on your dynamic web project in eclipse and export it as a war file inside tomcat-install--dir/webapps. Where your web application is available (on which context) depends on the web.xml file. If you need further info on this plz let me know.

eclipse - add tomcat

I want to add a tomcat server to eclipse.
I follow these instructions:
firstly, In Sever tabs I right click and there's New > Server
I select tomcat 7 and leave the other options default, which are host name, name, runtime environment. Here, I would expect to be prompted to specify installation path - like c:\tomcat or anything
I click finish
There's error popup - Could not load server configuration at conf.....
Thanks for helping me...
Probably missing JST Server Adapters from WTP available from eg. http://download.eclipse.org/releases/indigo.
Cft. Apache Tomcat Not Showing in Eclipse Server Runtime Environments
Worked for me. Was getting the same Could not load server configuration at conf message with Eclipse 3.7 Indigo (ColdFusion IDE).
Installed Tomcat 6 on Win 7.
Stop any Tomcat instances running.
Define a new server, choosing Tomcat 6.
Click Configure runtime environments...
Remove any environments.
Click Seach...
Point to Tomcat dir: C:\Program Files\Apache Software Foundation\Tomcat 6.0
(Should find it) Then click OK and Finish.
Start Tomcat from Eclipse.
FYI, Glassfish wasn't working for me in Eclipse so I went with Tomcat.