Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error running Cocoon

 
shailendra vasale
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi All,
I'm running Sample.xml example which I placed under ../samples
directory along with Sample.xsl.When I invoke the url as -" http://localhost:8080/cocoon/samples/Sample.xml " running tomcat server,the cocoon engine throws as exception -
" java.lang.NoClassDefFoundError: sun/tools/javac/Main
at org.apache.cocoon.processor.xsp.language.java.SunJavaCompiler.compile(SunJavaCompiler.java:68)
at org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(Compiled Code)
at org.apache.cocoon.processor.xsp.XSPProcessor.process(Compiled Code)
at org.apache.cocoon.Engine.handle(Compiled Code)
at org.apache.cocoon.Cocoon.service(Cocoon.java:183)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(Compiled Code)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(Compiled Code)
at java.lang.Thread.run(Thread.java:479) "
----------------------------------------------------------------
Can anyone please help me out.
Here is the Sample.xml and Sample.xsl files.
Sample.xml
<?xml version="1.0"?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="../samples/Sample.xsl" type="text/xsl"?>

<xsp age language="java"
xmlns:xsp="http://www.apache.org/1999/XSP/Core"
>

<xsp:logic>
private static int numHits = 0;

private synchronized int getNumHits( ) {
return ++numHits;
}
</xsp:logic>

<page>
<title>Hit Counter</title>

<p>I've been requested <xsp:expr>getNumHits( )</xsp:expr> times.</p>
</page>
</xsp age>
----------------------------------------------------------------
Sample.xsl
<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>

<xsl:template match="page">
<xsl rocessing-instruction name="cocoon-format">
type="text/html"
</xsl rocessing-instruction>
<html>
<head>
<title><xsl:value-of select="title"/></title>
</head>
<body>
<xsl:apply-templates select="*[not(self::title)]" />
</body>
</html>
</xsl:template>

<xsl:template match="p">
<p align="center">
<xsl:apply-templates />
</p>
</xsl:template>

</xsl:stylesheet>
----------------------------------------------------------------
Thanks in advance.
Regards,
SHAILENDRA.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic