1
我使用Spring 3.2.3.RELEASE,谷歌吉斯3.0,吉斯 - 庫2.1.0,吉斯-的servlet 3.0和Hibernate 3無法啓動吉斯庫噴油器
,當我在servlet的模塊安裝JpaRepository( web.xml),我得到了運行時錯誤。
下面是源代碼
public class JpaGuiceServletConfig extends GuiceServletContextListener {
@Override
protected Injector getInjector() {
return Guice.createInjector(new ServletModule(){
@Override
protected void configureServlets() {
this.install(new JpaRepositoryModule("ptol-persistence-unit") {
@Override
protected void bindRepositories(RepositoryBinder binder) {
binder.bind(CategoryRepository.class).to("ptol-persistence-unit");
}
});
//filter("/*").through(PersistFilter.class);
}
});
}
}
在web.xml中
<!-- Listener Configuration -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>phattuonline.common.base.JpaGuiceServletConfig</listener-class>
</listener>
我得到了錯誤:
Jul 10, 2013 4:37:05 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class phattuonline.common.base.JpaGuiceServletConfig
java.lang.NoSuchMethodError: org.springframework.transaction.annotation.AnnotationTransactionAttributeSource.<init>(Lorg/springframework/transaction/annotation/TransactionAnnotationParser;)V
at com.google.code.guice.repository.configuration.JpaRepositoryModule.createTransactionAttributeSource(JpaRepositoryModule.java:283)
at com.google.code.guice.repository.configuration.JpaRepositoryModule.configure(JpaRepositoryModule.java:170)
at com.google.inject.AbstractModule.configure(AbstractModule.java:59)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
at com.google.inject.AbstractModule.install(AbstractModule.java:118)
at phattuonline.common.base.JpaGuiceServletConfig$1.configureServlets(JpaGuiceServletConfig.java:19)
at com.google.inject.servlet.ServletModule.configure(ServletModule.java:53)
at com.google.inject.AbstractModule.configure(AbstractModule.java:59)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
at com.google.inject.spi.Elements.getElements(Elements.java:101)
at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:133)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
at com.google.inject.Guice.createInjector(Guice.java:95)
at com.google.inject.Guice.createInjector(Guice.java:72)
at com.google.inject.Guice.createInjector(Guice.java:62)
at phattuonline.common.base.JpaGuiceServletConfig.getInjector(JpaGuiceServletConfig.java:16)
at com.google.inject.servlet.GuiceServletContextListener.contextInitialized(GuiceServletContextListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4765)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5260)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1525)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1515)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
你知道爲什麼發生錯誤?交易有問題嗎?
感謝
我想這是某種罐子的衝突,可能是罐子的多個版本中使用 –
我使用Maven,它會自動解決所有的罐子衝突。錯誤仍然發生 –