2011-03-11 105 views
0

问候,我有一个使用spring和JPA的Web应用程序。日志告诉我一切都是正常运行。但是,我使用Netbeans来创建此应用程序,因此我也将它用于服务器上的部署。Spring + JPA Netbeans部署问题

在部署过程中我得到这个错误:

Starting Tomcat process... 
Waiting for Tomcat... 
Tomcat server started. 
In-place deployment at /root/NetBeansProjects/FYPTest/build/web 
Deployment is in progress... 
deploy?config=file%3A%2Ftmp%2Fcontext9072106357139916321.xml&path=/FYPTest 
Server returned HTTP response code: 400 for URL: http://localhost:8084/manager/deploy?config=file%3A%2Ftmp%2Fcontext9072106357139916321.xml&path=/FYPTest 
/root/NetBeansProjects/FYPTest/nbproject/build-impl.xml:706: The module has not been deployed. 
BUILD FAILED (total time: 50 seconds) 

My applicationContext.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:context="http://www.springframework.org/schema/context" 
     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 
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> 

    <!--bean id="propertyConfigurer" 
      class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" 
      p:location="/WEB-INF/jdbc.properties" /> 
    --> 

<!-- Container Manager Persistence (CMP) Config using Spring+JPA and EclipseLinkProvider--> 
<!-- 
Container Provider: Spring 
Persistence Provider: EclipseLinkJPAProvider 
SPI: Weaving Done by Tomcat (included tomcat-spring-weaver.jar in /lib) 
--> 

<bean id="userService" class="org.seecs.beans.UserDAO"/> 

<bean id="fileService" class="org.seecs.beans.FileDAO"/> <!--Automatic injection of entityManager by container--> 

<!--Bean to load application.properties file --> 
<bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
<property name="location" value="classpath:application.properties"/> 
</bean> 


    <bean id="dataSource" 
      class="org.springframework.jdbc.datasource.DriverManagerDataSource" 
      p:driverClassName="${driverClass}" 
      p:url="${dbURL}" 
      p:username="${dbUserName}" 
      p:password="${dbPassword}" /> 

    <!-- ADD PERSISTENCE SUPPORT HERE (jpa, hibernate, etc)LocalContainerEntityManagerFactoryBean --> 

    <bean id="entityManagerFactory" 
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> 
    <property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml"/> 
     <property name="persistenceUnitName" value="entity-PU"/> 
     <property name="dataSource" ref="dataSource"/> 
     <property name="loadTimeWeaver"> 
      <bean class="org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver"/> 
     </property> 
     <property name="jpaVendorAdapter" ref="vendorAdapter"/> 
    </bean> 

<!--PlaceHolder Values are taken from /classes/application.properties--> 


<bean id="vendorAdapter" class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter"> 
<!--placeholder:${platform}--> 
     <property name="databasePlatform" value="${platform}"/> 
     <property name="showSql" value="true"/> 
     <!--property name="generateDdl" value="true"/ recreares DB schema each time when loaded--> 
    </bean> 


    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> 
     <property name="entityManagerFactory" ref="entityManagerFactory"/> 
    </bean> 

<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/> 

<!-- To tell spring to look for @Transactional <tx:annotation-driven mode="aspectj" /> --> 
<tx:annotation-driven/> 
<!-- If you don't add this, entityManager is not injected and throws NullPointerException--> 
<context:annotation-config /> 

    <!--<context:load-time-weaver aspectj-weaving="on" >--> 

<!--tx:jta-transaction-manager--> 
<context:load-time-weaver aspectj-weaving="on"/> 

</beans> 

My context.xml

<?xml version="1.0" encoding="UTF-8"?> 
<!--Context antiJARLocking="true" path="/FYP"/--> 
<Context docBase="FYPTest" path="/FYPTest"> 
     <Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"/> 
</Context> 

My persistence.xml

<?xml version="1.0" encoding="UTF-8"?> 
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> 
    <persistence-unit name="entity-PU" transaction-type="RESOURCE_LOCAL"> 
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> 
    <properties> 
    </properties> 
    </persistence-unit> 
</persistence> 

其害我不便,因为我必须重新启动服务每次我对任何一个servlet进行更改时

回答

0

对即时我会自己回答这个问题。可能是一个netbeans错误。它在Windows上部署了另一个NetBeans版本。