You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Allen <al...@earthlink.net> on 2000/07/01 17:35:58 UTC

Re: ClassPath for Java extensions??

Hi,

I have this working with Apache 1.3.9, Tomcat 3.1, Xalan 1.0.1, and Xerces 1.0.3. My classpath has an entry for:
webapps/mywebapp/WEB-INF/classes (and the physical class files are in: webapps/mywebapp/WEB-INF/classes/com/HTD).

Here is my style sheet (I clipped it down to make it easier to read):
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:lxslt="http://xml.apache.org/xslt"
  xmlns:dropdown="com.HTD.GenerateHODropDownSelection"
  extension-element-prefixes="dropdown"
  version="1.0">
<lxslt:component prefix="dropdown"
  elements="" functions="getDropDownSelections">
<lxslt:script lang="javaclass" src="com.HTD.GenerateHODropDownSelection"/>
</lxslt:component>
<xsl:template match="/SmartHomeRecord">
<HTML>
<head><title>Test...</title></head>
<body>
   <form action="smarthomerecord?ShrResponsePage=SHR_links.jsp&amp;ShrRequestType=Update" method="post">
  <H1>Test Address</H1>
  <p>
    Please select a state:
    <select name="SmartHomeRecord_GeneralInfo_Address_State">
      <xsl:value-of select="dropdown:getDropDownSelections('state', string(GeneralInfo/Address/State/text()))" disable-output-escaping="yes"/>
    </select>
  </p>
  <input type="submit" name="submit" value="Submit"/>
  <input type="reset" value="Reset"/>
  </form>
</body>
</HTML>
</xsl:template>

</xsl:stylesheet>

This seems to work fine. So, either the classpath that you think that you are using you are not really using or maybe there is a bug in the way you defined your component?

Let me know if you need more help...
Allen

-----------------------------------------------------
Date: Thu, 29 Jun 2000 15:16:14 +0200
To: <xa...@xml.apache.org>
From: "Philippe Vijghen" <Ph...@forem.be>
Cc: "Philippe Vijghen" <Ph...@forem.be>
Subject: ClassPath for Java extensions??
Message-ID: <ND...@forem.be>

Hi,

I am in the following situation:
        * Xalan is called from a java environmenent (servlet-based app server)
        * stylesheet wants to access some Java code

However, I get continuously the following message:
        > Call to extension element failed: be.acse.xsl.extensions.Lookup

...although the mentionned class is available from the calling servlet
environment.

Note that I have the same message for the samples provided with Xerces like
for .\samples\Extensions\3numlistJava.xsl
The only way I found to make it work is to put salansamples.jar in
jre/lib/ext
It doesn't work simply by compiling MyCounter.java and having the resulting
class
file somewhere in the class path...? :(

The question is:
////////////////

        Q which are the constraints on the way for resolving classes :
          is it the traditional jre/lib/ext + CLASSPATH or is it a custom
          loading mechanism

Thanks in advance for your support,

        Philippe
---
Philippe Vijghen  phv@acse.be
Project Manager   +32 (2) 705.70.21
ACSE s.a.         Bd Général Wahis 29. B-1030 Bruxelles. Belgium


RE: ClassPath for Java extensions??

Posted by Philippe Vijghen <Ph...@forem.be>.
For you information, I figured out what was the issue
with classpath and Java extensions to Xalan.

I spent days on that one!

The conclusion is
	Java extensions to Xalan are *not* working
	when xalan.jar, bsfengines.jar or bsf.jar
	are placed in $(JDK_HOME)/jre/lib/ext

	...because it seems that when in jre/lib/ext
	the Xalancode is not able to locate java classes that are
	not themselves in jre/lib/ext
	(even is they are in the java classpath).

(Note however that all other Xalan features are working fine
when in jre/lib/ext)

-> the solution is:

	* move Xalan out of jre/lib/ext and place it in the classpath
	* ...or move your extension classes in jre/lib/ext

Thanks for your responses,

	Philippe
---
Philippe Vijghen  phv@acse.be
Project Manager   +32 (2) 705.70.21
ACSE s.a.         Bd Général Wahis 29. B-1030 Bruxelles. Belgium


Re: ClassPath for Java extensions??

Posted by Jason Harrop <jh...@bigpond.net.au>.
Hi Allen.  When i put the WEB-INF classes directory into the classpath
environemnt variable of the user who invokes tomcat, i get a 500
internal server error when i try to invoke a servlet (not even the one
with the xalan extensions!).  this with apache 1.3.12, tomcat 3.2b2,
xalan 1.1.  if you've got a minute, would you mind telling me how (which
file and directive) you added WEB-INF/classes to your classpath? 
thanks, jason

 Allen wrote:
> 
> Hi,
> 
> I have this working with Apache 1.3.9, Tomcat 3.1, Xalan 1.0.1, and Xerces 1.0.3. My classpath has an entry for:
> webapps/mywebapp/WEB-INF/classes (and the physical class files are in: webapps/mywebapp/WEB-INF/classes/com/HTD).
> 
> Here is my style sheet (I clipped it down to make it easier to read):
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>   xmlns:lxslt="http://xml.apache.org/xslt"
>   xmlns:dropdown="com.HTD.GenerateHODropDownSelection"
>   extension-element-prefixes="dropdown"
>   version="1.0">
> <lxslt:component prefix="dropdown"
>   elements="" functions="getDropDownSelections">
> <lxslt:script lang="javaclass" src="com.HTD.GenerateHODropDownSelection"/>
> </lxslt:component>
> <xsl:template match="/SmartHomeRecord">
> <HTML>
> <head><title>Test...</title></head>
> <body>
>    <form action="smarthomerecord?ShrResponsePage=SHR_links.jsp&amp;ShrRequestType=Update" method="post">
>   <H1>Test Address</H1>
>   <p>
>     Please select a state:
>     <select name="SmartHomeRecord_GeneralInfo_Address_State">
>       <xsl:value-of select="dropdown:getDropDownSelections('state', string(GeneralInfo/Address/State/text()))" disable-output-escaping="yes"/>
>     </select>
>   </p>
>   <input type="submit" name="submit" value="Submit"/>
>   <input type="reset" value="Reset"/>
>   </form>
> </body>
> </HTML>
> </xsl:template>
> 
> </xsl:stylesheet>
> 
> This seems to work fine. So, either the classpath that you think that you are using you are not really using or maybe there is a bug in the way you defined your component?
> 
> Let me know if you need more help...
> Allen
> 
> -----------------------------------------------------
> Date: Thu, 29 Jun 2000 15:16:14 +0200
> To: <xa...@xml.apache.org>
> From: "Philippe Vijghen" <Ph...@forem.be>
> Cc: "Philippe Vijghen" <Ph...@forem.be>
> Subject: ClassPath for Java extensions??
> Message-ID: <ND...@forem.be>
> 
> Hi,
> 
> I am in the following situation:
>         * Xalan is called from a java environmenent (servlet-based app server)
>         * stylesheet wants to access some Java code
> 
> However, I get continuously the following message:
>         > Call to extension element failed: be.acse.xsl.extensions.Lookup
> 
> ...although the mentionned class is available from the calling servlet
> environment.
> 
> Note that I have the same message for the samples provided with Xerces like
> for .\samples\Extensions\3numlistJava.xsl
> The only way I found to make it work is to put salansamples.jar in
> jre/lib/ext
> It doesn't work simply by compiling MyCounter.java and having the resulting
> class
> file somewhere in the class path...? :(
> 
> The question is:
> ////////////////
> 
>         Q which are the constraints on the way for resolving classes :
>           is it the traditional jre/lib/ext + CLASSPATH or is it a custom
>           loading mechanism
> 
> Thanks in advance for your support,
> 
>         Philippe
> ---
> Philippe Vijghen  phv@acse.be
> Project Manager   +32 (2) 705.70.21
> ACSE s.a.         Bd Général Wahis 29. B-1030 Bruxelles. Belgium

RE: ClassPath for Java extensions??

Posted by Philippe Vijghen <Ph...@forem.be>.
> I have this working with Apache 1.3.9, Tomcat 3.1, Xalan 1.0.1,
> and Xerces 1.0.3. My classpath has an entry for:
> webapps/mywebapp/WEB-INF/classes (and the physical class files
> are in: webapps/mywebapp/WEB-INF/classes/com/HTD).

> This seems to work fine. So, either the classpath that you think
> that you are using you are not really using or maybe there is a bug
> in the way you defined your component?

> Let me know if you need more help...
> Allen

I double-checked my XSL stylesheet and I am pretty sure see no problem in my
stylesheet declaration.
As mentionned before, I observe the same problem
right on the command line with the tests provided in Xerces.

I keep getting "Call to extension element failed:
be.acse.xsl.extensions.Lookup" on stderr.
(I don't have such a message when misdeclaring the xsl, which proves the XSL
part is OK).

When putting my classes in JRE,
this solves the issue but I don't want to have to do this!

I am testing it on MS WIndows NT platform (SUN JDK 1.2.2).
I am not using Apache/Tomcat but JRun.

Another people told me he had the same issue (see the mail included below)


Thanks in advance for your support,

	Philippe


> > Philippe:
> >
> > Thanks for your question to the xalan-dev list. I've spent
> > the last five hours trying to solve this issue; finding your letter
> > gave at lease some sort of solution: I can now go ahead by putting my
> > .jars under /jre/lib/ext as you mention.
> >
> > The error has to be in /xpath/ExtensionFunctionHandler.java, I think.
> >
> > Strange when equivalent code, like this,
> >
> > import java.lang.*;
> >
> > public class TestJava {
> >
> >     public static void main(String argv[]) {
> >         try {
> >             Object object = Class.forName(argv[0]);
> >         }
> >         catch (ClassNotFoundException e) {
> >             System.out.println("Woah: " + e);
> >         }
> >     }
> > }
> >
> > can locate the classes, but xalan cannot!
> >
> > Yours,