3

maven + jetty + spring 3.2

My jetty infomation:

2013-03-08 20:16:23.541:INFO:oejs.Server:main: jetty-9.0.0.RC2
2013-03-08 20:16:26.590:INFO:oejpw.PlusConfiguration:main: No Transaction manager found - if your webapp requires one, please configure one.
[DEBUG][2013-03-08 20:16:35,801]->org.eclipse.jetty.util.log [Logging to org.slf4j.impl.Log4jLoggerAdapter(org.eclipse.jetty.util.log) via org.eclipse.jetty.util.log.Slf4jLog]
2013-03-08 20:16:35.848:INFO:/:main: No Spring WebApplicationInitializer types detected on classpath
2013-03-08 20:16:36.743:INFO:/:main: Initializing Spring FrameworkServlet 'app-servlet'

Jetty can't find the transaction manager but I have already configured it in my spring application-context(app-servlet.xml):

<!-- 使用注解方式管理事务 -->
    <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
<!-- 配置事务管理 -->
    <bean id="transactionManager"
        class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory"></property>
    </bean>

And it says "No Spring WebApplicationInitializer types detected on classpath", I have also configured "app-servlet.xml" in web.xml:

<!-- spring mvc的dispatcherServlet负责转发请求 -->
    <servlet>
        <servlet-name>app-servlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <!-- spring context文件 -->
            <param-name>contextConfigLocation</param-name>
            <param-value>
                classpath*:/spring/**/app-*.xml
            </param-value>
        </init-param>
        <!-- 服务启动的时候第一个将此servlet初始化加载,非零的时候,数字越小,优先级越高 -->
        <load-on-startup>1</load-on-startup>
    </servlet>

My pom.xml:

<!-- jetty -->
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>9.0.0.RC2</version>
            </plugin>

Why did jetty warn me like that? How can I eliminate these abnormal infomation? Thank for answer these two questions.

4

2 回答 2

3

如前所述,来自码头的关于“没有事务管理器”的消息纯粹是信息性的,可以忽略(您正在使用只有 spring 知道的事务管理器)。

至于另一条消息“在类路径上未检测到 Spring WebApplicationInitializer 类型”,这似乎是来自 Spring 的纯粹信息性消息 - 如果您有一个 servlet 3.0 webapp 并且您正在使用 spring 3.2,那么当您的 SpringServletContainerInitializer 类将被调用webapp 启动,它在类路径上查找 Spring 的 WebApplicationInitializer 接口的实现。大概你没有,因为我已经用 spring 3.2 测试了 jetty-9.0.0.RC2 和 jetty-9.0.0 final,并且正确地发现了任何此类初始化程序。

问候简

于 2013-03-09T22:35:23.450 回答
2

关于事务管理器的信息性消息...

2013-03-08 20:16:26.590:INFO:oejpw.PlusConfiguration:main: No Transaction manager found - if your webapp requires one, please configure one.

发生是因为您没有在 JNDI 中声明 XA 事务管理器。对此的典型配置是/WEB-INF/jetty-env.xml使用部署上下文描述符在服务器端或服务器端。

至于来自 Spring 的其他错误消息,解决起来有点混乱

于 2013-03-08T14:18:39.043 回答