我正在用Maven和Hibernate开发一个基于MVC的spring应用程序。当我尝试在Apache服务器上运行它时,Apache服务器在第2行给我一个“spring Servlet不可用”的错误。这是我的POM文件:
<?xml version="1.0" encoding="UTF-8"?>
http://Maven.apache.org/xsd/maven-4.0.0.xsd“>4.0.0 MavenWeb MavenWeb war 0.0.1-快照maven-compiler-plugin 3.1 1.7 1.7 java.net.m2repo java.net Maven 2存储库http://download.java.net/Maven/2/default
<properties>
<spring.version>4.0.1.RELEASE</spring.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- Spring dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.1rc2</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.5.5-Final</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4.public_draft</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-jpa</artifactId>
<version>4.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>4.0.6.RELEASE</version>
</dependency>
</dependencies>
我也从控制台发布错误:
SEVERE: Error loading WebappClassLoader
context: /MavenWeb
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@5babd8cb
org.springframework.web.servlet.DispatcherServlet
java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1128)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1026)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4425)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4738)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
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:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Sep 02, 2014 4:38:24 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /MavenWeb threw load() exception
java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1128)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1026)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4425)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4738)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
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:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Sep 02, 2014 4:38:24 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Sep 02, 2014 4:38:24 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Sep 02, 2014 4:38:24 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/10 config=null
Sep 02, 2014 4:38:24 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 424 ms
Sep 02, 2014 4:38:26 PM org.apache.catalina.core.StandardWrapperValve invoke
INFO: Servlet spring is currently unavailable
java.lang.ClassNotFoundException
在类加载器找不到指定的类时发生。因此,您的war
文件(如果您没有部署war
,则为应用程序部署目录)在WEB-INF/lib目录(web应用程序在构建时将其所有maven依赖项转储到的位置)中没有适当的springjar
。
您通常会在application deployment目录中找到部署的web应用程序(作为war
文件):
[TOMCAT_HOME]/webapps/[myWebApplication]
如果使用WTP通过Eclipse进行部署,则此目录可能与实际的Tomcat安装不同。就像是
[ECLIPSE_WORKSPACE]/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/[myWebApplication]
您可以通过检查Eclipse Tomcat服务器配置找到确切的目录,它有一个名为“服务器位置”的部分(双击Eclipse Servers选项卡中的Tomcat V[Version]Server at localhost
)。
尝试在POM中使用此依赖项:
<properties>
<java-version>1.6</java-version>
<org.springframework-version>4.0.3.RELEASE</org.springframework-version>
<org.aspectj-version>1.7.4</org.aspectj-version>
<org.slf4j-version>1.7.5</org.slf4j-version>
<hibernate.version>4.3.5.Final</hibernate.version>
</properties>
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework-version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<!-- Apache Commons DBCP -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<!-- Spring ORM -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<!-- AspectJ -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${org.aspectj-version}</version>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${org.slf4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${org.slf4j-version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${org.slf4j-version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<exclusions>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
<scope>runtime</scope>
</dependency>
<!-- @Inject -->
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
</dependencies>
这适用于基本的spring 4、Hibernate4 MVC应用程序
将postgresql依赖项添加到上面的依赖项列表中。
我正在尝试将基于Rest的Web服务应用程序部署到Weblogic控制台12C上。为此,我使用了Spring Jersey实现和Spring依赖注入 在尝试访问我的服务时,我必须使用Weblogic的/resources/*路径,因为/rest/*不起作用。此外,SpringServlet没有被调用,但Weblogic自己的JAX-RS Jersey实现正在工作。我已经检查过了,在应用程序启动期间
问题内容: 我的应用程序在Instagram上共享照片,为此,首先将其保存在一个临时目录中: 它正在工作,但不起作用。 给定的错误消息是: stringByAppendingPathComponent不可用:在NSURL上使用URLByAppendingPathComponent。 问题答案: 看来该方法已在Swift 2.0中删除,因此错误消息建议使用: 更新: 已被替换为:
问题内容: 此前的情况下,你能够传递的或。 不再可用,我应该怎么用呢? (这是一个规范的Q&一对,以防止与此相关的重复的问题洪水和变化与iOS 10和SWIFT 3) 问题答案: Swift 3更新: 看来Xcode 8 / Swift 3带回来了: 已重命名为iOS SDK和从iOS SDK中删除。对于“普通”选项,请使用一个空数组来构造一个空选项集。
我将Spring Security从2升级为3 以前的security.xml具有AuthenticationProcessingFilter和AuthenticationProcessingFilterEntryPoint
我在Windows子系统Linux上安装了kafka,并开始使用命令服务启动,所有服务都已启动。现在,当我尝试从Windows运行我的kafka-spring应用程序时,它显示以下错误:- 无法建立与节点-1(localhost/127.0.0.1:9092)的连接。经纪人可能不可用。 我的服务器属性是:- 我哪里出错了???
问题内容: 我的应用程序尝试从JAVA加载RSA算法提供程序类时遇到错误。异常堆栈如下: 我已经搜索了错误消息,并且大多数帖子都说这是因为JVM无法找到sunjce_provider.jar。但是,我可以在/ Library / Java / Home / lib / ext文件夹中找到该文件。 该平台是Mac OS X 10.6,Java版本是1.6.0_17。 我的问题是: 为什么JVM不会在
Java版本:JDK-8.0.144 参考: nosuchAlgorithmException:SSL_TLSv2 SSLContext不可用#我使用的是tomcat而不是websphere,所以第2点的答案不太相关。 https://community.hitachivantara.com/s/question/0d52s00007thjo2sae/how-to-fix-tls-sslconte