You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by satt <sa...@yahoo.com> on 2007/03/27 13:41:11 UTC
Reg executing the servlet in velocity eclipse environment
Hi there..
I am new to the Velocity.
I am using velocity1.5. I created the following servlet..
public Template handleRequest( HttpServletRequest request,
HttpServletResponse response,
Context context ) {
Template template = null;
try {
context.put("name", "VelocityTest");
template = Velocity.getTemplate("/WEB-INF/templates/hello.vm");
} catch( Exception e ) {
System.err.println("Exception caught: " + e.getMessage());
}
return template;
}
}
The velocity.properties file is as follows...
resource.loader = file
file.resource.loader.class =
org.apache.velocity.runtime.resource.loader.FileResourceLoader
file.resource.loader.path = C:\Velocity
Eclipse\eclipse\WorkSpace\velocity\WEB-INF\templates
file.resource.loader.cache = true
And I created the web.xml file and the .vm file correctly..
I had provided jar files also.But still I am getting the following exception
while opening the URL:.
http://localhost:8080/velocity/HelloTest
javax.servlet.ServletException: Error allocating a servlet instance
org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
java.lang.Thread.run(Thread.java:595)
root cause
java.lang.NoClassDefFoundError: org/apache/velocity/servlet/VelocityServlet
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:620)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1629)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:850)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1299)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
java.lang.Thread.run(Thread.java:595)
Please show me the way how can I execute the servlet successfully..
Thanks
Satt
--
View this message in context: http://www.nabble.com/Reg-executing-the-servlet-in-velocity-eclipse-environment-tf3472540.html#a9690699
Sent from the Velocity - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
Re: Reg executing the servlet in velocity eclipse environment
Posted by Will Glass-Husain <wg...@gmail.com>.
Satt,
We've had other recent reports of problems with JBoss and Velocity.
Your problem appears to be related to the class loader - it can't
find the superclass.
See
https://issues.apache.org/jira/browse/VELOCITY-530
Note the recommended fix. Let us know if you can figure out the issue.
Also, we recommend you use the VelocityViewServlet (from Velocity
Tools) instead of the deprecated VelocityServlet. VVS is under active
maintenance and development while VelocityServlet is not.
WILL
On 3/27/07, satt <sa...@yahoo.com> wrote:
>
> Hi there..
>
> I am new to the Velocity.
> I am using velocity1.5. I created the following servlet..
> public Template handleRequest( HttpServletRequest request,
> HttpServletResponse response,
> Context context ) {
>
> Template template = null;
> try {
> context.put("name", "VelocityTest");
> template = Velocity.getTemplate("/WEB-INF/templates/hello.vm");
> } catch( Exception e ) {
> System.err.println("Exception caught: " + e.getMessage());
> }
>
> return template;
> }
>
> }
>
>
> The velocity.properties file is as follows...
>
> resource.loader = file
> file.resource.loader.class =
> org.apache.velocity.runtime.resource.loader.FileResourceLoader
> file.resource.loader.path = C:\Velocity
> Eclipse\eclipse\WorkSpace\velocity\WEB-INF\templates
> file.resource.loader.cache = true
>
> And I created the web.xml file and the .vm file correctly..
>
> I had provided jar files also.But still I am getting the following exception
> while opening the URL:.
> http://localhost:8080/velocity/HelloTest
> javax.servlet.ServletException: Error allocating a servlet instance
>
> org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
>
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
>
> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
>
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
>
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>
> org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
> java.lang.Thread.run(Thread.java:595)
>
>
> root cause
>
> java.lang.NoClassDefFoundError: org/apache/velocity/servlet/VelocityServlet
> java.lang.ClassLoader.defineClass1(Native Method)
> java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
>
> org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1629)
>
> org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:850)
>
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1299)
>
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
>
> org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
>
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
>
> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
>
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
>
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>
> org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
> java.lang.Thread.run(Thread.java:595)
>
>
> Please show me the way how can I execute the servlet successfully..
>
> Thanks
> Satt
> --
> View this message in context: http://www.nabble.com/Reg-executing-the-servlet-in-velocity-eclipse-environment-tf3472540.html#a9690699
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
--
Forio Business Simulations
Will Glass-Husain
wglass@forio.com
www.forio.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org