gpt4 book ai didi

java - Servlet 调度程序当前不可用

转载 作者:行者123 更新时间:2023-12-01 07:41:21 25 4
gpt4 key购买 nike

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" />

<bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://127.0.0.1:3306/spring"/>
<property name="username" value="monty"/>
<property name="password" value="indian"/>
</bean>

<bean id="mySessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="myDataSource" />
<property name="annotatedClasses">
<list>
<value>uk.co.vinoth.spring.domain.User</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">create</prop>
</props>
</property>
</bean>

<bean id="myUserDAO" class="uk.co.vinoth.spring.dao.UserDAOImpl">
<property name="sessionFactory" ref="mySessionFactory"/>
</bean>

<bean name="/user/*.htm" class="uk.co.vinoth.spring.web.UserController" >
<property name="userDAO" ref="myUserDAO" />
</bean>

</beans>

上面是我的bean配置,为什么当我运行我的应用程序时出现错误。我的日志文件夹是空的...

org.apache.catalina.loader.StandardClassLoader@122c9df
org.springframework.web.servlet.DispatcherServlet
java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1436)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1282)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1068)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3996)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4266)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Dec 22, 2010 3:44:48 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /interMedix threw load() exception
java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1436)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1282)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1068)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3996)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4266)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Dec 22, 2010 3:44:48 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8181
Dec 22, 2010 3:44:48 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Dec 22, 2010 3:44:48 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/27 config=null
Dec 22, 2010 3:44:48 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Dec 22, 2010 3:44:49 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 558 ms
Dec 22, 2010 3:44:50 PM org.apache.catalina.core.StandardWrapperValve invoke
INFO: Servlet dispatcher is currently unavailable
Dec 22, 2010 3:50:18 PM org.apache.catalina.core.StandardWrapperValve invoke
INFO: Servlet dispatcher is currently unavailable

但是我已将 spring-web-mvc 添加到我的类路径中,其中包含此类文件。

最佳答案

But i have added spring-web-mvc to my class path which does contain this class file.

你是如何向你的 CLASSPATH 添加一些东西的?

如果您要创建 Web 应用程序,唯一合适的做法是将 .class 文件放在 WEB-INF/classes 下,将 .jar 文件放在 WEB-INF/lib 下。如果你做了别的事,我会说这是错误的。不应修改启动脚本;本地环境变量将被忽略,并且不太可能在您部署到的服务器上设置。

更新:

如果您告诉我您已经根据 IDE 正确完成了所有操作,我建议您进行最后一次检查:查看您实际部署到 Tomcat 的压缩或分解的 WAR 文件,并确保您可以看到 JAR与错误提到的 .class 文件。如果它不是 war 的一部分,你必须找出你的包装出了什么问题。如果您认为 JAR 存在,请打开它并找到 .class 并检查路径。

您必须相信您看到的错误消息。与其说“我做的一切都是对的”,不如说“我错过了什么?”

关于java - Servlet 调度程序当前不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4508058/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com