I want to define a new server (Tomcat 7.0) in Eclipse but unfortunately, I couldn’t proceed with the steps to create the server as both the ‘Next’ and ‘Finish’ button is grayed out and the server name is blank.
As for my situation, the runtime environment was a bit messed up between the Tomcat version which I downloaded from the Apache website and the downloaded version via Ubuntu apt-get method. I had removed the version which was downloded via apt-get method but I forgotten to fix the runtime environment. In order to solve the problem, I need to access to Window -> Preferences -> Server -> Runtime Environments to fix the broken link for the server by removing the old one and update it with the new one which was downloaded from the Apache website itself.
If that is not the case for you, you can give it a try with the steps mentioned on this page: Eclipse 3.7 (Indigo) + Tomcat7 — Cannot create a server using the selected type
When I try to start the Tomcat server in Eclipse, the following stacktrace appears on the console:
Dec 7, 2012 12:59:18 AM org.apache.catalina.core.StandardContext resourcesStart
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base /Users/mychin/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Chapter1XML does not exist or is not a readable directory
- On the ‘Servers’ tab in Eclipse, right-click on the current Tomcat server and delete it.
- On the ‘Servers’ tab, right-click the white area and choose New > Server > Tomcat v6.0 Server to re-create new server.
- Restart the server again and the problem should be resolved.
If you try to deploy a web application in Intellij IDEA without specifying the location of the Tomcat standalone, Intellij IDEA will create a hidden directory in the user’s home directory and copy the Tomcat’s conf directory into the hidden directory. The file path will be as following: /home/yee/.IntelliJIdea90/system/tomcat
In order to fix the problem, you need to edit the Tomcat configuration file and add the environment variable which you can edit it via Run > ‘Edit Configuration’ > Startup/Connection tab and add the following:
The value depends on the path that you had set for the installation of the Tomcat standalone in your machine.
I just followed the steps provided by this site to install Tomcat 7 on Ubuntu:
Please remember to change the location or the site where you want to download Tomcat 7 as the provided URL is for Tomcat 6. This also depends which beta version that you are trying to install as well. You can refer to this page about this version and copy the URL and use it with the wget command. For example, I’m downloading v7.0.4-beta and the command that I’m using is:
sudo wget http://apache.hoxt.com/tomcat/tomcat-7/v7.0.4-beta/bin/apache-tomcat-7.0.4.tar.gz
Everything is working fine except when I tried to configure the Tomcat in Eclipse, I encountered a failure to start the server:
Could not load the Tomcat server configuration at /Servers/Tomcat v7.0 Server at localhost-config. The configuration may be corrupt or incomplete.
If compare with the projects that I had copied from the previous laptop, I should have the following files in the <eclipse workspace>/Servers/<Tomcat version> Server at localhost-config:
When I checked my current Eclipse workspace, the listed files do not exist in the intended directory. To resolve the problem, you need to copy those files from /usr/local/tomcat/conf directory to the intended location:
yee@chimney:/usr/local/tomcat/conf$ ls -la
drwxr-xr-x 2 root root 4096 2010-10-15 07:27 .
drwxrwxr-x 9 root root 4096 2010-10-24 12:46 ..
-rw——- 1 root root 10650 2010-10-15 07:27 catalina.policy
-rw——- 1 root root 4990 2010-10-15 07:27 catalina.properties
-rw——- 1 root root 1394 2010-10-15 07:27 context.xml
-rw——- 1 root root 3152 2010-10-15 07:27 logging.properties
-rw——- 1 root root 6268 2010-10-15 07:27 server.xml
-rw——- 1 root root 1530 2010-10-15 07:27 tomcat-users.xml
-rw——- 1 root root 51579 2010-10-15 07:27 web.xml
yee@chimney:/usr/local/tomcat/conf$ sudo cp * /home/yee/eclipseWorkspace/Servers/Tomcat v7.0 Server at localhost-config/
Also, remember to change the permission for all the files else you will still encounter the error such as:
Could not read file: /home/yee/eclipseWorkspace/Servers/Tomcat v7.0 Server at localhost-config/server.xml.
/home/yee/eclipseWorkspace/Servers/Tomcat v7.0 Server at localhost-config/server.xml (Permission denied)
That’s it. No more errors
Steps to reproduce the refactoring problem:-
- Rename the project from VoterBean to VoterBeanProject
- Redeploy the project in the Tomcat
- http://localhost:8080/VoterBean still working fine (reason is conf/server.xml has defined the path as VoterBean)
- http://localhost:8080/VoterBeanProject results HTTP Status 404
If you check in the Tomcat list for the deployed project under Server tab:
- The project name is VoterBeanProject
- The path for the project still pointing to the VoterBean – C:Program FilesApache Software FoundationTomcat 6.0webappsVoterBean
When you restart the server:
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base C:Program FilesApache Software FoundationTomcat 6.0webappsVoterBeanProject does not exist or is not a readable directory
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
- Rename the project name in the webapps directory located inside the Tomcat
- Rename docBase and path in the conf/server.xml
- Right-click the project > MyEclipse > Web
- Set the Web Context-root as the new project name
Now you can run the project as http://localhost:8080/VoterBeanProject instead of http://localhost:8080/VoterBean