没有加载Spring XML,SEVERE错误:监听器启动?

时间:2014-03-21 06:56:01

标签: java xml spring hibernate spring-mvc

在我添加“transaction-manager”名称空间之前,它工作正常。我错过了我的代码中的任何内容,我无法访问主页,它说SEVERE错误:监听器启动

<?xml version="1.0" encoding="UTF-8"?>
<beans
        xmlns="http://www.springframework.org/schema/beans"
        xmlnssi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:tx="http://www.springframework.org/schema/tx"
        xmlns:mvc="http://www.springframework.org/schema/mvc"
        xmlns:jee="http://www.springframework.org/schema/jee"
    xmlns:jms="http://www.springframework.org/schema/jms"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
                               http://www.springframework.org/schema/beans/spring-beans-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/mvc
                                           http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
                                               http://www.springframework.org/schema/context
                           http://www.springframework.org/schema/context/spring-context-3.0.xsd
                           http://www.springframework.org/schema/jms
                           http://www.springframework.org/schema/jms/spring-jms.xsd
                           http://activemq.apache.org/schema/core
                           http://activemq.apache.org/schema/core/activemq-core.xsd
                           http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.0.xsd"
                                                xmlns="http://www.springframework.org/schema/p">

        <context:component-scan base-package="com.test.survey"/>
        <context:annotation-config/>
        <tx:annotation-driven transaction-manager="transactionManager"/>
        <mvc:annotation-driven/>
        <!--  <jee:jndi-lookup id="jmsConnectionFactory" jndi-name="jms/ConnectionFactory" resource-ref="true"></jee:jndi-lookup>
        <jee:jndi-lookup id="jmsQueue" jndi-name="jms/DroolsQueue" resource-ref="true" proxy-interface="javax.jms.Queue"></jee:jndi-lookup>-->

        <bean id="SMStypeUrlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
            <props>
                                <prop key="test.html">dashboardController</prop>
                        </props>
                </property>
        </bean>
        <bean id="multipartResolver"
                class="org.springframework.web.multipart.commons.CommonsMultipartResolver" />

        <bean id="dashboardController" class="com.test.survey.controller.OrderController" />

        <bean id="orderSender" class="com.test.survey.producer.OrderSender" />
        <bean id="orderService" class="com.test.survey.producer.OrderService" />


        <bean id="orderDataSource"
           class="org.apache.commons.dbcp.BasicDataSource">
                <property name="driverClassName"
                        value="com.mysql.jdbc.Driver">
                </property>
                <property name="url"
                        value="jdbc:mysql://localhost:3307/test">
                </property>
                <property name="username" value="root"></property>
                <property name="password" value="test"></property>
        </bean>

        <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
                <property name="orderDataSource" ref="orderDataSource"></property>
                <property name="hibernateProperties">
                        <props>
                                <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
                                <prop key="hibernate.show_sql">true></prop>
                        </props>
                </property>
                <property name="packagesToScan" value="com.test.survey.domain"></property>
        </bean>

        <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
                <property name="sessionFactory" ref="sessionFactory"></property>
        </bean>

        <bean id="orderDAO" class="com.test.survey.dao.OrderDAOImpl" >
                <property name="dataSource" ref="orderDataSource"></property>
        </bean>

        <bean id="orderListener" class="com.test.survey.listener.OrderListener" />

        <bean id ="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" >
                <property name="prefix">
                        <value>/WEB-INF/</value>
                </property>
                <property name="suffix">
                        <value>.jsp</value>
                </property>
        </bean>        

        <bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
                <property name="brokerURL">
                        <value>tcp://localhost:61616</value>
                </property>
        </bean>
        <bean id="destination" class="org.apache.activemq.command.ActiveMQQueue">
                <constructor-arg value="hraQueue"/>
        </bean>
        <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
                <property name="connectionFactory" ref="connectionFactory" />
                <property name="defaultDestination" ref="destination" />
        </bean>        
        <jms:listener-container  connection-factory="connectionFactory">
                    <jms:listener destination="hraQueue" ref="orderListener" method="orderProcessed"/>
        </jms:listener-container>
</beans>

这是我的web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
        xmlns="http://java.sun.com/xml/ns/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:jms="http://www.springframework.org/schema/jms"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
        http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

        <servlet>
                <servlet-name>mvc-dispatcher</servlet-name>
                <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
                <load-on-startup>1</load-on-startup>
        </servlet>

        <servlet-mapping>
                <servlet-name>mvc-dispatcher</servlet-name>
                <url-pattern>/</url-pattern>
        </servlet-mapping>

        <servlet-mapping>
                <servlet-name>mvc-dispatcher</servlet-name>
                <url-pattern>/js</url-pattern>
        </servlet-mapping>

        <servlet>
   <servlet-name>drools</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>drools</servlet-name>
    <url-pattern>*.html</url-pattern>
  </servlet-mapping>
  <context-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>/WEB-INF/drools-servlet.xml</param-value>
        </context-param>

        <listener>
                <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

<!--   <resource-ref>
          <res-ref-name>jms/ConnectionFactory</res-ref-name>
          <res-type>org.apache.activemq.ActiveMQConnectionFactory</res-type>
          <res-auth>Container</res-auth>
          <res-sharing-scope>Shareable</res-sharing-scope>
  </resource-ref>
  <resource-ref>
          <res-ref-name>jms/DroolsQueue</res-ref-name>
          <res-type>org.apache.activemq.command.ActiveMQQueue</res-type>
          <res-auth>Container</res-auth>
          <res-sharing-scope>Shareable</res-sharing-scope>
  </resource-ref> -->
</web-app>

我没有收到任何错误,但我的.war文件已加载。我错过了xml中的任何内容吗?有什么建议我的应用程序没有加载?

0 个答案:

没有答案