开发者社区> 问答> 正文

Velocity 怎么搭建环境呢,今天搭了一个时没搭出来,请求帮助?? 400 报错

Velocity 怎么搭建环境呢,今天搭了一个时没搭出来,请求帮助?? 400 报错 各位好心人,帮帮忙啊!!!谢谢!

展开
收起
爱吃鱼的程序员 2020-06-02 16:59:34 516 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    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


    ######
    ######红暑大哥,录个veloctiy入门的视频教程,让大家学习学习,或者给点资料也行啊!有劳大哥!######应该是缺少一些 jar 包了,velocity 需要几个 jar 包,官网文档里有说明
    ######

    所有的JAR包都放进去了!

    <load-on-startup>1</load-on-startup> 不要这个启动就不报错,但访问报错!

    ###### @serversocket : 什么亮了??###### @红薯 : 亮了!######我不信######

    严重: Servlet /valocity threw load() exception

    拼写错了,你改正确试试  veloctiy

    ######项目名称而已,没太大的关系!!!谢谢!######这不是项目名称……是sevelet-name,配置文件上下不一致会出问题的######按照自带的例子copy过来,试试。
    2020-06-02 16:59:46
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
Serverless 开发实战--十分钟上线一个 Web 应用 立即下载
函数计算最佳实践:快速开发一个分布式 Puppeteer 网页截图服务 立即下载
低代码开发师(初级)实战教程 立即下载