You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by m....@devote.nl on 2000/10/05 16:55:49 UTC

XSP Compile problem in Cocoon 1.7.4

Hi,

I have a problem using a Java class in an XSP page.
The page uses a java class I wrote and is in the classpath of the servlet
engine.

This is the source of the XSP page:
==================================
<?xml version="1.0"?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="demo_xsp.xsl" type="text/xsl"?>
<xsp:page language="java" xmlns:xsp="http://www.apache.org/1999/XSP/Core">

  <xsp:logic>
    TestObject myobj;
    Date nu = new Date();
  </xsp:logic>

  <page>
    <title>test</title>
    <p>This is my first dynamic XML page!</p>
    <p><xsp:expr>nu</xsp:expr></p>
    <p><xsp:expr>nu</xsp:expr></p>
 </page>

</xsp:page>
======================

The page gives the following error:
==========================
java.lang.Exception: XSP Java Compiler: Compilation failed for
_testObj.java
25: Class _D_._Program_Files._Apache_Group._Apache._htdocs._webapps.
_gogo.TestObject not found.

    TestObject myobj;

                   ^
1 error

     at
org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJavaProcessor.java:159)
     at
org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java:451)
     at org.apache.cocoon.Engine.handle(Engine.java:305)
     at org.apache.cocoon.Cocoon.service(Cocoon.java:167)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
     at
org.apache.jserv.JServConnection.processRequest(JServConnection.java:317)
     at org.apache.jserv.JServConnection.run(JServConnection.java:188)
     at java.lang.Thread.run(Unknown Source)
==================================

I found the generated java code in the repository directory and tried
compiling the code by hand.
This gives an unresolved symbol on the TestObject class. After removing the
"package" line in the java file it compiles fine (commandline), but I get
nullpointer problems when loading the page.
(The page is ok if I only remove the declaration of myobj)

Does anybody have a clue?

TIA,

Michael Homeijer


Re: XSP Compile problem in Cocoon 1.7.4

Posted by Michael Bierenfeld <mi...@atmiralis.de>.
m.homeijer@devote.nl wrote:
> 
> Hi,
> 
> I have a problem using a Java class in an XSP page.
> The page uses a java class I wrote and is in the classpath of the servlet
> engine.
> 
> This is the source of the XSP page:
> ==================================
> <?xml version="1.0"?>
> <?cocoon-process type="xsp"?>
> <?cocoon-process type="xslt"?>
> <?xml-stylesheet href="demo_xsp.xsl" type="text/xsl"?>
> <xsp:page language="java" xmlns:xsp="http://www.apache.org/1999/XSP/Core">
> 
>   <xsp:logic>
>     TestObject myobj;
>     Date nu = new Date();
>   </xsp:logic>
> 
>   <page>
>     <title>test</title>
>     <p>This is my first dynamic XML page!</p>
>     <p><xsp:expr>nu</xsp:expr></p>
>     <p><xsp:expr>nu</xsp:expr></p>
>  </page>
> 
> </xsp:page>
> ======================
> 
> The page gives the following error:
> ==========================
> java.lang.Exception: XSP Java Compiler: Compilation failed for
> _testObj.java
> 25: Class _D_._Program_Files._Apache_Group._Apache._htdocs._webapps.
> _gogo.TestObject not found.
> 
>     TestObject myobj;
> 
>                    ^
> 1 error
> 
>      at
> org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJavaProcessor.java:159)
>      at
> org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java:451)
>      at org.apache.cocoon.Engine.handle(Engine.java:305)
>      at org.apache.cocoon.Cocoon.service(Cocoon.java:167)
>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
>      at
> org.apache.jserv.JServConnection.processRequest(JServConnection.java:317)
>      at org.apache.jserv.JServConnection.run(JServConnection.java:188)
>      at java.lang.Thread.run(Unknown Source)
> ==================================
> 
> I found the generated java code in the repository directory and tried
> compiling the code by hand.
> This gives an unresolved symbol on the TestObject class. After removing the
> "package" line in the java file it compiles fine (commandline), but I get
> nullpointer problems when loading the page.
> (The page is ok if I only remove the declaration of myobj)
> 
> Does anybody have a clue?
> 
> TIA,
> 
> Michael Homeijer
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org


Hello,

did you use :

<xsp:structure>
	<xsp:include> xmltools.* </xsp:include>
	<xsp:include> xmlbeans.* </xsp:include>
	<xsp:include> java.util.Hashtable.*
</xsp:include>
	<xsp:include> java.util.Vector.* </xsp:include>
	<xsp:include> base.* </xsp:include>
</xsp:structure>

<xsp:logic>

	static private int counter = 0;

	and so on ....

In the <xsp:page> Tag ?

Regards

Michael