Eclipse 4.2 (Juno) 'Cannot create a server using the selected type' in Tomcat 7
Asked Answered
M

8

54

I have installed:

  • eclipse juno
  • java-6-openjdk-i386 (selected as default JRE in Eclipse)
  • java-7-openjdk-i386

When I try to add a new server Tomcat7, in Eclipse, I get this message

'Cannot create a server using the selected type'

and I can not continue. No problem adding Tomcat6 server.

I read this question but it didn't solve it for me

Melvin answered 16/11, 2012 at 20:1 Comment(1)
Solved my issue on Kepler and Tomcat7 :)Undergird
M
136

1 . To fix the error 'Cannot create a server using the selected type' run the following:

cd ~/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/    
rm org.eclipse.jst.server.tomcat.core.prefs    
rm org.eclipse.wst.server.core.prefs

2 . Once you do this, another error

'Could not load the Tomcat server configuration at /usr/share/tomcat7/conf. The configuration may be corrupt or incomplete /usr/share/tomcat7/conf/catalina.policy (No such file or directory)'

So to fix this run the following commands:

cd /usr/share/tomcat7
sudo ln -s /var/lib/tomcat7/conf conf
sudo ln -s /etc/tomcat7/policy.d/03catalina.policy conf/catalina.policy
sudo ln -s /var/log/tomcat7 log
sudo chmod -R 777 /usr/share/tomcat7/conf

3 . Restart server and Eclipse

4 . Add new server

  • Choose the Servers under the Server category;
  • Create new server wizard;
  • Choose Apache / Tomcat v7.0 Server and press Next;
  • Enter /usr/share/tomcat7 into the Tomcat installation directory and press Next;
  • Select your project on the left pane under “Available” and press Add> to move it to the right pane under Configured; press Finish;

Eclipse need to start the server, and to do that, first, it has to stop the one running in background.

sudo service tomcat7 stop

If you don't have to automatically start at boot, we can use the following command

sudo update-rc.d tomcat7 disable

If, during server start, you receive warnings like:

WARNING: Problem with directory [/usr/share/tomcat7/common/classes], exists: [false], isDirectory: [false], canRead: [false]
WARNING: Problem with directory [/usr/share/tomcat7/common], exists: [false], isDirectory: [false], canRead: [false]
WARNING: Problem with directory [/usr/share/tomcat7/server/classes], exists: [false], isDirectory: [false], canRead: [false]
WARNING: Problem with directory [/usr/share/tomcat7/server], exists: [false], isDirectory: [false], canRead: [false]
WARNING: Problem with directory [/usr/share/tomcat7/shared/classes], exists: [false], isDirectory: [false], canRead: [false]
WARNING: Problem with directory [/usr/share/tomcat7/shared], exists: [false], isDirectory: [false], canRead: [false] 

You may also need to run the following:

cd /usr/share/tomcat7
sudo ln -s /var/lib/tomcat7/common common
sudo ln -s /var/lib/tomcat7/server server
sudo ln -s /var/lib/tomcat7/shared shared
Melvin answered 17/11, 2012 at 0:21 Comment(6)
Worked like a charm on Ubuntu 12.10 !Stem
Worked perfectly for the same problem with tomcat6 on Ubuntu 12.10 and Eclipse Juno.Handmaid
Worked with Eclipse Kepler, Tomcat 7 and Ubuntu 13.10Wenn
Yes! it works with tomcat8 . so just replace tomcat7 with tomcat8 in the commands. However after testing it, I still prefer reloading the website from browser. the browser gives a better wider and clearer view.Swarm
Also works fine on Ubuntu 14.04, Eclipse Mars (4.5.0) and tomcat7. ThnksGoosy
Lifesaver! Really helped me! Works on Ubuntu 14.04, Tomcat 7.0, Eclipse JunoCensurable
M
29

This is a known issue that can happens, to resolve this error, try one or all of the following:

Go to

Window–>Preferences–>Server–>Runtime Environments

and fix the broken path/link for the server.

Or rename the

org.eclipse.jst.server.tomcat.core.prefs to org.eclipse.jst.server.tomcat.core.prefs.bak

(or you can delete this file). This file can be found at \workspace\.metadata\.plugins\org.eclipse.core.runtime\.settings

Rename the

org.eclipse.wst.server.core.prefs to org.eclipse.wst.server.core.prefs.bak (or delete the file).

This file also can be found at the same location as above.

Melvin answered 10/1, 2013 at 16:49 Comment(1)
I solved the problem by editing the two files you've mentioned. They contained obsolete paths. After correcting them, everything ran smooth again.Bunting
S
2

I had Eclipse working with Tomcat for several days, then suddenly got error 'could not load tomcat server configuration may be corrupt or incomplete' - fix for me was to remove Tomcat under Windows > preferences > server > runtime Environment -- and then re-add same server, and it began working again without error -

Sunbreak answered 17/5, 2013 at 22:14 Comment(0)
G
1

Windows > preferences > server > runtime environments > add

Select your target server location

retry

Gathard answered 19/2, 2013 at 15:13 Comment(6)
When I try to add a new server Tomcat7 (the way you say) in Eclipse I get this message 'Cannot create a server using the selected type'Melvin
I didn't told you to add the server this way but to add the server runtime before adding the server. You have to install tomcat on the disk firstGathard
Ok, the server were installed before to try to add it. It was a configuration error of eclipse. Finally, I had to delete some configuration files as it is told in the other answers.Melvin
Yes it's an eclipse bug, it occured for me after i removed a previously configured server. Eclipse removed the server runtime at same time and i didn't managed to set up a new server with the same version than the deleted one until i restored the runtime the way i described.Gathard
@Gab: your answer is good but you're only repeating the answers from #8026341Murial
and ? I just explained how i solved the pb myself which imho was a simpler way than most of response i read, and i took -1 two times, people are sometimes strangesGathard
R
1

Navigate to windows->Preferences->RuntimeEnvironments, it will show you existing tomcate configuration.Click on edit button and check whether tomcat installation directory is correct or not.If the tomcat installation directory is in wrong location you will get this kind of error.

Roturier answered 2/12, 2013 at 12:27 Comment(0)
T
0

I have solution it, just correct the user rights, as in Ubuntu command: sudo chown -R yourname:yourgroup /opt/apache-tomcat-7.0.55, then restart eclipse, will be ok.

Tacita answered 28/8, 2014 at 3:11 Comment(0)
C
0

Hiii.. I got the same issue in Windows 7 OS in Eclipse JUNO version. And found the solution from the google.

When you create a server first time it will done with normal steps. But for some reason we need to delete the server. Mostally we delete from Server tab in eclipse by right click on server and click on delete. At this time the server is deleted from server tab, but not permanently delete from workspace. Because of that when we re-create the server with same version we don't able to click on next button after selecting the server version.

So here is the complete guide with screen shot, How to solve this type of issue.

http://codeofjava.blogspot.in/2014/08/solution-of-getting-error-when-re.html

Crutch answered 30/8, 2014 at 7:8 Comment(0)
B
0

i had the same issue in debian. the link bellow helped me http://crunchify.com/eclipse-how-to-fix-installing-apache-tomcat-server-issue-blank-server-name-field/

Note: the default workspace-directory of eclipse on debian is /home/userNameFolder/workspace

Bidget answered 2/4, 2015 at 5:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.