我在tomcat7上部署我的项目时,我的applicationContext.xml无效:org.springframework.beans.factory.parsing.BeanDefinitionParsingExceptio?

时间:2013-08-11 07:06:09

标签: spring maven

我尝试在s tomcat 7服务器上部署我的项目,但没有结果。我的申请是一个maven项目。我用它在春天休眠jaxws。我用jax-ws maven插件生成了wsdl文件。 3天但没有结果没有当我在tomcat7上部署我的项目(.war)时出现了这个错误:

août 11, 2013 7:49:49 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments     was not found on the java.library.path: C:\Program Files\Java\jdk1.7.0_21\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program   Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\Program   Files\MiKTeX 2.9\miktex\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Orant\bin;C:\Centrun;C:\LHS\BSCS_iX_R2_Demo;C:\LHS\BSCS_iX_R2_Demo\bin\win32;C:\LHS\BSCS_iX_R2_Demo\3pp\win32;C:\LHS\BSCS_iX_R2_Demo\TAO1.3aP12_WinXP\ACE_wrappers\bin;C:\LHS\BSCS_iX_R2_Demo\TAO1.3aP12_WinXP\ACE_wrappers\lib;C:\LHS\BSCS_iX_R2_Demo\jdk1.5.0_06\bin;C:\Program Files\apache-maven-3.1.0\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Users\sayed\Desktop\eclipse\eclipse;;.
août 11, 2013 7:49:49 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to   'org.eclipse.jst.jee.server:BSCSWebservices' did not find a matching property.
août 11, 2013 7:49:50 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
août 11, 2013 7:49:50 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
août 11, 2013 7:49:50 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2106 ms
août 11, 2013 7:49:50 AM org.apache.catalina.core.StandardService startInternal
INFO: Démarrage du service Catalina
août 11, 2013 7:49:50 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.42
août 11, 2013 7:49:57 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\sayed\Desktop\Plateforme- webservices\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\BSCSWebservices\WEB-INF\lib\servlet-api- 2.5.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
 août 11, 2013 7:50:20 AM org.apache.catalina.core.ApplicationContext log
 INFO: No Spring WebApplicationInitializer types detected on classpath
 log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
 log4j:WARN Please initialize the log4j system properly.
 log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
 août 11, 2013 7:50:21 AM org.apache.catalina.core.ApplicationContext log
 INFO: Loading Spring root WebApplicationContext
 août 11, 2013 7:50:31 AM org.apache.catalina.core.StandardContext listenerStart
 SEVERE: Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de        classe d'écoute (listener) org.springframework.web.context.ContextLoaderListener
  org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to   locate     NamespaceHandler for namespace [http://www.springframework.org/schema/context]
   Offending resource: ServletContext resource [/WEB-INF/applicationContext.xml]
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:57)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:64)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:55)
at   org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1144)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1137)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:145)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:89)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:499)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:407)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:357)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:126)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:142)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:123)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:91)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:94)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:294)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)

     août 11, 2013 7:50:31 AM org.apache.catalina.core.StandardContext startInternal
      SEVERE: Error listenerStart
       août 11, 2013 7:50:31 AM org.apache.catalina.core.StandardContext startInternal
      SEVERE: Erreur de démarrage du contexte [/BSCSWebservices] suite aux erreurs précédentes
       août 11, 2013 7:50:31 AM org.apache.catalina.core.ApplicationContext log
       INFO: Closing Spring root WebApplicationContext
       août 11, 2013 7:50:32 AM org.apache.coyote.AbstractProtocol start
       INFO: Starting ProtocolHandler ["http-bio-8080"]
       août 11, 2013 7:50:32 AM org.apache.coyote.AbstractProtocol start
        INFO: Starting ProtocolHandler ["ajp-bio-8009"]
        août 11, 2013 7:50:32 AM org.apache.catalina.startup.Catalina start
      INFO: Server startup in 41380 ms

这是我的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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
xmlns:ws="http://jax-ws.dev.java.net/spring/core" xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans
 http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
 http://www.springframework.org/schema/aop 
 http://www.springframework.org/schema/aop/spring-aop-3.2.xsd 
 http://www.springframework.org/schema/tx 
 http://www.springframework.org/schema/tx/spring-tx-3.2.xsd 
 http://www.springframework.org/schema/context 
 http://www.springframework.org/schema/context/spring-context-3.2.xsd 
 http://jax-ws.dev.java.net/spring/core 
 http://jax-ws.java.net/spring/core.xsd 
 http://jax-ws.dev.java.net/spring/servlet 
 http://jax-ws.java.net/spring/servlet.xsd">


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

<tx:annotation-driven transaction-manager="transactionManager" />
<bean id="transactionManager"
    class="org.springframework.orm.hibernate4.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
</bean>

<bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="org.postgresql.Driver" />
    <property name="url" value="jdbc:postgresql://localhost:5432/webservices" />
    <property name="username" value="postgres" />
    <property name="password" value="1234" />
</bean>



<bean id="sessionFactory"
    class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="packagesToScan" value="com" />
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.hbm2ddl.auto">update</prop>
            <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
            <prop key="hibernate.show_sql">true</prop>
        </props>
    </property>
</bean>

<!-- Billing account read ws -->
<wss:binding url="/hello">
    <wss:service>
        <ws:service bean="#helloWs">
        </ws:service>
    </wss:service>
</wss:binding>

<bean id="helloWs" class="com.ws.HelloService" />
   </beans>

这是我的pom

<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>PlateformeWebservices</groupId>
<artifactId>BSCSWebservices</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>


<dependencies>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>3.2.3.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>3.2.3.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>9.1-901.jdbc4</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>3.2.3.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.0.4</version>
    </dependency>
    <dependency>
        <groupId>org.jdom</groupId>
        <artifactId>jdom</artifactId>
        <version>1.1</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>3.2.3.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.5</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>3.2.3.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.16</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>3.2.3.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-commons-annotations</artifactId>
        <version>3.2.0.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.0.0.Final</version>
    </dependency>
    <dependency>
        <groupId>com.liferay.portal</groupId>
        <artifactId>util-java</artifactId>
        <version>6.0.2</version>
    </dependency>




    <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>jaxws-rt</artifactId>
        <version>2.2.3</version>

    </dependency>

    <dependency>
        <groupId>soi_jar</groupId>
        <artifactId>soi</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>func_frwmwk_clt_jar</groupId>
        <artifactId>func_frwmwk_clt</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>func_frwmwk_cmn_jar</groupId>
        <artifactId>func_frwmwk_cmn</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>func_frwmwk_srv_jar</groupId>
        <artifactId>func_frwmwk_srv</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>func_util_jar</groupId>
        <artifactId>func_util</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>ott_utilities_jar</groupId>
        <artifactId>ott_utilities</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>toplink_jar</groupId>
        <artifactId>toplink</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>jgroups_jar</groupId>
        <artifactId>jgroups</artifactId>
        <version>1.2</version>
    </dependency>




    <dependency>
        <groupId>com.sun.xml.stream.buffer</groupId>
        <artifactId>streambuffer</artifactId>
        <version>0.8</version>
    </dependency>
    <dependency>
        <groupId>org.jvnet.jax-ws-commons.spring</groupId>
        <artifactId>jaxws-spring</artifactId>
        <version>1.8</version>
        <exclusions>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.jvnet.staxex</groupId>
                <artifactId>stax-ex</artifactId>
            </exclusion>

            <!-- <exclusion> -->
            <!-- <groupId>javax.servlet</groupId> -->
            <!-- <artifactId>servlet-api</artifactId> -->
            <!-- </exclusion> -->

            <exclusion>
                <groupId>com.sun.xml.stream.buffer</groupId>
                <artifactId>streambuffer</artifactId>
            </exclusion>

            <!-- <exclusion> -->
            <!-- <groupId>com.sun.xml.bind</groupId> -->
            <!-- <artifactId>jaxb-impl</artifactId> -->
            <!-- </exclusion> -->

            <!-- <exclusion> -->
            <!-- <groupId>javax.activation</groupId> -->
            <!-- <artifactId>activation</artifactId> -->
            <!-- </exclusion> -->
        </exclusions>

    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        <version>3.2.3.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
    </dependency>

</dependencies>
<build>

    <resources>
        <resource>
            <filtering>true</filtering>
            <directory>src/main/resources</directory>
        </resource>
    </resources>


    <finalName>BSCSWebservices</finalName>

    <pluginManagement>
        <plugins>
            <!--This plugin's configuration is used to store Eclipse m2e settings 
                only. It has no influence on the Maven build itself. -->
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.jvnet.jax-ws-commons</groupId>
                                    <artifactId>jaxws-maven-plugin</artifactId>
                                    <versionRange>[2.1,)</versionRange>
                                    <goals>
                                        <goal>wsgen</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute />
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.jvnet.jax-ws-commons</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <version>2.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>wsgen</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <genWsdl>true</genWsdl>
                    <verbose>true</verbose>

                    <sei>com.ws.HelloService</sei>

                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>com.sun.xml.ws</groupId>
                        <artifactId>jaxws-rt</artifactId>
                        <version>2.1.7</version>
                    </dependency>
                </dependencies>
            </plugin>


            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>


        </plugins>
    </pluginManagement>

   </build>

       </project>

1 个答案:

答案 0 :(得分:2)

看起来类路径中缺少spring-context。检查你的war文件中是否有这种依赖。