When I run my tomcat application in common environment, it works smoothly.
But when I run it in chroot environment, it throw out "Could not initialize
class sun.awt.X11FontManager" exception.

I think there miss some libraries under my chroot directory, but how to
decide which is missed ? Thanks for any advice !

Environment is
CentOS-6.4 x86_64
apache-tomcat-7.0.25/apache-tomcat-7.0.42
jdk1.7.0_04/jdk1.7.0_40

catalina.out under chroot environment,
Oct 25, 2013 1:16:39 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal
performance in production environments was not found on the
java.library.path:
/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
Oct 25, 2013 1:16:39 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8416"]
Oct 25, 2013 1:16:39 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 789 ms
Oct 25, 2013 1:16:39 AM org.apache.catalina.core.StandardService
startInternal
INFO: Starting service Catalina
Oct 25, 2013 1:16:39 AM org.apache.catalina.core.StandardEngine
startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.25
Oct 25, 2013 1:16:39 AM org.apache.catalina.loader.WebappClassLoader
validateJarFile
INFO:
validateJarFile(/home/seal/seal/web/sealverify_node/www/sealverify_node/WEB-INF/lib/javaee-api-5.jar)
- jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class:
javax/servlet/Servlet.class
Oct 25, 2013 1:16:43 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8416"]
Oct 25, 2013 1:16:43 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3683 ms
Exception in thread "Thread-21" java.lang.NoClassDefFoundError: Could not
initialize class sun.awt.X11FontManager
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:82)
        at java.security.AccessController.doPrivileged(Native Method)
        at
sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
        at java.awt.Font.getFont2D(Font.java:489)
        at java.awt.Font.access$000(Font.java:223)
        at java.awt.Font$FontAccessImpl.getFont2D(Font.java:227)
        at sun.font.FontUtilities.getFont2D(FontUtilities.java:180)
        at sun.java2d.SunGraphics2D.checkFontInfo(SunGraphics2D.java:607)
        at sun.java2d.SunGraphics2D.getFontInfo(SunGraphics2D.java:768)
        at sun.java2d.pipe.GlyphListPipe.drawString(GlyphListPipe.java:50)
        at sun.java2d.pipe.ValidatePipe.drawString(ValidatePipe.java:165)
        at sun.java2d.SunGraphics2D.drawString(SunGraphics2D.java:2829)
        at myapp.myclass1.myfunction1(my.java:344)
        ...
        (sorry, I remove the other logs dual to business.)

catalina.out under the common environment,
Oct 25, 2013 9:25:56 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal
performance in production environments was not found on the
java.library.path:
/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
Oct 25, 2013 9:25:57 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8416"]
Oct 25, 2013 9:25:57 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 790 ms
Oct 25, 2013 9:25:57 AM org.apache.catalina.core.StandardService
startInternal
INFO: Starting service Catalina
Oct 25, 2013 9:25:57 AM org.apache.catalina.core.StandardEngine
startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.25
Oct 25, 2013 9:25:57 AM org.apache.catalina.loader.WebappClassLoader
validateJarFile
INFO:
validateJarFile(/home/seal/seal/web/sealverify_node/www/sealverify_node/WEB-INF/lib/javaee-api-5.jar)
- jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class:
javax/servlet/Servlet.class
Oct 25, 2013 9:26:00 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8416"]
Oct 25, 2013 9:26:00 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3674 ms

My chroot root is /opt/chroot. I construct it referring the book "Tomcat:
The Definitive Guide, Second Editions". The tomcat default homepage worked
under the chroot environment.

# ls -l /opt/chroot/lib64/
total 5528
-rwxr-xr-x 1 root root  156912 Oct 14 16:13 ld-2.12.so
lrwxrwxrwx 1 root root      10 Oct 23 15:41 ld-linux-x86-64.so.2 ->
ld-2.12.so
lrwxrwxrwx 1 root root      15 Oct 23 15:42 libacl.so.1 -> libacl.so.1.1.0
-rwxr-xr-x 1 root root   33816 Dec  8  2011 libacl.so.1.1.0
lrwxrwxrwx 1 root root      16 Oct 23 15:43 libattr.so.1 -> libattr.so.1.1.0
-rwxr-xr-x 1 root root   21152 Sep 24  2011 libattr.so.1.1.0
-rwxr-xr-x 1 root root 1922152 Oct 14 16:13 libc-2.12.so
lrwxrwxrwx 1 root root      14 Oct 23 15:44 libcap.so.2 -> libcap.so.2.16
-rwxr-xr-x 1 root root   19016 Dec  8  2011 libcap.so.2.16
lrwxrwxrwx 1 root root      17 Oct 23 15:45 libcom_err.so.2 ->
libcom_err.so.2.1
-rwxr-xr-x 1 root root   17256 Jun 25 16:50 libcom_err.so.2.1
-rwxr-xr-x 1 root root   43392 Oct 14 16:13 libcrypt-2.12.so
lrwxrwxrwx 1 root root      16 Oct 23 15:45 libcrypt.so.1 ->
libcrypt-2.12.so
lrwxrwxrwx 1 root root      12 Oct 23 15:44 libc.so.6 -> libc-2.12.so
-rwxr-xr-x 1 root root   22536 Oct 14 16:13 libdl-2.12.so
lrwxrwxrwx 1 root root      13 Oct 23 15:46 libdl.so.2 -> libdl-2.12.so
-rw-r--r-- 1 root root     899 Aug  8 04:19 libfreebl3.chk
-rwxr-xr-x 1 root root  427008 Aug  8 04:19 libfreebl3.so
lrwxrwxrwx 1 root root      21 Oct 23 15:47 libgssapi_krb5.so.2 ->
libgssapi_krb5.so.2.2
-rwxr-xr-x 1 root root  280520 Sep 10 15:37 libgssapi_krb5.so.2.2
lrwxrwxrwx 1 root root      18 Oct 23 15:53 libk5crypto.so.3 ->
libk5crypto.so.3.1
-rwxr-xr-x 1 root root  177520 Sep 10 15:37 libk5crypto.so.3.1
lrwxrwxrwx 1 root root      18 Oct 23 15:53 libkeyutils.so.1 ->
libkeyutils.so.1.3
-rwxr-xr-x 1 root root   12592 Jun 22  2012 libkeyutils.so.1.3
lrwxrwxrwx 1 root root      14 Oct 23 15:56 libkrb5.so.3 -> libkrb5.so.3.3
-rwxr-xr-x 1 root root  944712 Sep 10 15:37 libkrb5.so.3.3
lrwxrwxrwx 1 root root      21 Oct 23 15:56 libkrb5support.so.0 ->
libkrb5support.so.0.1
-rwxr-xr-x 1 root root   46368 Sep 10 15:37 libkrb5support.so.0.1
-rwxr-xr-x 1 root root  598680 Oct 14 16:13 libm-2.12.so
lrwxrwxrwx 1 root root      12 Oct 23 15:57 libm.so.6 -> libm-2.12.so
-rwxr-xr-x 1 root root  116368 Oct 14 16:13 libnsl-2.12.so
lrwxrwxrwx 1 root root      14 Oct 23 15:57 libnsl.so.1 -> libnsl-2.12.so
-rwxr-xr-x 1 root root   27424 Oct 14 16:13 libnss_dns-2.12.so
lrwxrwxrwx 1 root root      18 Oct 23 15:57 libnss_dns.so.2 ->
libnss_dns-2.12.so
-rwxr-xr-x 1 root root   65928 Oct 14 16:13 libnss_files-2.12.so
lrwxrwxrwx 1 root root      20 Oct 23 15:58 libnss_files.so.2 ->
libnss_files-2.12.so
-rwxr-xr-x 1 root root  145720 Oct 14 16:13 libpthread-2.12.so
lrwxrwxrwx 1 root root      18 Oct 23 15:58 libpthread.so.0 ->
libpthread-2.12.so
-rwxr-xr-x 1 root root  113952 Oct 14 16:13 libresolv-2.12.so
lrwxrwxrwx 1 root root      17 Oct 23 15:59 libresolv.so.2 ->
libresolv-2.12.so
-rwxr-xr-x 1 root root   47064 Oct 14 16:13 librt-2.12.so
lrwxrwxrwx 1 root root      13 Oct 23 15:59 librt.so.1 -> librt-2.12.so
-rwxr-xr-x 1 root root  124624 May 10 17:06 libselinux.so.1
lrwxrwxrwx 1 root root      15 Oct 23 16:00 libtinfo.so.5 -> libtinfo.so.5.7
-rwxr-xr-x 1 root root  138280 Aug 18  2010 libtinfo.so.5.7
lrwxrwxrwx 1 root root      13 Oct 23 16:01 libz.so.1 -> libz.so.1.2.3
-rwxr-xr-x 1 root root   91096 Feb 22  2013 libz.so.1.2.3
drwxr-xr-x 6 root root    4096 Aug 12 12:08 qt-3.3

# ls -l /opt/chroot/usr/lib64
total 1628
lrwxrwxrwx 1 root root      18 Oct 23 16:20 libcrypto.so.10 ->
libcrypto.so.1.0.0
-rwxr-xr-x 1 root root 1665328 Mar  5  2013 libcrypto.so.1.0.0

# ls -l /opt/chroot/etc
total 112
drwxr-xr-x  4 root root  4096 Aug 12 12:08 fonts
-rw-r--r--  1 root root   882 Oct 18 18:01 group
-rw-r--r--. 1 root root   256 Aug 23 10:46 hosts
-rw-r--r--  1 root root 75425 Oct 21 13:36 ld.so.cache
-rw-r--r--  1 root root    28 May  5  2010 ld.so.conf
drwxr-xr-x  2 root root  4096 Oct 21 13:33 ld.so.conf.d
-rw-r--r--  1 root root  1688 May  5  2010 nsswitch.conf
-rw-r--r--  1 root root  1810 Oct 18 18:01 passwd
-rw-r--r--  1 root root    70 Aug 23 15:40 resolv.conf
----------  1 root root  1089 Oct 18 18:01 shadow



Best Regards,

SUN Guonian

Reply via email to