2012-01-03 71 views
0

所以基本上我使用的是什么..春3.1部分 - NetBeans - 部署失败

  • 春3.1

  • 的Netbeans 7(ISH)

  • 的Tomcat 7(一说与netbeans一起安装)

我注意到的是,如果我创建一个新的spring应用程序thr尽管使用Spring 3.0.2的NetBeans,一切正常。但是,如果我创建一个新的应用程序和使用Spring 3.1的jar文件我从SpringSource的下载(同那些我用我的应用程序),我收到以下错误:

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> 

应用程ationContext.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应用程序无法部署?

+1

如果在日志中没有其他东西,它似乎并没有弹簧相关 – Bozho 2012-01-03 09:51:47

+0

啊,是的,日志中有一些信息。我忘了他们,我想我错过了日志工厂。错误是:“java.lang.NoClassDefFoundError:org/slf4j/LoggerFactory” – Fittersman 2012-01-03 10:52:57

回答

0

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