LDAPサーバーからユーザーの詳細を検索し、JSPを使用して単純なHTMLページを出力する単純なSpring MVCアプリケーションがあります。アプリケーションはTomcat 6上で正常に動作します。これは、Spring LDAP 1.3.1とLDAPTemplateを使用してLDAPルックアップを行います。WebsphereのNoClassDefFoundError - JARが存在する
ただし、このアプリケーションWARをWebsphere 7にデプロイすると、アプリケーションは実行されません.Websphereは500内部サーバーエラーを返します。 WebSphereのログファイルを見て、私は
[14/12/10 14:50:09:169 GMT] 00000022 DispatcherSer E org.springframework.web.servlet.FrameworkServlet initServletBean Context initialization failed
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.ldap.core.support.LdapContextSource] for bean with name 'contextSource' defined in ServletContext resource [/WEB-INF/spring-servlet.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org.springframework.beans.factory.InitializingBean
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1253)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1319)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:885)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:562)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
私のWEB-INF \ libディレクトリにInitializingBean
が含まれているorg.springframework.beans-3.0.5.RELEASE.jar
、を含む、すべてのJARファイルを、持っている参照してください。したがって、Websphereがクラスを欠落していると報告している理由はわかりません。私のWEB-INFの\ libにの
内容:
:aopalliance.jar
com.springsource.org.apache.commons.logging-1.1.1.jar
com.springsource.org.apache.log4j-1.2.15.jar
commons-lang-2.5.jar
commons-logging-1.1.1.jar
commons-pool-1.5.4.jar
jstl-api-1.2.jar
jstl-impl-1.2.jar
ldapbp-1.0.jar
org.springframework.aop-3.0.5.RELEASE.jar
org.springframework.asm-3.0.5.RELEASE.jar
org.springframework.beans-3.0.5.RELEASE.jar
org.springframework.context-3.0.5.RELEASE.jar
org.springframework.core-3.0.5.RELEASE.jar
org.springframework.expression-3.0.5.RELEASE.jar
org.springframework.jdbc-3.0.5.RELEASE.jar
org.springframework.oxm-3.0.5.RELEASE.jar
org.springframework.transaction-3.0.5.RELEASE.jar
org.springframework.web-3.0.5.RELEASE.jar
org.springframework.web.servlet-3.0.5.RELEASE.jar
spring-ldap-1.3.1.RELEASE-all.jar
そして、ここでは、WebSphereは、トラブル(ユーザー名/パスワードが有効であるとTomcatで動作)ロードを持っているcontextSource
Beanの定義です
<bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource">
<property name="url" value="ldaps://moo.example.com:1300/" />
<property name="userDn" value="CN=foo,OU=baz,DC=bar,DC=blat,DC=org" />
<property name="password" value="*******" />
</bean>
Websphereでこれが動作しない理由を誰かが指摘できれば、私は非常にうれしいです。私はWebsphereのクラスローディングルールについてはあまりよく分かりません。
ありがとうございました。クラスロードを有効にしてログを調べると、管理者がSpring LDAPコンテキストソースをJNDIに保存していたため、別のバージョンのSpring LDAP jarが別の場所からロードされていました。私のアプリのクラスローダーに "parent last"を使うように設定することで問題は解決しました。 – sigint