spring 3.1 - netbeans - 部署失败

标签 spring tomcat netbeans

所以基本上我使用的是..

  • Spring 3.1

  • Netbeans 7(ish)

  • tomcat 7(安装netbeans的那个)

我注意到,如果我使用 spring 3.0.2 通过 netbeans 创建一个新的 spring 应用程序,一切正常。但是,如果我创建一个新应用程序并使用我从 springsource 下载的 spring 3.1 jar 文件(与我在我的应用程序中使用的相同),我会收到以下错误:

Undeploying ...
OK - Undeployed application at context path /FitterBlog
In-place deployment at /home/cleippi/www/spring/fitterblog/FitterBlog/build/web
Deployment is in progress...
deploy?config=file%3A%2Ftmp%2Fcontext8937986122931458489.xml&path=/FitterBlog
FAIL - Deployed application at context path /FitterBlog but context failed to start
/home/cleippi/www/spring/fitterblog/FitterBlog/nbproject/build-impl.xml:736: 
The module has not been deployed.
    at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:210)
    at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:106)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at org.apache.tools.ant.Target.performTasks(Target.java:411)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
    at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:284)
    at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539)
    at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
BUILD FAILED (total time: 9 seconds)

这是我的代码:

web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 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_3_0.xsd">
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>*.htm</url-pattern>
</servlet-mapping>
<session-config>
    <session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
    <welcome-file>redirect.jsp</welcome-file>
</welcome-file-list>
</web-app>

调度程序-servlet.xml:

<?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"
   xmlns:aop="http://www.springframework.org/schema/aop"
   xmlns:tx="http://www.springframework.org/schema/tx"
   xmlns:context="http://www.springframework.org/schema/context"

   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
   http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
   http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
   http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<context:component-scan base-package="com.fitterblog.controllers"/>
<context:annotation-config/>

<!-- tiles configuration -->
<bean id="tilesViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
    <property name="viewClass">
        <value>org.springframework.web.servlet.view.tiles2.TilesView</value>
    </property>
</bean>

<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
    <property name="definitions">
        <list>
            <value>/WEB-INF/tiles.xml</value>
        </list>
    </property>
</bean>

<!-- was here by netbeans -->
<bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>

</beans>

应用程序上下文.xml:

<?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"
   xmlns:aop="http://www.springframework.org/schema/aop"
   xmlns:tx="http://www.springframework.org/schema/tx"

   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
   http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
   http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

</beans>

我试图用谷歌搜索这个问题,但是这个非常普遍的错误似乎有许多不同的解决方案,但没有任何帮助。有谁知道是什么导致我的 Spring 应用程序部署失败?

最佳答案

问题是您的类路径/WEB-INF/lib 中没有 slf4j.jar。将 slf4j 添加到您的项目依赖项中。

关于spring 3.1 - netbeans - 部署失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8710255/

相关文章:

java - Netbeans 中未显示输出框

tomcat - Log4J 与 Tomcat 集成 - catalina.out 日志文件轮换

Java Web 应用程序 - 下载的文件不可读

netbeans - 如何在 Linaro 13.01 ubuntu tty1 中安装 Oracle JDK 7 和 Netbeans IDE?

javax bean 验证无法解析消息代码

maven - maven命令行手动指定tomcat部署目录

java - Ubuntu (NetBeans) 上的可执行 JAR

java - ResponseEntity<T> 和@ResponseBody 有什么区别?

jquery - Spring MVC jQuery 远程验证

spring - MockBean stub 无效