问题
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.
回答1:
The informational message about Transaction Managers ...
2013-03-08 20:16:26.590:INFO:oejpw.PlusConfiguration:main: No Transaction manager found - if your webapp requires one, please configure one.
Occurs because you do not have a XA Transaction Manager declared in JNDI. Typical configuration for this is in the /WEB-INF/jetty-env.xml or on a server side using a Deployment Context Descriptor.
As for the other error message from Spring, that's a bit more messy to solve.
回答2:
As already noted, the message from jetty about "No transaction manager" is purely informational and can be ignored (you're using a transaction manager that is only known to spring).
As for the other message "No Spring WebApplicationInitializer types detected on classpath" that seems to be a purely informational message from Spring - if you've got a servlet 3.0 webapp and you're using spring 3.2 then the SpringServletContainerInitializer class will be called when your webapp starts up, and it looks for implementations of Spring's WebApplicationInitializer interface on the classpath. Presumably you don't have any, as I've tested jetty-9.0.0.RC2 and jetty-9.0.0 final with spring 3.2 and any such initializers are properly discovered.
regards Jan
来源:https://stackoverflow.com/questions/15294648/there-are-two-questions-when-i-start-jetty