1
부두가있는 GWT 프로젝트를 만들었고 데이터 소스로 JNDI를 사용합니다. GWT 앱을 실행하면 모든 것이 잘 작동하지만 .war 파일을 JBoss에 복사 할 때 오류가 발생합니다. 보스 버전 - 4.2.3.GAJBoss - 객체를 역 참조 할 수 없습니다.
javax.naming.NamingException: Could not dereference object [Root exception is
javax.naming.NameNotFoundException: jdbc not bound] at
org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1215) at
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:758) at
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:774) at
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627) at
javax.naming.InitialContext.lookup(InitialContext.java:392) at
의 jboss-web.xml을
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<resource-ref>
<res-ref-name>jdbc/base</res-ref-name>
<jndi-name>jdbc/base</jndi-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</jboss-web>
부두 - env.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<New id="base" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/base</Arg>
<Arg>
<New class="org.apache.tomcat.jdbc.pool.DataSource">
<Set name="driverClassName">org.postgresql.Driver</Set>
<Set name="url">jdbc:postgresql://database/test</Set>
<Set name="username">user</Set>
<Set name="password">password</Set>
<Set name="maxActive">10</Set>
<Set name="maxIdle">4</Set>
</New>
</Arg>
</New>
</Configure>
web.xml을
<resource-ref>
<description>My DataSource Reference</description>
<res-ref-name>jdbc/base</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
GreetingServiceImpl.java
InitialContext ic = new InitialContext();
DataSource ds = (DataSource)ic.lookup("java:comp/env/jdbc/base");
Connection con = ds.getConnection();
무엇이 잘못 되었습니까? 도움을 주셔서 감사합니다