我想尝试一个简单的程序,但出现以下错误。我正在使用Eclipse Kelper和Tomcat 7.0。我尝试了很多东西,但都不管用。
HTTP Status 500 - Servlet.init() for servlet appServlet threw exception
type Exception report
message Servlet.init() for servlet appServlet threw exception
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet.init() for servlet appServlet threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
root cause
java.lang.IllegalArgumentException
org.springframework.asm.ClassReader.<init>(Unknown Source)
org.springframework.asm.ClassReader.<init>(Unknown Source)
org.springframework.asm.ClassReader.<init>(Unknown Source)
org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:52)
org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)
org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)
org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:76)
org.springframework.context.annotation.ConfigurationClassParser.getImports(ConfigurationClassParser.java:298)
org.springframework.context.annotation.ConfigurationClassParser.getImports(ConfigurationClassParser.java:300)
org.springframework.context.annotation.ConfigurationClassParser.getImports(ConfigurationClassParser.java:300)
org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:230)
org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:153)
org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:130)
org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:285)
org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:223)
org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:652)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:600)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:666)
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:519)
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:460)
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
javax.servlet.GenericServlet.init(GenericServlet.java:160)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.47 logs.
有源代码:
>
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Processes application requests -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
servlet-context.xml:
?
有人能解释一下问题出在哪里吗?
试试这个:servlet-context.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
<dep:moduleId>
<dep:groupId>org.apache.geronimo.samples.jws</dep:groupId>
<dep:artifactId>Calculator</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>car</dep:type>
</dep:moduleId>
<dep:dependencies>
</dep:dependencies>
</dep:environment>
<context-root>/jaxws-calculator-1.0</context-root>
<service-ref>
<service-ref-name>services/Calculator</service-ref-name>
<port>
<port-name>CalculatorPort</port-name>
<protocol>http</protocol>
<host>localhost</host>
<port>8080</port>
<uri>/jaxws-calculator/calculator</uri>
</port>
</service-ref>
</web-app>
Servlet。init()错误主要是由于spring MVC的Jar文件版本不匹配引起的,请右键单击项目查看所有库
还要从lib文件夹中删除jar库。再次构建项目并运行它。
尝试此配置或相应地重命名配置:我更喜欢将servlet命名为“dispatcher”,将其上下文文件命名为dispatcher servlet。xml。这对我来说很好。
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
嗨,我正在使用Hibernate和Postgresql尝试一个简单的Spring MVC CRUD应用程序。我得到了下面的异常 例外: POM.xml文件 在WEB-INF下 网状物xml文件 spring-servlet.xml文件 com.bean包下的EmployeeBean类 com.controller下的EmployeeController类 com下的EmployeeDao类。dao
我的资源 index.jsp HTTP状态500-servlet Jersey Web应用程序的servlet.init()引发异常 类型异常报告 servlet Jersey Web应用程序的消息servlet.init()引发异常 Apache Tomcat/8.0.43
我正在学习Spring MVC,当我试图运行这个简单索引时。jsp我遇到了这些错误。消息错误与Servlet有关。servlet mvc调度程序的init()引发异常 如果有可能写一个项目并寄给我,非常感谢。 这是我的控制器 这是Web.xml dispatcher-servlet.xml 此索引.jsp
我正在尝试使用简单的Spring MVC项目,但我对Tom Cat有例外 类型异常报告 servlet MVC的消息servlet.init()-Dispatcher引发异常 说明服务器遇到内部错误,导致它无法完成此请求。 我的控制器: My Home.jsp
我完成了这个教程(spring4和hibernate4),我还得到了这个消息: 谁能解释一下是什么问题吗?
在stackoverflow中有很多这样的错误,但我无法解决我的问题。下面是我的简单配置: 来自TOMCAT服务器的context.xml,我在该服务器上配置了用于访问oracle 11g服务器的数据源 web.xml servlet-context.xml以显示我的bean配置 我不知道它是否有用,但你的动作低于我的控制 例外信息 异常javax.servlet.ServletException