2017-09-18 1 views
0

私はアプリを打つには、エラーを取得していますCaucho樹脂4にWARとして春ブーツアプリを展開しようとしている:SpringブートアプリケーションWARのResin 4へのデプロイ:まずアプリケーション(WEB-INF/lib)クラスローダーを使用する方法はありますか?

org.springframework.context.ApplicationContextException: Unable to 
start embedded container; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating 
bean with name 
'org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration' 
: Bean instantiation via constructor failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to 
instantiate 
[org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$ 
$EnhancerBySpringCGLIB$$58b91c9d]: Constructor threw exception; nested 
exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'dashboardResource' defined in file 
[/var/resin/webapps/itasng-0.8.5/WEB-INF/classes/gov/nih/cit/itasng/ 
rest/DashboardResource.class]: Unsatisfied dependency expressed through 
constructor parameter 0; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error 
creating bean with name 'payPeriodRepository' defined in file 
[/var/resin/webapps/itasng-0.8.5/WEB-INF/classes/gov/nih/cit/itasng/ 
persistence/PayPeriodRepository.class]: Unsatisfied dependency 
expressed through constructor parameter 0; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating 
bean with name 
'org.springframework.orm.jpa.SharedEntityManagerCreator#0': Cannot 
resolve reference to bean 'entityManagerFactory' while setting 
constructor argument; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating 
bean with name 'entityManagerFactory' defined in class path resource 
[org/springframework/boot/autoconfigure/orm/jpa/ 
HibernateJpaAutoConfiguration.class]: Invocation of init method failed; 
nested exception is java.lang.NoSuchMethodError: 
javax.persistence.Table.indexes()[Ljavax/persistence/Index; at 
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext 
.onRefresh(EmbeddedWebApplicationContext.java:137) 
~[spring-boot-1.5.7.RELEASE.jar:1.5.7.RELEASE] 
... 

それは、これは典型的なクラスローディングの問題であることは明らかです:クラスResin lib(例えばlib/javaee-16.jar)の親クラスローダによってロードされると、新しいバージョン(例えばWEB-INF/lib/hibernate-jpa-2.1-api-1.0.0.Final .jar)。

以前に使用したほとんどのアプリケーションサーバーは、WEB-INF/libクラスが最初にロードされるように、クラスローダーの順序を切り替えるベンダー固有の–web.xml記述子のどこかの設定を持っています。しかし、Resin docsは、そのようなオプションが存在すれば簡単に答えを出すことはできません。

Resin 4でクラスの読み込み順序を切り替える方法はありますか、それとも別の解決方法がありますか?

答えて

0

Resin 4.0では、まずアプリケーションクラスローダーを使用する方法がありません。

関連するクラスローディングの問題の潜在的な回避策には、<jvm-classpath>を使用して、Resinのクラスパスより優先させることができます。

JPA 2.0の代わりに、後で使用するJPA 2.0の代わりにJPA 2.0を使用することもできます。

ドキュメントの参照:

http://www.caucho.com/resin-4.0/admin/cluster-config.xtp#jvm-classpath

関連する問題