PDA

View Full Version : Runtime problems with tomcat v5.0


christine
03-26-2004, 01:17 PM
I installed the LPS core only (v2.1.1) into an existing tomcat v5.0 installation (from jwsdp). I followed the special instructions under "Tomcat Installation Issues", including copying the xalan jar to common/endorsed.

But, I get the following error in the log when I try to verify the install:

26 Mar 2004 16:46:37 () INFO servlets.LZServlet - LPS destroyed in context: lps-2.1.1
26 Mar 2004 16:48:16 () INFO servlets.LZServlet - ------------------------------------
26 Mar 2004 16:48:16 () INFO servlets.LZServlet - Laszlo Presentation Server, 2.1.1, initialized
26 Mar 2004 16:48:16 () INFO servlets.LZServlet - Running in context:Java Web Services Developer Pack/1.3
26 Mar 2004 16:48:16 () INFO servlets.LZServlet - Build: lps-2.1.1-000861-0001
26 Mar 2004 16:48:16 () INFO servlets.LZServlet - Built on: 04:10 PM 12-Mar-2004
26 Mar 2004 16:48:16 () INFO servlets.LZServlet - Expires: NEVER
26 Mar 2004 16:48:16 () INFO servlets.LZServlet - Running against JRE 1.4.2
26 Mar 2004 16:48:16 () INFO servlets.LZServlet - Running with Java CLASSPATH: C:\jwsdp-1.3\jwsdp-shared\bin\commons-launcher.jar;C:\j2sdk\j2sdk1.4.2\lib\tools.jar;C:\ jwsdp-1.3\bin;C:\jwsdp-1.3\bin\bootstrap.jar;C:\j2sdk\j2sdk1.4.2\lib\tool s.jar;C:\j2sdk\j2sdk1.4.2\jre\lib\ext\localedata.j ar;C:\jwsdp-1.3\jstl\tld;C:\j2sdk\j2sdk1.4.2\jre\lib\ext\acces s-bridge.jar;C:\j2sdk\j2sdk1.4.2\jre\lib\ext\jaccess .jar
26 Mar 2004 16:48:16 () INFO servlets.LZServlet - Running on Windows 2000 5.0
26 Mar 2004 16:48:16 () INFO servlets.LZServlet - Running as user ch3885
26 Mar 2004 16:48:16 () INFO servlets.LZServlet - Total memory: 22.37 MB
26 Mar 2004 16:48:16 () INFO servlets.LZServlet - Available memory: 6.27 MB
26 Mar 2004 16:48:16 () INFO servlets.LZServlet - LPS_HOME is: C:\jwsdp-1.3\webapps\lps-2.1.1\
26 Mar 2004 16:48:16 () INFO server.License - Localhost (SALTLAKECITY) IP: 139.68.138.5
26 Mar 2004 16:48:16 () INFO server.License - Server IP(s): 127.0.0.1
26 Mar 2004 16:48:16 () INFO server.License - LPS developer license
26 Mar 2004 16:48:16 () INFO responders.ResponderCompile - Cache is at C:\jwsdp-1.3\work\Catalina\localhost\lps-2.1.1\LPS\cache
26 Mar 2004 16:48:16 () INFO responders.ResponderMEDIA - Media Cache is at C:\jwsdp-1.3\work\Catalina\localhost\lps-2.1.1\LPS\mcache
26 Mar 2004 16:48:17 () INFO responders.ResponderDATA - Data Cache is at C:\jwsdp-1.3\work\Catalina\localhost\lps-2.1.1\LPS\dcache
26 Mar 2004 16:48:17 (127.0.0.1 1) INFO servlets.LZServlet - Request for C:\jwsdp-1.3\webapps\lps-2.1.1\\examples\contactlist\contactlist.lzx
26 Mar 2004 16:48:17 (127.0.0.1 1) INFO responders.ResponderCompile - Cache is at C:\jwsdp-1.3\work\Catalina\localhost\lps-2.1.1\LPS\cache
26 Mar 2004 16:48:17 (127.0.0.1 1) INFO compiler.Compiler - compiling C:\jwsdp-1.3\webapps\lps-2.1.1\examples\contactlist\contactlist.lzx...
26 Mar 2004 16:48:22 (127.0.0.1 1) WARN media.TTF2FFT - skipping non-empty kerning table in C:\jwsdp-1.3\webapps\lps-2.1.1\WEB-INF\lps\fonts\bitstream-vera-1.10\vera.ttf
26 Mar 2004 16:48:22 (127.0.0.1 1) WARN media.TTF2FFT - skipping non-empty kerning table in C:\jwsdp-1.3\webapps\lps-2.1.1\WEB-INF\lps\fonts\bitstream-vera-1.10\verabd.ttf
26 Mar 2004 16:48:27 (127.0.0.1 1) INFO compiler.Compiler - done
26 Mar 2004 16:48:28 (127.0.0.1 1) INFO responders.ResponderHTML - Responding with HTML wrapper for C:\jwsdp-1.3\webapps\lps-2.1.1\\examples\contactlist\contactlist.lzx
26 Mar 2004 16:48:28 (127.0.0.1 1) INFO responders.Responder - Responding with error (text/html): The output format must have a '{http://xml.apache.org/xalan}content-handler' property!org.apache.xml.utils.WrappedRuntimeExcept ion: The output format must have a '{http://xml.apache.org/xalan}content-handler' property!
at org.apache.xalan.serialize.SerializerFactory.getSe rializer(SerializerFactory.java:142)
at org.apache.xalan.transformer.TransformerImpl.creat eResultContentHandler(TransformerImpl.java:1048)
at org.apache.xalan.transformer.TransformerImpl.creat eResultContentHandler(TransformerImpl.java:975)
at org.apache.xalan.transformer.TransformerImpl.trans form(TransformerImpl.java:1124)
at org.apache.xalan.transformer.TransformerImpl.trans form(TransformerImpl.java:1107)
at com.laszlosystems.utils.TransformUtils.applyTransf orm(TransformUtils.java:83)
at com.laszlosystems.servlets.responders.ResponderHTM L.writeCanvas(ResponderHTML.java:80)
at com.laszlosystems.servlets.responders.ResponderHTM L.respondImpl(ResponderHTML.java:53)


So then, to ensure the correct xalan.jar was being used, I renamed all other versions of xalan.jar to xalan.jar.old. But still got the same error.

Any ideas? Is tomcat v5.0 supported?

bloch
03-26-2004, 01:54 PM
Hi There,

Renaming the jars won't work, usually.

Could you simply try
copying $LPS_HOME/WEB-INF/lib/xalan.jar to
$TOMCAT_HOME/common/endorsed/xalan.jar

and restart tomcat?

Best,
Eric

didier
03-27-2004, 06:15 AM
I have the same problem. Christine's post indicates that she followed the installation issues step by step, as I did, which involves the suggested fix. Copying xalan.jar to the common/endorsed does not fix the problem with Tomcat v5.0.

(Even copying all LPS jars to either Tomcat's common/endorsed or common/lib and restarting Tomcat does not fix the problem.)

Please help!

bloch
03-27-2004, 09:28 AM
Hey Guys

Let's see if we can solve this.

What exists inside

$JAVA_HOME/jre/lib/ext and $TOMCAT_HOME/common/endorsed and
$TOMCAT_HOME/common/lib ?

I ask because the error you are reporting indicates you are still picking up the wrong version of xalan.

You can see this for sure by setting JAVA_OPTS= -verbose:class before starting Tomcat and then look at the stdout/stderr for Tomcat 5.0. (precise instructs for doing this will depend on how you're starting tomcat; if you use the .bat script setting %JAVA_OPTS% will do).

The problem we have is that Sun shipped JRE 1.4.2 shipped with an old version of xalan in it and the only way, in general, to get Tomcat class loaders to choose the newer one has been to put our jar in the endorsed list. The tomcat startup scripts are spose to do this for all jars inside $TOMCAT_HOME/common/endorsed.

In the past, people have worked around this by simply copying the LPS version of xalan.jar to $TOMCAT_HOME/common/endorsed so I'm surprised to see that this doesn't work for you.

-Eric

didier
03-27-2004, 10:26 AM
Bloch, thanks for your prompt reply.

I understand your surprise. Same here. I've been working on this for more than 2 full days, and would not post a message here if I was not sure that I did everything right to the extent of my knowledge.

I hunted down all xalan.jar in my system. The only suspicious copy was in jwsdp-1.3/jaxp/lib/endorsed from Sun's Java Web Services Development Pack 1.3, which was removed.
The only xalan.jar files on my system are copies of that provided by the core lps-2.1.1 bundle (716Kb).

Now, Sun's JDK 1.4.2_03 does not come with a xalan.jar. Since you say it came with a previous release of the JDKn 1.4.2, maybe xalan classes have been packed into another jar of the JDK-1.4.2-03, which may explain the problem.

It would be nice if the LPS webapp came with a validate page (like Apache Axis), which validates the local installation and namely shows the actual jars used by the web app with their path. It is so useful when the app does not work.

bloch
03-27-2004, 11:39 AM
Hi there,

Because classes can be hidden in any jar
(xalan classes can be in a jar called foo.jar),
just looking for jars won't do it.

In the end, using -verbose:class as a command-line
option to Java may be the quickest way to determine which jar is providing the xalan classes.

Let me know if you need help figuring out
how to pass that argument to Java and then finding out where the verbose log ends up. Sometimes on Windows this log is in strange places.

-Eric

didier
03-29-2004, 07:22 AM
Thanks for the suggestions.

I tried to use the -verbose:class java option, but the closest I could use it to the LPS web app is the launch of the TomCat server (through the catalina.bat script.) Unfortunately that does not tell me about the origin of the actual xalan classes when running the hello.lzx example.

Can you tell me how you use "-verbose:class" on the LPS webapp? Thanks.

(BTW, I also checked inside every jar in my system. There is no other xalan classes hidden.)

It would be nice if you could test the LPS core installation against Sun's JWSDP-1.3, and provide installation issue notes.
(Be aware of JAXP's xalan.jar, which is in the classpath of the Catalina startup. And "yes" I removed the JAXP's xalan.jar and replaced the classpath entry with LPS' xalan.jar for my tests.)

bloch
03-29-2004, 09:32 AM
The usual culprit here is the xalan inside JRE 1.4.2 itself.

Ultimately, java has to be started with the java.endorsed.dir property in order to override the jars in the jre itself.

The tomcat catalana.bat/catalina.sh scripts usually take care of this and pass $TOMCAT_HOME/common/endorsed so that any classes found inside jars that are in that directory get chosen first.

If you

export JAVA_OPTS='-verbose:class' (bash)
setenv JAVA_OPTS '-verbose:class' (tcsh)
set JAVA_OPTS=-verbose:class (windoze)

before you run the tomcat startup script, then you should be able to see the class loader debugging show up in the java stderr.log (or maybe stdout.log)

This log can show up in a variety of places depending on the OS you are using and precisely how you start tomcat.

You can look in c:\\Windows\system32
C:\\WINNT\system32
C:\\WINDOWS\system32

C:\Documents and Settings\{your username}\

yoiur current directory or
$TOMCAT_HOME/logs

If you can't find it search your system for files named stderr.log and/or stdout.log


-Eric

christine
04-02-2004, 08:47 PM
Hi guys, I still can not get this to work. Here is what I tried:

(0) Installed jwsdp v1.3

(1) Installed/deployed lps v2.1.1

(2) The startup script in jwsdp (with Tomcat v5.0) is completely different from the startup script in lps (with Tomcat v4.1.12). In v5.0, java.endorsed.dirs is no longer set in the startup script.

So, I created an endorsed directory in $JAVA_HOME/jre/lib and copied

$LPS_HOME/WEB-INF/lib/xalan.jar to
$JAVA_HOME/jre/lib/endorsed/xalan.jar

(3) In the v5.0 startup script, the classpath is set to include several jars from jaxp, including xalan.jar.

So, I removed all the jaxp jars from the classpath.

(4) Copied $LPS_HOME/WEB-INF/lib/jing.jar to
$JWSDP_HOME/common/lib/jing.jar

(as per lps installation instructions)

(5) lps did NOT start. The log file indicated it was unable to find org.apache.log4j.Layout.class.

So, I copied

$LPS_HOME/WEB-INF/lib/log4j-1.2.6.jar to
$JWSDP_HOME/common/lib/log4j-1.2.6.jar

(6) lps did start, but with warnings.

So, I copied

$LPS_HOME/WEB-INF/lib/*.jar to
$JWSDP_HOME/common/lib/*.jar

(7) lps started without error nor warnings

(8) I tried to open Hello.lzx in my browser and got the error from my first post.

So, I copied

$LPS_HOME/WEB-INF/lib/*.jar to
$JAVA_HOME/jre/lib/endorsed/*.jar

(Seems a bit drastic, but I am running out of things to try!)

(9) Still get the error.

I used -verbose:class and can see that the jars in $JAVA_HOME/jre/lib/endorsed are opened first and these are the jars from $LPS_HOME/WEB-INF/lib, so I am at a loss as to how the wrong xalan could be loaded.

What am I missing?

bloch
04-03-2004, 10:17 AM
Hey Christine,

I would try undoing all you've done and
simply copy xalan.jar to
$TOMCAT_HOME/common/endorsed (TOMCAT not JAVA).

(I don't believe Java will look in $JAVA_HOME/jre/lib/endorsed)

Let me know how it goes,

-Eric

didier
04-06-2004, 06:28 AM
Hi Eric,

Your suggestion is not valid for Tomcat v5.0. As Christine says, the $TOMCAT_HOME/common/endorsed is not an endorsed directory any more (see catalina.bat from Tomcat v5). The full bundle LPS uses Tomcat v4.1.2, in which catalina.bat sets $TOMCAT_HOME/common/endorsed as an endorsed directory.

Believe me, Christine and I have tried everything independently. You provide us with the same answer, whereas we have tried it.

The LPS core application does not work in conjunction with either Tomcat v5 and/or Sun's JWSDP 1.3 (which includes Tomcat v5)

It would be nice if Laszlo Systems tried out its core bundle installation on top of JWSDP 1.3, which many developers are using now, and replicate step by step the procedure suggested in Christine's last post.

Again, trying to make LPS work allowed us to get much more insight into Tomcat's setup, launch script, connection with the JVM.
Your hunch that java will not look in $JAVA_HOME/jre/lib/endorsed is wrong. It is actually the official location to put endorsed libraries as of JDK 1.4.2_b3.

We also tried to replicate Tomcat's old v4 setup, i.e. modifying Tomcat v5's catalina.bat so that $JWSDP_HOME/common/endorsed is again part of the endorsed libraries. Same results.

We are convinced from using the verbose:class mode that the right xalan.jar is used in all our attempts.

Could you please try the LPS core installation on top of JWSDP 1.3 and see if you come to the same conclusions? Thank you.

christine
04-06-2004, 07:43 AM
I would like to add one clarification to Didier's last post. Everywhere he says "Tomcat v5.0" should be "JWSDP with Tomcat 5.0 bundled".

I just installed Tomcat v5.0 alone. I got the same error, but copying xalan.jar to $TOMCAT_HOME\common\endorsed fixed the problem. This works because the startup script sets java.endrosed.dirs to $TOMCAT_HOME\common\endorsed. This is not the case in JWSDP startup scripts and this is why I placed xalan.jar in $JAVA_HOME\jre\lib\endorsed (step (2) of my last post) which is the default location for endorsed dirs.

So, it seems the problem is deploying LPS into JWSDP.

bloch
04-07-2004, 09:09 AM
We'll have someone give jwsdp a whirl at
some point.

I don't have tomcat5 handy here right now,
but if it no longer redefines the java endorsed dir, you could try simply placing the LPS version of xalan.jar into the java endorsed dir. See

http://java.sun.com/j2se/1.4.2/docs/guide/standards/

Crossing fingers, hoping this one works!

-Eric

vfunshteyn
04-07-2004, 01:06 PM
I have succeeded in getting LPS to work under JWSDP, but *only* with a JDK that has an older version of xalan.jar. I believe that these include anything < 1.4.2 -- Eric will correct me here -- I used 1.4.0.

Indeed, running

$ $JAVA_HOME/bin/jar -tf $JAVA_HOME/jre/lib/rt.jar | grep xalan | wc -l

yields 188 for every 1.4.x JDK less than 1.4.2 that I tried, and 220 for 1.4.2. There must be a pony here somewhere!

The problem that prevents one from using 1.4.2 though seems to be that JWSDP comes with its own classloader, that will, no matter what, first load JDK's JARs, and that includes the infamous xalan. So the class search path appears to be:
classes bundled with JDK => JWSDP's own directory structure (including all those pesky endorsed locations) => value of classpath parameter => webapp-specific jars. I think this is a flawed logic, and certainly turns out to be that way wrt to LPS deployment. Short of modifying $JAVA_HOME/jre/lib/rt.jar, I don't think there's a solution.

But here's what to do for those willing to go below 1.4.2.

1) Edit $JWSDP_HOME/jwsdp-shared/bin/setenv.sh|bat so that your JAVA_HOME points to a compatible JDK (see above).
2) Delete $JWSDP_HOME/jaxp/lib/endorsed/xalan.jar
3) From WEB-INF/lib directory of LPS, copy commons-logging.jar, jing.jar and log4j-1.2.6.jar to $JWSDP_HOME/common/endorsed.
4) Start the server.
5) Try and compile an LZX app.

didier
04-07-2004, 01:21 PM
Thanks a lot for that last posting. It confirms that there was really a problem!

I found out that JDK 1.4.2_b03's rt.jar had the xalan classes, and that it was the origin of the problem.

Christine told me "off-post" that she came to the same conclusion: JWSDP has its own classloader that prevents LPS' xalan.jar from being loaded no matter its location, endorsed or not.

I was wondering if we were the only developers experiencing this problem... I am glad to read your post, and thanks for the suggested workaround. Indeed, it seems to be the only way for now.

vfunshteyn
04-07-2004, 01:33 PM
Originally posted by bloch
I don't have tomcat5 handy here right now,
but if it no longer redefines the java endorsed dir, you could try simply placing the LPS version of xalan.jar into the java endorsed dir. See

http://java.sun.com/j2se/1.4.2/docs/guide/standards/
-Eric

This document lists the only packages that can be overridden. Xalan is not one of them, which is likely why this approach didn't work.

christine
04-08-2004, 05:43 AM
Thanks to everyone for helping out on this problem.

I'd like to add a couple more interesting pieces to this puzzle.

When Tomcat in JWSDP is started using -verbose:class, I can see that several classes in the org.apache.xalan.sax package are loaded from the endorsed xalan.jar. But, when I run a LZX example or even a JSP or Servlet example, there are no "[Loaded ---]" messages from the JVM.

This is in contrast to using Tomcat standalone, where I see the "[Loaded ---]" messages both at startup and when I run the example apps.

Perhaps, when using JWSDP, the web apps are not running in the same JVM? And the JVM they are running in does not have the correct java.endorsed.dirs? Or is it the class loader that is responsible for the output?

BTW, http://jakarta.apache.org/tomcat/tomcat-5.0-doc/class-loader-howto.html explains the class loaders used by Tomcat. According to their doc, the class loader for a Web app will use the java.endorsed.dirs feature for org.apache.xalan.* classes. So, in theory, you could put the jars in the jre's endorsed directory. But, JWSDP must be messing this up somehow.