Start Tomcat Server In Eclipse

Greenhorn
posted 12 years ago

Open Eclipse Environment Click on Servers Tab Click on No servers are available. Click this link to create a new server. Adding an existing installation of Tomcat In Eclipse IDE, go to menu Window Preferences. Then expand the Server Runtime Environments node in the Preferences dialog: Click Add to add a new server runtime environment. Open Eclipse IDE. Open Window - Preferences - Server - Install Runtimes to create server runtime. Then click on Add button to open the New Server Runtime window. Then select your Apache Tomcat Server version that is under the Apache Folder. You should see Tomcat v9.0 Server at localhost Stopped, Republish under Servers tab. Double click on it and verify the HTTP ports. By default HTTP/1.1 port is 8080. If there is any application running on default port 8080 then change it to any other port. Step 7: Now right click on Server and click Start.

  • Optional 'thank-you' note:
Hi, i did have java, tomcat, etc installed and working fine. just recently i installed some SFTP software to setup a Virtual Machine with a similar setup, since returning to my IDE (Eclipse Ganymede) i am unable to start a tomcat 6 server on localhost.
I've since uninstalled everything java and installed the following:
Java 6u7
Java SE Dev kit 6u7
Apache Tomcat 6
The following are set in my env variables:
BASEDIR c:apache-tomcat-6.0.16
CATALINA_BASE c:apache-tomcat-6.0.16
CATALINA_HOME c:apache-tomcat-6.0.16
CLASSPATH C:Program FilesJavajdk1.6.0_07;C:Program FilesJavajdk1.6.0_07bin;C:Program FilesJavajdk1.6.0_07lib;C:Program FilesJavajdk1.6.0_07include; <other stuff removed>
JAVA_HOME C:Program FilesJavajdk1.6.0_07
JRE_HOME C:Program FilesJavajre1.6.0_07bin
PATH %SystemRoot%system32;%SystemRoot%;%SystemRoot%System32Wbem ${ant.home}/bin;C:Program FilesJavajdk1.6.0_07bin;
When i run 'Tomcat Manager' (Start > programs > tomcat 6 > monitor tomcat) I get the icon in the taskbar, this tells me that service is manual startup and stopped (as i want it to be), if i tell this to start and check the logs it seems to have started successfully however i am unable to connect to it (windows firewall is disabled, no other firewalls) ie, http://localhost/ does not do anything :-( of course i've edited the server.xml file to use port 80 not 8080 but this problem was there even before that.
What i am actually trying to do is to get this server to work again from within Eclipse. I created a new server within Eclipse (Apache Tomcat 6 on localhost), and then told the server to start. this results in the following (very unlike when i run it from tomcat manager):
20-Aug-2008 17:23:08 org.apache.jk.common.ChannelSocket acceptConnections
WARNING: Exception executing accept
java.net.SocketException: select failed
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(Unknown Source)
at java.net.ServerSocket.implAccept(Unknown Source)
at java.net.ServerSocket.accept(Unknown Source)
at org.apache.jk.common.ChannelSocket.accept(ChannelSocket.java:306)
at org.apache.jk.common.ChannelSocket.acceptConnections(ChannelSocket.java:660)
at org.apache.jk.common.ChannelSocket$SocketAcceptor.runIt(ChannelSocket.java:870)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Unknown Source)
This message is repeated until the Tomcat timeout is reached.
As a test i tried starting the server from tomcat manager and then starting it again from eclipse, the following log shows tomcat manager starting tomcat just fine:
20-Aug-2008 17:29:01 org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.14.
20-Aug-2008 17:29:01 org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [false], sendfile [true], accept filters [false], random [true].
20-Aug-2008 17:29:01 org.apache.coyote.http11.Http11AprProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-80
20-Aug-2008 17:29:01 org.apache.coyote.ajp.AjpAprProtocol init
INFO: Initializing Coyote AJP/1.3 on ajp-8009
20-Aug-2008 17:29:01 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1129 ms
20-Aug-2008 17:29:02 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
20-Aug-2008 17:29:02 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.18
20-Aug-2008 17:29:02 org.apache.coyote.http11.Http11AprProtocol start
INFO: Starting Coyote HTTP/1.1 on http-80
20-Aug-2008 17:29:02 org.apache.coyote.ajp.AjpAprProtocol start
INFO: Starting Coyote AJP/1.3 on ajp-8009
20-Aug-2008 17:29:02 org.apache.catalina.startup.Catalina start
INFO: Server startup in 1006 ms
20-Aug-2008 17:32:39 org.apache.coyote.http11.Http11AprProtocol pause
INFO: Pausing Coyote HTTP/1.1 on http-80
20-Aug-2008 17:32:39 org.apache.coyote.ajp.AjpAprProtocol pause
INFO: Pausing Coyote AJP/1.3 on ajp-8009
20-Aug-2008 17:32:40 org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
20-Aug-2008 17:32:40 org.apache.coyote.http11.Http11AprProtocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-80
20-Aug-2008 17:32:40 org.apache.coyote.ajp.AjpAprProtocol destroy
INFO: Stopping Coyote AJP/1.3 on ajp-8009
20-Aug-2008 17:34:45 org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.14.
20-Aug-2008 17:34:45 org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [false], sendfile [true], accept filters [false], random [true].
20-Aug-2008 17:34:45 org.apache.coyote.http11.Http11AprProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-80
20-Aug-2008 17:34:45 org.apache.coyote.ajp.AjpAprProtocol init
INFO: Initializing Coyote AJP/1.3 on ajp-8009
20-Aug-2008 17:34:45 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1223 ms
20-Aug-2008 17:34:45 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
20-Aug-2008 17:34:45 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.18
20-Aug-2008 17:34:46 org.apache.coyote.http11.Http11AprProtocol start
INFO: Starting Coyote HTTP/1.1 on http-80
20-Aug-2008 17:34:46 org.apache.coyote.ajp.AjpAprProtocol start
INFO: Starting Coyote AJP/1.3 on ajp-8009
20-Aug-2008 17:34:46 org.apache.catalina.startup.Catalina start
INFO: Server startup in 1015 ms
which of course, with this started i cannot start another instance of the server on the same ports, the error tells me that some of the ports are already in use.
Ok, so whats going on here?
problem 1) I cant connect to http://localhost/ and view the Tomcat main pages when it has clearly started fine using tomcat manager
problem 2) I cant get Eclpse to start the Tomcat server successfully on its own.
Both of these are things that i could do before.
There are no unusual services running in windows services and no unusual tasks in taskmanager. there are definitely not any other web servers or similar running on this machine.
any help, much appreciated. PS> Winxp SP3 (it was SP3 before too so this cant be the issue)
Regards, George St. Clair
[ August 26, 2008: Message edited by: george st. clair ]
[ August 26, 2008: Message edited by: Bear Bibeault ]
[ August 28, 2008: Message edited by: george st. clair ]
[ August 28, 2008: Message edited by: george st. clair ]

I don't suffer from insanity, i enjoy every minute of it.

Greenhorn
posted 12 years ago
  • Optional 'thank-you' note:
Please help. I need this working desperately!

I don't suffer from insanity, i enjoy every minute of it.

Greenhorn
posted 12 years ago
  • Optional 'thank-you' note:
Try :

At least we can be sure no ports are already in use.
Greenhorn
Start Tomcat Server In Eclipseposted 12 years ago
  • Optional 'thank-you' note:
Hi Mario,
before i start the tomcat server netstat shows that nothing is using 8080 in any way. After I've started tomcat then the following is happening on those ports:
TCP MAGNESIUM:8009 magnesium:0 LISTENING
TCP MAGNESIUM:8080 magnesium:0 LISTENING

I don't suffer from insanity, i enjoy every minute of it.

Greenhorn
posted 12 years ago
  • Optional 'thank-you' note:

Originally posted by george st. clair:
Hi Mario,
before i start the tomcat server netstat shows that nothing is using 8080 in any way. After I've started tomcat then the following is happening on those ports:
TCP MAGNESIUM:8009 magnesium:0 LISTENING
TCP MAGNESIUM:8080 magnesium:0 LISTENING


Then, if port 8080 is listening, you should be able to open http://localhost:8080/[webapp-name]
If you have not deployed an application yet you should get a 404 error, which is fine (means tomcat is working, even if you don't find the page).
Greenhorn
posted 12 years ago
  • Optional 'thank-you' note:
I've found out that http://localhost:8080 does not work, however http://127.0.0.1:8080 works fine.
This is when i start Tomcat 6 from Tomcat Manager.
I dont mind using 127.0.0.1 rather than localhost, thats not a problem for me however i wish to start Tomcat (and deploy apps) from Eclipse. This is not working.
from having Tomcat started (and working) i first stop the server and then in eclipse add a new server and start it. i get the following:
26-Aug-2008 16:05:57 org.apache.tomcat.util.net.JIoEndpoint$Acceptor run
SEVERE: Socket accept failed
java.net.SocketException: select failed
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
at java.net.ServerSocket.implAccept(ServerSocket.java:453)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(DefaultServerSocketFactory.java:61)
at org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(JIoEndpoint.java:310)
at java.lang.Thread.run(Thread.java:619)
26-Aug-2008 16:05:57 org.apache.jk.common.ChannelSocket acceptConnections

I don't suffer from insanity, i enjoy every minute of it.

Greenhorn
posted 12 years ago
  • Optional 'thank-you' note:
Try tcpview TCP View (download), I suspect you have rather some TCP problem then eclipse/tomcat problem.
With tcp view you can 'see' what socket your apps try to open, so you may understand what is failing.
Other then that I think I can't help much more, being a problem of a specific machine, you can do so much without having access to the machine itself.

Eclipse Tomcat Server

Greenhorn
posted 12 years ago
  • Optional 'thank-you' note:
thanks for your help Mario, unfortunately i am unable to rectify this problem still, there appears ot be no problems opening ports according to tcp view.
oddly enough i've just tried to run an axis2 server and encountered the exact same error, lucky me.

I don't suffer from insanity, i enjoy every minute of it.

Greenhorn
posted 12 years ago
  • Optional 'thank-you' note:
problem solved - Uninstall Microsoft TCP/IP v6.

I don't suffer from insanity, i enjoy every minute of it.

Greenhorn

Can't Start Tomcat Server In Eclipse

posted 12 years ago
  • Optional 'thank-you' note:
********** This worked for me BOSS **********
Now the point is to take this issue to Sun Java.... Also this issue require to be circulated on many of Java community web-site.
Believe me I'm struggling to get around on this problme since May 2008 and here you come to save my opinion about Java.
Due to this Ms IPv6 I always face problem with Java based server and ONLY with Java based servers. That means there is problem in JVM/JRE and require to bring into knowledge of Java community before people start cursing Java.
I really don't know any of 'influncial' Java community member hence requesting somebody to pick-up this issue seriously and quickly.
You can also see one on my Java support post, which is in same line of BUG. Unfortunately I got internal review ID of 1259803. Even though with follow-up I couldnot got response from them.

Configure MySQL, Eclipse and Tomcat for Use with jQWidgets

In this help topic you will learn how to create a sample MySQL database and configure the Eclipse IDE and the Apache Tomcat server before creating your first jQWidgets example in the Java environment.

1. Set Up a Database

For the purposes of this tutorial, we will be using the MySQL version of the Northwind database.

Unable To Start Tomcat Server In Eclipse

  1. Start the MySQL Command Line Client. Then create a new database by running the following line:
    CREATE DATABASE northwind;
  2. Select the database for use:
    USE northwind
  3. Finally, populate it from the file northwind.sql
    source C:/path/northwind.sql
    where C:/path is the path to the folder you extracted the file to.

You now have the northwind database ready for use and manipulation.

Eclipse create tomcat server

2. Create a New Project in Eclipse

In this tutorial, we will be using Eclipse IDE for Java EE Developers, version Luna. You can get it from here: https://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/lunasr2. Run Eclipse and go to FileNewDynamic Web Project. In the window that appears, type the project's name (we will name it 'jQWidgetsJSP') and click Finish.

3. Add Necessary Classes to the Java Build Path

Several Java class packages (.jar files) are necessary for the jQWidgets examples and have to be included in the Java build path. These are:

  • java-rt-jar-stubs-1.5.0.jar - contains all of the compiled class files for the base Java Runtime Environment.
  • mysql-connector-java-5.1.34-bin.jar - MySQL Connector/J is the official JDBC driver for MySQL. It is necessary for the connection to the MySQL database.
  • gson-2.3.1.jar- Gson is a Java library that can be used to convert Java Objects into their JSON representation.

Here is how to add these to the Eclipse project:

  1. Right-click on the project and click Properties:
  2. Select Java Build Path on the left and then the Libraries tab:
  3. Click Add External JARs... and browse for the aforementioned files. Note: in this case, the Java Runtime Environment classes are already present in JRE System Library and we do not need to include them again.

The added JARs should appear in Java ResourcesLibraries and be ready for use:

4. Add the Necessary jQWidgets Scripts and Stylesheets to the Project

Create two folders in the project folder WebContent - js and css. Include in them all (or only the necessary) jQWidgets files - the scripts (including jqxcore.js and the specific widget files) in js and the stylesheets (jqx.base.css and any themes and associated images) in css. Remember to include a version of jQuery in js, too.

5. Configure the Apache Tomcat Server

Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies. We will be using Tomcat 8.0 in this tutorial. If you do not already have Apache Tomcat on your system, download it from here: http://tomcat.apache.org/download-80.cgi and install it. Then:

Start tomcat server without eclipse
  1. In Eclipse, go to WindowPreferences. Choose ServerRuntime Environments on the left:
  2. Click Add. In the window that appears, choose Apache Tomcat v8.0 and check Create a new local server:
  3. Click Next, browse for the Tomcat installation directory, then click Finish and OK in the previous window:
  4. Right-click the project and choose Properties. In the Properties window, select Project Facets on the left and then the tab Runtimes on the right. Check Apache Tomcat v8.0. Finally, click Apply and OK.

6. Start the Server and Configure Its Classpath

  1. In the bottom panel of Eclipse, select the Servers tab.
  2. Right-click on Tomcat v8.0 Server at localhost and click Start:
  3. Go to RunRun Configurations...
  4. In the pop-up window, select Apache TomcatTomcat v8.0 Server at localhost on the left and then the Classpath tab. Add the external JARs mysql-connector-java-5.1.34-bin.jar and gson-2.3.1.jar:
  5. Apply the settings and click Close.

Start Tomcat Server In Eclipse

Your project is now set up and you can proceed with any of the following tutorials showcasing jQWidgets components loaded through JSP: