我目前正在尝试在本地Websphere 8.5 Liberty配置文件中在RAD 9中运行一个非常简单的Spring应用程序。代码来自此网站:http://www.programcreek.com/2014/02/spring-mvc-helloworld-using-maven-in-eclipse/
我正在使用Maven。这是我的pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.pncbank.cdd</groupId>
<artifactId>cddsample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>cddsample Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.1.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.1.5.RELEASE</version>
<exclusions>
<exclusion>
<artifactId>spring-aop</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.1.5.RELEASE</version>
<exclusions>
<exclusion>
<artifactId>spring-aop</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.1.5.RELEASE</version>
</dependency>
</dependencies>
<build>
<finalName>cddsample</finalName>
</build>
<packaging>war</packaging>
</project>
WEB-INF / views中有一个非常简单的视图。控制器在Java类中定义Spring DispatcherServlet在web.xml中配置,如上面提到的教程中所述:
HelloWorldController.java
package com.programcreek.helloworld.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class HelloWorldController {
String message = "Welcome to Spring MVC!";
public HelloWorldController(){
int i = 5;
}
@RequestMapping("/hello")
public ModelAndView showMessage(
@RequestParam(value = "name", required = false, defaultValue = "World") String name) {
System.out.println("in controller");
ModelAndView mv = new ModelAndView("helloworld");
mv.addObject("message", message);
mv.addObject("name", name);
return mv;
}
}
的web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Archetype Created Web Application</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/dispatcher-servlet.xml</param-value>
<description/>
</context-param>
<servlet>
<servlet-name>DispatcherServlet</servlet-name>
<display-name>DispatcherServlet</display-name>
<description/>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>DispatcherServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
我已到达应用程序运行的位置,我可以访问一个简单的index.jsp。但是,任何其他路线都会导致以下错误。
我发现了许多处理这个特定错误的问题和帖子,但没有真正帮助诊断或解决它。我已经回顾了DispatcherServlet的所有依赖项,据我所知,它们都存在于已部署的jar文件中。任何指导将不胜感激!! TIA!
错误404:javax.servlet.UnavailableException:SRVE0203E:Servlet [DispatcherServlet]:org.springframework.web.servlet.DispatcherServlet 被发现,但缺少另一个必修课。 SRVE0206E:这个 错误通常意味着servlet最初是使用编译的 服务器无法找到的类。 SRVE0187E:检查你的 类路径,以确保servlet所需的所有类 present.SRVE0210I:可以通过重新编译来调试此问题 servlet仅使用应用程序的运行时类路径中的类 SRVE0234I:应用程序类路径= [C:\ Program FILES \ IBM \的WebSphere \ AppServer的\ java的\ lib中; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ java的\ LIB \ dt.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ java的\ LIB \在htmlconverter.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ java的\ LIB \ ibmorbtools.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ java的\ LIB \ jconsole.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ java的\ LIB \ tools.jar中; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\型材\ AppSrv1 \类; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\类; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ lib中; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ COBOLCallStubGenerator.zip; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ EJBCommandTarget.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ IVTClient.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ OTiSConvertTime.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \激活impl.jar中; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ admin.config.jobcl.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ admin.config.rules.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ admin.config.sched.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ aspectjrt.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ batch.wccm.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ batchpmi.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ batchprops.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ batchutilsfep.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ batfepapi.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ bootstrap.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ BSF-engines.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ com.ibm.rls.jdbc.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ commandlineutils.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \公地discovery.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ databeans.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ ffdcSupport.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ htmlshell.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ iscdeploy.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ j2ee.jar的; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ jNative2ascii.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ jacl.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ jrom.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ launchclient.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ lmproxy.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \邮件impl.jar中; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ openwebbeans.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ PC-appext.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ pmirm4arm.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ RRD的appext.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ rsadbutils.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ rsahelpers.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ serviceadapter.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ setup.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ startup.jar文件; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ tcljava.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ urlprotocols.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ wasservicecmd.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ wses_dynaedge.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ LIB \ WSIF-compatb.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ installedChannels; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\网络\帮助; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\部署工具\ ITP \插件\ com.ibm.etools.ejbdeploy \运行; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\部署工具\ ITP \插件\ com.ibm.etools.ejbdeploy \运行\ batch.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\部署工具\ ITP \插件\ com.ibm.etools.ejbdeploy \运行\ ejbdeploy.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\部署工具\ ITP \插件\ com.ibm.etools.ejbdeploy \运行\ ejbmapvalidate.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\德比\ LIB \的derby.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ installedConnectors \ sib.api.jmsra.rar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ com.ibm.mq.commonservices.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ com.ibm.mq.connector.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ com.ibm.mq.headers.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ com.ibm.mq.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ com.ibm.mq.jmqi.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ com.ibm.mq.jmqi.local.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ com.ibm.mq.jmqi.remote.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ com.ibm.mq.jmqi.system.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ com.ibm.mq.jms.admin.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ com.ibm.mq.pcf.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ com.ibm.mqjms.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ com.ibm.msg.client.commonservices.j2se.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ com.ibm.msg.client.commonservices.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ com.ibm.msg.client.jms.internal.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ com.ibm.msg.client.jms.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ com.ibm.msg.client.matchspace.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ com.ibm.msg.client.provider.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ com.ibm.msg.client.ref.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ com.ibm.msg.client.wmq.common.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ com.ibm.msg.client.wmq.factories.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ com.ibm.msg.client.wmq.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ com.ibm.msg.client.wmq.v6.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\ installedConnectors \ wmq.jmsra.rar \ dhbcore.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的\型材\ AppSrv1 /性能; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的/性能; C:\ PROGRAM FILES \ IBM \的WebSphere \ appserver / lib中/ startup.jar文件; C:\ PROGRAM FILES \ IBM \的WebSphere \ appserver / lib中/ bootstrap.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ appserver / lib中/ JSF-nls.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ appserver / lib中/ lmproxy.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ appserver / lib中/ urlprotocols.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的/部署工具/ ITP / batchboot.jar; C:\ PROGRAM FILES \ IBM \的WebSphere \ AppServer的/部署工具/ ITP / batch2.jar; C:\ PROGRAM 文件\ IBM \的WebSphere \ AppServer的/ JAVA / LIB / tools.jar中; C:\用户\ PT35330 \ IBM \ rationalsdp \ workspace.metadata.plugins \ org.eclipse.wst.server.core \ TMP1 \ cddsample \ WEB-INF \类; C:\用户\ PT35330 \ IBM \ rationalsdp \ workspace.metadata.plugins \ org.eclipse.wst.server.core \ TMP1 \ cddsample \ WEB-INF \ lib中\ aopalliance-1.0.jar; C:\用户\ PT35330 \ IBM \ rationalsdp \ workspace.metadata.plugins \ org.eclipse.wst.server.core \ TMP1 \ cddsample \ WEB-INF \ lib中\共享记录-1.2.jar; C:\用户\ PT35330 \ IBM \ rationalsdp \ workspace.metadata.plugins \ org.eclipse.wst.server.core \ TMP1 \ cddsample \ WEB-INF \ lib中\弹簧豆-4.1.5.RELEASE.jar; C:\用户\ PT35330 \ IBM \ rationalsdp \ workspace.metadata.plugins \ org.eclipse.wst.server.core \ TMP1 \ cddsample \ WEB-INF \ lib中\弹簧上下文4.1.5.RELEASE.jar; C:\用户\ PT35330 \ IBM \ rationalsdp \ workspace.metadata.plugins \ org.eclipse.wst.server.core \ TMP1 \ cddsample \ WEB-INF \ lib中\弹簧芯4.1.5.RELEASE.jar; C:\用户\ PT35330 \ IBM \ rationalsdp \工作区.metadata.plugins \ org.eclipse.wst.server.core \ TMP1 \ cddsample \ WEB-INF \ lib中\ SPRI NG-表达-4.1.5.RELEASE.jar; C:\用户\ PT35330 \ IBM \ rationalsdp \ workspace.metadata.plugins \ org.eclipse.wst.server.core \ TMP1 \ cddsample \ WEB-INF \ lib中\弹簧-webmvc-4.1.5.RELEASE.jar; C:\用户\ PT35330 \ IBM \ rationalsdp \ workspace.metadata.plugins \ org.eclipse.wst.server.core \ TMP1 \ cddsample]