2012-02-16 10 views
2

JBoss 7.0.2でJNDIルックアップを正しく実行するためにいくつかの問題が発生しています。基本的に、このアプリケーションは複数のアプリケーションサーバーに展開できる必要があるため、適切な標準に準拠したいと考えています。問題のアプリケーションは、Jboss管理ドメインで動作するLiferay 6.1に配備された単純なポートレットアプリケーションです。 web.xml、jboss-web.xml、およびpersistence.xmlで命名規則のさまざまな組み合わせを試みました。すべて無駄に。JBoss 7.0.2でのデータソースのJNDIルックアップによりNameNotFoundExceptionが発生する

春のpersistence.xml:

<jee:jndi-lookup id="surveyDS" jndi-name="jdbc/surveyDS" resource-ref="true" /> 

のweb.xml:

<?xml version="1.0"?> 
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_4.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_4.xsd" id="WebApp_ID" version="2.4"> 
    ... 
    <resource-ref> 
     <res-ref-name>jdbc/surveyDS</res-ref-name> 
     <res-type>javax.sql.DataSource</res-type> 
     <res-auth>Container</res-auth> 
     <res-sharing-scope>Shareable</res-sharing-scope> 
    </resource-ref> 
</web-app> 

のjboss-web.xmlの:

<?xml version="1.0"?> 
<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.4//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd"> 
<jboss-web> 
    <resource-ref> 
     <res-ref-name>jdbc/surveyDS</res-ref-name> 
     <jndi-name>java:jboss/datasources/surveyDS</jndi-name> 
    </resource-ref> 
</jboss-web> 

データソースの定義の中で私の現在の構成は次のようになります$ {JBOSS_HOME} /domain/configuration/domain.xml:

<datasource jndi-name="java:jboss/datasources/surveyDS" pool-name="TestDSPool" enabled="true" jta="true" use-java-context="true" use-ccm="true"> 
    <connection-url>****</connection-url> 
    <driver>com.mysql</driver> 
    <pool> 
     <prefill>false</prefill> 
     <use-strict-min>false</use-strict-min> 
     <flush-strategy>FailingConnectionOnly</flush-strategy> 
    </pool> 
    <security> 
     <user-name>****</user-name> 
     <password>****</password> 
    </security> 
</datasource> 

ポートレットアプリケーションのデプロイメントはうまく動作します。しかし、私は実際にポートレットを表示しようとすると、私は次の例外を取得:

15:10:05,493 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/survey-portlets].[surveydisplay Servlet]] (ajp--0.0.0.0-8009-3) Servlet.service() for servlet surveydisplay Servlet threw exception: javax.naming.NameNotFoundException: jdbc/surveyDS -- service jboss.naming.context.java.jdbc.surveyDS 
    at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:87) 
    at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:173) 
    at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:47) 
    at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:209) 
    at javax.naming.InitialContext.lookup(InitialContext.java:392) [:1.6.0_26] 
    at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154) [org.springframework.context-3.0.5.RELEASE.jar:] 
    at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87) [org.springframework.context-3.0.5.RELEASE.jar:] 
    at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152) [org.springframework.context-3.0.5.RELEASE.jar:] 
    at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178) [org.springframework.context-3.0.5.RELEASE.jar:] 
    at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:104) [org.springframework.context-3.0.5.RELEASE.jar:] 
    at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105) [org.springframework.context-3.0.5.RELEASE.jar:] 
    at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:201) [org.springframework.context-3.0.5.RELEASE.jar:] 
    at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:187) [org.springframework.context-3.0.5.RELEASE.jar:] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477) [org.springframework.beans-3.0.5.RELEASE.jar:] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417) [org.springframework.beans-3.0.5.RELEASE.jar:] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [org.springframework.beans-3.0.5.RELEASE.jar:] 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [org.springframework.beans-3.0.5.RELEASE.jar:] 
[ ... stack truncated for brevity ] 

を、私はこの時点で非常にシンプルで何かを明らかに不足しているしなければならないような気がしますが、私はそれが何であるか見当がつかない。どんな提案も大歓迎です!

答えて

0

JBoss domain.xmlファイルのDataSource jndi-nameをjava:jdbc/surveyDSに変更しても問題ありません。

関連する問題