You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Lee Hammond <Lh...@cqmltd.co.uk> on 2005/03/17 21:51:59 UTC

System ClassLoader problem on Linux running Hipergate on Tomcat?

Apologies, I've put a lot in this email so that hopefully my rescuer won't
have to in theirs...

This is probably such a dumb problem I deserve to be shot, but I'm stuck and
I have no support and I'm desperately trying to migrate one machine in this
office so that we don't have to shell out for more expensive proprietary
lock-in rubbish (here a CRM).

Machine i686, OS RedHat 9...

I'm trying to get Hipergate up and running, for which I need Java (RE and
DK) and Tomcat. I've never set up a web server before and always had a
nightmare with Java - which I like in theory, but find infuriatingly
bloated. Well, I've got J2EE in it's default place /opt/ and Tomcat 5.0.30
in /opt too and everything is now working fine. The Tomcat admin pages come
up okay, I can log in and I can 'run' the example JSP pages. I've even got
Hipergate deployed on Tomcat and can see it's login page. But that's as far
as I go... As soon as I hit login I get error(s) of the form:

	HTTP Status 500 -
	
	type Exception report
	
	message
	
	description The server encountered an internal error () that
prevented it from fulfilling this request.
	
	exception
	
	org.apache.jasper.JasperException: Unable to compile class for JSP
	
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandle
r.java:97)
	
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:3
46)
	
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:439)
	
org.apache.jasper.compiler.Compiler.compile(Compiler.java:497)
	
org.apache.jasper.compiler.Compiler.compile(Compiler.java:476)
	
org.apache.jasper.compiler.Compiler.compile(Compiler.java:464)
	
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:5
11)
	
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
95)
	
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
		javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	
	root cause
	
	Unable to find a javac compiler;
	com.sun.tools.javac.Main is not on the classpath.
	Perhaps JAVA_HOME does not point to the JDK
	
org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(C
ompilerAdapterFactory.java:105)
		org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:929)
		org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:758)
	
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:407)
	
org.apache.jasper.compiler.Compiler.compile(Compiler.java:497)
	
org.apache.jasper.compiler.Compiler.compile(Compiler.java:476)
	
org.apache.jasper.compiler.Compiler.compile(Compiler.java:464)
	
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:5
11)
	
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
95)
	
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
		javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	
	note The full stack trace of the root cause is available in the
Apache Tomcat/5.0.30 logs.

FYI the said stack trace looks like this:

[root@localhost opt]# tail -50
jakarta-tomcat-5/jakarta-tomcat-5.0.30/logs/localhost_log.2005-03-17.txt
	2005-03-17 14:38:50 StandardContext[/jsp-examples]SessionListener:
attributeAdded('AA89D380700D2E70151385DD9E96D9EE', 'theTruth', 'true')
	2005-03-17 14:39:13 StandardContext[/jsp-examples]SessionListener:
attributeAdded('AA89D380700D2E70151385DD9E96D9EE',
'javax.servlet.jsp.jstl.fmt.request.charset', 'UTF-8')
	2005-03-17 14:40:10
StandardContext[/servlets-examples]InvokerFilter(ApplicationFilterConfig[nam
e=Path Mapped Filter, filterClass=filters.ExampleFilter]): 5
	milliseconds
	2005-03-17 14:40:14
StandardContext[/servlets-examples]InvokerFilter(ApplicationFilterConfig[nam
e=Path Mapped Filter, filterClass=filters.ExampleFilter]): 7
	milliseconds
	2005-03-17 14:44:48 StandardContext[/manager]HTMLManager: list:
Listing contexts for virtual host 'localhost'
	2005-03-17 14:45:03 StandardWrapperValve[jsp]: Servlet.service() for
servlet jsp threw exception
	Unable to find a javac compiler;
	com.sun.tools.javac.Main is not on the classpath.
	Perhaps JAVA_HOME does not point to the JDK
	        at
org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(C
ompilerAdapterFactory.java:105)
	        at
org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:929)
	        at
org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:758)
	        at
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:407)
	        at
org.apache.jasper.compiler.Compiler.compile(Compiler.java:497)
	        at
org.apache.jasper.compiler.Compiler.compile(Compiler.java:476)
	        at
org.apache.jasper.compiler.Compiler.compile(Compiler.java:464)
	        at
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:5
11)
	        at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
95)
	        at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	        at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
	        at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:252)
	        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
	        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:214)
	        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
	        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	        at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext
Valve.java:198)
	        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:152)
	        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
	        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137
)
	        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
	        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118
)
	        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:102)
	        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:109)
	        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
	        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
	        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
	        at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
	        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
	        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:705)
	        at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
	        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:684)
	        at java.lang.Thread.run(Thread.java:534)
	 
	2005-03-17 15:10:08 StandardContext[/jsp-examples]SessionListener:
sessionDestroyed('AA89D380700D2E70151385DD9E96D9EE')
	2005-03-17 15:10:08 StandardContext[/jsp-examples]SessionListener:
attributeRemoved('AA89D380700D2E70151385DD9E96D9EE', 'table',
'cal.TableBean@2515')
	2005-03-17 15:10:08 StandardContext[/jsp-examples]SessionListener:
attributeRemoved('AA89D380700D2E70151385DD9E96D9EE',
'javax.servlet.jsp.jstl.fmt.request.charset', 'UTF-8')
	2005-03-17 15:10:08 StandardContext[/jsp-examples]SessionListener:
attributeRemoved('AA89D380700D2E70151385DD9E96D9EE', 'theTruth', 'true')

It seems to be a system classLoader problem, which (according to:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html
"System - This class loader is normally initialized from the contents of the
CLASSPATH environment variable. All such classes are visible to both Tomcat
internal classes, and to web applications." where: "However, the standard
Tomcat 4 startup scripts ($CATALINA_HOME/bin/catalina.sh or
%CATALINA_HOME%\bin\catalina.bat) totally ignore the contents of the
CLASSPATH environment variable itself" (bizarre?!). Is Tomcat 5 the same?
Besides I'm running from the command: 

[root@localhost (in tomcat root)]# ./bin/jsvc
-Djava.endorsed.dirs=./common/endorsed -Dfile.encoding=UTF-8 -cp
./bin/bootstrap.jar -outfile ./logs/catalina.out -errfile
./logs/catalina.err org.apache.catalina.startup.Bootstrap

Running bin/startup.sh crashes my shell (for the same reason as this issue I
think).

I've tried numerous combinations of CLASSPATH(S), PATH(S) and JAVA_HOME
variables in different orders to no avail. I've also updated /etc/profile so
that these are global and persistent.

The variables are currently set at:

	PATH=$PATH:/opt/SUNWappserver/bin
	JAVA_HOME=/opt/SUNWappserver/jdk
	CLASSPATH=/opt/SUNWappserver/jdk (tried lots of others
simulataneously)
	LD_ASSUME_KERNEL="2.2.5"

The contents of which are:

[root@localhost opt]# ls -l /opt/SUNWappserver/jdk/
	total 88
	drwxr-xr-x	bin
	-rw-r--r--	COPYRIGHT
	drwxr-xr-x	demo
	drwxr-xr-x	include
	drwxr-xr-x	jre
	drwxr-xr-x	lib
	-rw-r--r--	LICENSE
	drwxr-xr-x	man
	-rw-r--r--	README
	-rw-r--r--	README.html
	-rw-r--r--	THIRDPARTYLICENSEREADME.txt
	
[root@localhost opt]# ls -l /opt/SUNWappserver/jdk/bin
	total 1732
	-r-xr-xr-x	66420		appletviewer
	-r-xr-xr-x	66156		extcheck
	-r-xr-xr-x	 1080		HtmlConverter
	-r-xr-xr-x	66188		idlj
	-r-xr-xr-x	66156		jar
	-r-xr-xr-x	66156		jarsigner
	-r-xr-xr-x	64940		java
	-r-xr-xr-x	66156		javac
	-r-xr-xr-x	66156		javadoc
	-r-xr-xr-x	66156		javah
	-r-xr-xr-x	66156		javap
	-r-xr-xr-x	 1789		java-rmi.cgi
	-r-xr-xr-x	66156		jdb
	-r-xr-xr-x	66156		keytool
	-r-xr-xr-x	66188		kinit
	-r-xr-xr-x	66188		klist
	-r-xr-xr-x	66188		ktab
	-r-xr-xr-x	66156		native2ascii
	-r-xr-xr-x	66380		orbd
	-r-xr-xr-x	66420		policytool
	-r-xr-xr-x	66156		rmic
	-r-xr-xr-x	66156		rmid
	-r-xr-xr-x	66156		rmiregistry
	-r-xr-xr-x	66156		serialver
	-r-xr-xr-x	66188		servertool
	-r-xr-xr-x	66188		tnameserv

(how are these all similar sizes?)

[root@localhost opt]# ls -l /opt/SUNWappserver/jdk/lib
	total 6324
	-rw-r--r--	dt.jar
	-rw-r--r--	htmlconverter.jar
	-rw-r--r--	ir.idl
	-rw-r--r--	orb.idl
	-rw-r--r--	tools.jar

Realising that Java isn't JavaScript I've pointed CLASSPATH to
$CATALINA_HOME/common/lib and the like - all that kind of thing. The
contents of two important ones are like:

[root@localhost jakarta-tomcat-5.0.30]# ls -l common/lib
	total 2532
	-rw-r--r--	ant.jar
	-rw-r--r--	ant-launcher.jar
	-rw-r--r--	commons-collections-3.1.jar
	-rw-r--r--	commons-dbcp-1.2.1.jar
	-rw-r--r--	commons-el.jar
	-rw-r--r--	commons-pool-1.2.jar
	-rw-r--r--	jasper-compiler.jar
	-rw-r--r--	jasper-runtime.jar
	-rw-r--r--	jsp-api.jar
	-rw-r--r--	naming-common.jar
	-rw-r--r--	naming-factory.jar
	-rw-r--r--	naming-java.jar
	-rw-r--r--	naming-resources.jar
	-rw-r--r--	servlet-api.jar

[root@localhost ((tomcat)/webapps/)hipergate]# ls -l WEB-INF/lib/
	total 15560
	-rw-rw-rw-	beanshell.bsh-2.0b1.jar
	-rw-rw-rw-	hipergate-2.1.16.jar
	-rw-rw-rw-	ibm.bsf-2.2.jar
	-rw-rw-rw-	j2ee.jar
	-rw-rw-rw-	jaf-1.0.2.jar
	-rw-rw-rw-	jakarta-oro-2.0.8.jar
	-rw-rw-rw-	javamail-1.3.2.jar
	-rw-rw-rw-	jcp.portlet-1.0.jar
	-rw-rw-rw-	jdbc2_0-stdext.jar
	-rw-rw-rw-	lucene-1.4-final.jar
	-rw-rw-rw-	msbase.jar
	-rw-rw-rw-	mssqlserver.jar
	-rw-rw-rw-	msutil.jar
	-rw-rw-rw-	novell.ldap.jar
	-rw-rw-rw-	oracle10g.jdbc3.jar
	-rw-rw-rw-	pg74.215.jdbc3.jar
	-rw-rw-rw-	poi-2.5-final-20040302.jar
	-rw-rw-rw-	poi-contrib-2.5-final-20040302.jar
	-rw-rw-rw-	poi-scratchpad-2.5-final-20040302.jar
	-rw-rw-rw-	sun.jai-1.1.2-clibwrapper_jiio.jar
	-rw-rw-rw-	sun.jai-1.1.2-jai_codec.jar
	-rw-rw-rw-	sun.jai-1.1.2-jai_core.jar
	-rw-rw-rw-	sun.jai-1.1.2-jai_imageio.jar
	drwxrwxrwx	sun.jai-1.1.2-linux-i386
	-rw-rw-rw-	sun.jai-1.1.2-mlibwrapper_jai.jar
	drwxrwxrwx	sun.jai-1.1.2-windows-i386
	-rw-rw-rw-	xalan.jar
	-rw-rw-rw-	xercesImpl-2.6-2.jar
	-rw-rw-rw-	xmlParserAPIs-2.6-2.jar

So I feel I've got javac and jasper covered one way or another. What's
happening!?

Is it not the case that all this type of configuration problem (for which
I've seen a lot of material on the web) are just file location management
issues? Surely this is the sort of problem a 'minor' configuration script
can help everybody with? I'd write it myself if I had the insider knowledge.

Now I've tried explicitly putting every *.jar file in the whole /opt tree
onto CLASSPATH! Now I know I'm missing 'something crucial'.

One last thing... what is it? Tomcat or Catalina? They're both great names,
but in combination it just says: c o n f u s i n g   t o   u s e r s. OK,
maybe it's just me.

I love all Apache / open source efforts, so please don't see this as a
complaint; it's great work.

Regards,

Lee

(I'll migrate some of this office to open source even if it kills me.)