Velocity 怎么搭建环境呢,今天搭了一个时没搭出来,请求帮助?? 400 报错 各位好心人,帮帮忙啊!!!谢谢!
velocity 只是一个 jar 包,引入 jar 包后,在 web.xml 中配置如下即可
<servlet> <servlet-name>velocity</servlet-name> <servlet-class>org.apache.velocity.servlet.VelocityServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>velocity</servlet-name> <url-pattern>*.vm</url-pattern> </servlet-mapping>######
这样配置一启动就报这个错啊!
at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30)
######2011-11-14 22:24:24 org.apache.catalina.core.AprLifecycleListener init 信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Java\jdk1.6\bin;E:\tomcat-6.0.33\bin 2011-11-14 22:24:24 org.apache.coyote.http11.Http11Protocol init 信息: Initializing Coyote HTTP/1.1 on http-8080 2011-11-14 22:24:24 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 405 ms 2011-11-14 22:24:24 org.apache.catalina.core.StandardService start 信息: Starting service Catalina 2011-11-14 22:24:24 org.apache.catalina.core.StandardEngine start 信息: Starting Servlet Engine: Apache Tomcat/6.0.33 2011-11-14 22:24:24 org.apache.catalina.startup.HostConfig deployDescriptor 信息: Deploying configuration descriptor host-manager.xml 2011-11-14 22:24:25 org.apache.catalina.startup.HostConfig deployDescriptor 信息: Deploying configuration descriptor manager.xml 2011-11-14 22:24:25 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory docs 2011-11-14 22:24:25 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory examples 2011-11-14 22:24:25 org.apache.catalina.core.ApplicationContext log 信息: ContextListener: contextInitialized() 2011-11-14 22:24:25 org.apache.catalina.core.ApplicationContext log 信息: SessionListener: contextInitialized() 2011-11-14 22:24:25 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory ROOT 2011-11-14 22:24:25 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory valocity 2011-11-14 22:24:25 org.apache.catalina.core.ApplicationContext log 信息: Marking servlet velocity as unavailable 2011-11-14 22:24:25 org.apache.catalina.core.StandardContext loadOnStartup 严重: Servlet /valocity threw load() exception java.lang.InstantiationException at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at java.lang.Class.newInstance0(Class.java:355) at java.lang.Class.newInstance(Class.java:308) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1116) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4421) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4734) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065) at org.apache.catalina.core.StandardHost.start(StandardHost.java:840) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463) at org.apache.catalina.core.StandardService.start(StandardService.java:525) at org.apache.catalina.core.StandardServer.start(StandardServer.java:754) at org.apache.catalina.startup.Catalina.start(Catalina.java:595) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) 2011-11-14 22:24:25 org.apache.coyote.http11.Http11Protocol start 信息: Starting Coyote HTTP/1.1 on http-8080 2011-11-14 22:24:25 org.apache.jk.common.ChannelSocket init 信息: JK: ajp13 listening on /0.0.0.0:8009 2011-11-14 22:24:25 org.apache.jk.server.JkMain start 信息: Jk running ID=0 time=0/32 config=null 2011-11-14 22:24:25 org.apache.catalina.startup.Catalina start 信息: Server startup in 654 ms
所有的JAR包都放进去了!
<
load-on-startup
>1</
load-on-startup
> 不要这个启动就不报错,但访问报错!
严重: Servlet /valocity threw load() exception
拼写错了,你改正确试试 veloctiy
######项目名称而已,没太大的关系!!!谢谢!######这不是项目名称……是sevelet-name,配置文件上下不一致会出问题的######按照自带的例子copy过来,试试。版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。