permaculture playing cards*
The moose likes Tomcat and the fly likes Cannot load daemon java_load failed Service exit with a return value of 3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Cannot load daemon java_load failed Service exit with a return value of 3" Watch "Cannot load daemon java_load failed Service exit with a return value of 3" New topic
Author

Cannot load daemon java_load failed Service exit with a return value of 3

Haris Hasan
Greenhorn

Joined: Feb 06, 2014
Posts: 12
I am trying to run Tomcat via daemon but I am getting this error. Any ideas what might cause this?

OS
CentOS 64Bit

Error Log

Switching umask back to 022 from 077
user changed to 'tomcat'
Using default JVM in /home/pwp-admin/jdk1.7.0_55/jre/lib/amd64/server/libjvm.so
Attemtping to load library /home/pwp-admin/jdk1.7.0_55/jre/lib/amd64/server/libjvm.so
JVM library /home/pwp-admin/jdk1.7.0_55/jre/lib/amd64/server/libjvm.so loaded
JVM library entry point found (0x36F687C0)
+-- DUMPING JAVA VM CREATION ARGUMENTS -----------------
| Version: 0x010004
| Ignore Unrecognized Arguments: False
| Extra options: 5
| "-Djava.class.path=/home/pwp-admin/apache-tomcat/bin/bootstrap.jar:/home/pwp-admin/apache-tomcat/bin/tomcat-juli.jar" (0x00000000)
| "-Dcatalina.home=/home/pwp-admin/apache-tomcat" (0x00000000)
| "-Dcatalina.base=/home/pwp-admin/apache-tomcat" (0x00000000)
| "-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager" (0x00000000)
| "-Djava.util.logging.config.file=/home/pwp-admin/apache-tomcat/conf/logging.properties" (0x00000000)
+-------------------------------------------------------
| Internal options: 4
| "-Dcommons.daemon.process.id=3292" (0x00000000)
| "-Dcommons.daemon.process.parent=3291" (0x00000000)
| "-Dcommons.daemon.version=1.0.10" (0x00000000)
| "abort" (0x00405c50)
+-------------------------------------------------------
Java VM created successfully
Class org/apache/commons/daemon/support/DaemonLoader found
Native methods registered
java_init done
Daemon loading...
Apr 22, 2014 2:27:09 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/home/pwp-admin/apache-tomcat/lib], exists: [true], isDirectory: [true], canRead: [false]
Apr 22, 2014 2:27:09 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/home/pwp-admin/apache-tomcat/lib], exists: [true], isDirectory: [true], canRead: [false]
Apr 22, 2014 2:27:09 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/home/pwp-admin/apache-tomcat/lib], exists: [true], isDirectory: [true], canRead: [false]
Apr 22, 2014 2:27:09 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/home/pwp-admin/apache-tomcat/lib], exists: [true], isDirectory: [true], canRead: [false]
java.lang.ClassNotFoundException: org.apache.catalina.startup.Catalina
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:236)
at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:308)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.commons.daemon.support.DaemonLoader.load(DaemonLoader.java:212)
Cannot load daemon
java_load failed
Service exit with a return value of 3
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951
    
  19


WARNING: Problem with directory [/home/pwp-admin/apache-tomcat/lib], exists: [true], isDirectory: [true], canRead: [false]


You can't find java classes when you can't even read the library that they live in.

Check your file access rights for the user that Tomcat is being run under.


Customer surveys are for companies who didn't pay proper attention to begin with.
Haris Hasan
Greenhorn

Joined: Feb 06, 2014
Posts: 12
I noticed this too. In order to make sure its the rights issue I have set right = 777 (temporarily) for whole tomcat folder. But still I get this error which doesn't make any sense
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951
    
  19

Do the following at a boot command prompt:


See if that helps. If it does, you are being denied by selinux and you should ideally label your tomcat files to be properly authorized under selinux. The audit2why program can help determine what the offence is.

Another possibility is if the volume that contains Tomcat is somehow marked read-only.
Haris Hasan
Greenhorn

Joined: Feb 06, 2014
Posts: 12
I am afraid it didn't change anything. And the volume is not read only
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951
    
  19

OK. Try this.

1. "su xxxx", where xxxx is the username that Tomcat runs under. You may have to use something like "su -p" if that user isn't set up to login.

2. jar -tvf TOMCAT_HOME/lib/catalina.jar", where TOMCAT_HOME is your Tomcat root directory.

If you really don't have access rights, the preceding command will fail and you need to adjust them. Otherwise it should list the classes in the catalina.jar file.
Haris Hasan
Greenhorn

Joined: Feb 06, 2014
Posts: 12
While trying to do what you suggested I found that following commands are not accessible to tomcat user while they are to root

java, javac, jar

I simply get command not found when I run jar from tomcat user
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951
    
  19



This assumes that you installed the RPM version of the JDK from Oracle.

I'm still not convinced that the open-source Java that comes with CentOS is functional enough to run J2EE, so I continue to recommend installing the Sun/Oracle JDK.
Haris Hasan
Greenhorn

Joined: Feb 06, 2014
Posts: 12
I manually downloaded and setup the JDK from Oracle site. I am not sure if tomcat user even needs access to java,jre and javac. But even if I specify root user(for testing purpose) while launching jsvc I get the same error. I have tried almost everything not sure whats wrong.

I really appreciate your help.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951
    
  19

The JDK has a copy of the JRE embedded within it.

And yes, Tomcat needs "javac". JSPs are translated (via a utility named JaSPer) into java servlets, which the java compiler compiles into servlet classes. That's why Tomcat must have the JDK and not just the JRE.

I do recommend installing the Oracle RPM over the simple archive, but either way works as long as you put the JDK/bin directory in your path when attempting to execute javac or jar.

You MUST set JAVA_HOME to point to the root directory of the JDK before running the Tomcat startup.sh or catalina.sh start. I'm not as familiar with jsvc, but I would expect the same requirements there.
Haris Hasan
Greenhorn

Joined: Feb 06, 2014
Posts: 12
ok, here is what works...

I have a user X. In home directory of X I have JDK(with jre inside), tomcat and some other things. I have a tomcat user. If I give tomcat user '5/rx' permission on home directory of X everything seem to work fine.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951
    
  19

The "x" attribute is deceitful. Although it indicates an eXecutable file, when applied to a directory, it indicates directory access permission. In other words, you cannot access a file within a directory unless the directory itself has "x" rights for your user or group ID.

755 is usually a good set of rights for something like this. Applied all the way down (recursively).

That's one of the reasons why an RPM or tarball is the preferred way to install the JDK. Both of those objects have their access flags pre-set, and their user/group ID should be root (0).
 
Consider Paul's rocket mass heater.
 
subject: Cannot load daemon java_load failed Service exit with a return value of 3
 
Similar Threads
Two sites with Tomcat 6 and Apache 2.2 (Problem)
Tomcat Startup Problem in Eclipse Helios
JVM crash with weblogic 9.2 and jdk1.5 on a Sun machine
SEVERE: Error listenerStart.................... Apache Tomcat: startup failed due to previous errors
Servlet won't run