当我开始码头时有两个问题

时间:2013-03-08 13:03:04

标签: jetty

maven + jetty + spring 3.2

我的码头信息:

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找不到事务管理器,但我已经在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>

它说“在类路径上没有检测到Spring Spring WebApplicationInitializer类型”,我还在web.xml中配置了“app-servlet.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>

我的pom.xml:

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

为什么码头警告我这样?如何消除这些异常信息? 感谢您回答这两个问题。

2 个答案:

答案 0 :(得分:3)

正如已经指出的那样,来自码头的关于“无事务管理器”的消息纯粹是信息性的,可以忽略(你使用的是只知道春天的事务管理器)。

至于另一条消息“没有在类路径上检测到的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,并且正确地发现了任何这样的初始化器。

问候 扬

答案 1 :(得分:2)

有关交易管理员的信息性消息......

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

因为您没有XA Transaction Manager declared in JNDI而发生。 典型配置位于/WEB-INF/jetty-env.xml或服务器端使用Deployment Context Descriptor

至于Spring的其他错误消息that's a bit more messy to solve

相关问题