Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Configuring a server for a friend, first time I've dealt with Tomcat and I'm close to tearing what little hair I have left, out :)

For his project he needs to use a PHP Java Bridge, I've got the server to the point that Tomcat6 is installed and running, as is the bridge. He can access it via a localhost call like this:

<?php require_once("http://localhost:8080/JavaBridge/java/");?> 

This all works fine.

[root@server home]# wget -q http://localhost:8080/JavaBridge/java/
[root@server home]# ls | grep

Service is running nicely:

[root@server home]# ps ax | grep tomcat
44747 ?        Sl     0:03 /usr/lib/jvm/java/bin/java -classpath :/usr/share/tomcat6/bin/bootstrap.jar:/usr/share/tomcat6/bin/tomcat-juli.jar:/usr/share/java/commons-daemon.jar -Dcatalina.base=/usr/share/tomcat6 -Dcatalina.home=/usr/share/tomcat6 -Djava.endorsed.dirs= -Djava.util.logging.config.file=/usr/share/tomcat6/conf/ -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager org.apache.catalina.startup.Bootstrap start
[root@server home]# /etc/init.d/tomcat6 status
tomcat6 (pid 44747) is running...

Now, if we ever need to restart - I'm getting this:

[root@server home]# /etc/init.d/tomcat6 restart
Stopping tomcat6:                                          [FAILED]
Starting tomcat6:                                          [  OK  ]

Somewhat perplexing, if I kill the pid and then start I end up with

[root@server tomcat6]# /etc/init.d/tomcat6 start
: command not found6.conf: line 10: 
: command not found6.conf: line 13: 
: command not found6.conf: line 19: 
: command not found6.conf: line 22: 
: command not found6.conf: line 25: 
: command not found6.conf: line 28: 
: command not found6.conf: line 31: 
: command not found6.conf: line 34: 
: command not found6.conf: line 37: 
: command not found6.conf: line 40: 
: command not found6.conf: line 43: 
: command not found6.conf: line 46: 
Starting tomcat6: chown: `tomcat\r:tomcat\r': invalid user
chown: `tomcat\r:tomcat\r': invalid user does not exist, creating
ln: creating symbolic link `/usr/share/tomcat6\r/work' to `/var/cache/tomcat6': No such file or directory
ln: creating symbolic link `/usr/share/tomcat6\r/temp' to `/var/tmp/tomcat6': No such file or directory
chown: `tomcat\r:tomcat\r': invalid user

Any ideas?

Much appreciated :)

share|improve this question
up vote 1 down vote accepted

To me this sounds like someone has edited /etc/init.d/tomcat6 script in some Windows text editor and now the script has DOS line feeds instead of Unix line feeds, which confuses the init system.

Use file /etc/init.d/tomcat6 to check if this is true. If it is, use for example dos2unix /etc/init.d/tomcat6 to convert the file to Unix line feeds.

share|improve this answer
Seems ok:[root@server home]# file /etc/init.d/tomcat6 /etc/init.d/tomcat6: Bourne-Again shell script text executable – foxed Nov 10 '10 at 11:10
Double-check with cat -vT /etc/init.d/tomcat6 -- if you see ^M characters at the end of the lines, then it's in DOS format. I still suspect this due the \r stuff going on in your 'screenshot' :) – Janne Pikkarainen Nov 10 '10 at 11:11
Nope, definitely ok. Ran it through dos2unix just to be safe - same issues. – foxed Nov 10 '10 at 11:23
If you manually inspect that file, are there those \r characters all around, then? – Janne Pikkarainen Nov 10 '10 at 11:31
Oh! Now I got it. Most likely some of your Tomcat configuration files are in DOS format. Do check those next. :) – Janne Pikkarainen Nov 10 '10 at 11:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.