Bonjour,

J'essaye depuis plusieurs heures de créer un lien entre JBoss et ma base Oracle.
J'ai consulté pas mal de guides et de forums et je ne peux que croire à un problème de VM.

As stated fairly frequently on the mailing lists and forums, datasources are available only in the vm in which they are configured and deployed. If you want one somewhere else, deploy it there too, possibly using a trimmed down jboss.
Par contre je n'ai pas trouvé de moyen de remédier à celà ...
Que dois-je faire ?

Quelques infos supplémentaires :
Voici la log du serveur au démarrage.

C:\Program Files\jboss-4.0.4.GA\bin>run.bat
===============================================================================
.
JBoss Bootstrap Environment
.
JBOSS_HOME: C:\Program Files\jboss-4.0.4.GA\bin\\..
.
JAVA: C:\Program Files\Java\jdk1.5.0_07\bin\java
.
JAVA_OPTS: -Dprogram.name=run.bat -Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcIn
terval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
.
CLASSPATH: C:\Program Files\Java\jdk1.5.0_07\lib\tools.jar;C:\Program Files\jb
oss-4.0.4.GA\bin\\run.jar
.
===============================================================================
.
11:06:04,513 INFO [Server] Starting JBoss (MX MicroKernel)...
11:06:04,513 INFO [Server] Release ID: JBoss [Zion] 4.0.4.GA (build: CVSTag=JBo
ss_4_0_4_GA date=200605151000)
11:06:04,528 INFO [Server] Home Dir: C:\Program Files\jboss-4.0.4.GA
11:06:04,528 INFO [Server] Home URL: file:/C:/Program Files/jboss-4.0.4.GA/
11:06:04,528 INFO [Server] Patch URL: null
11:06:04,528 INFO [Server] Server Name: default
11:06:04,528 INFO [Server] Server Home Dir: C:\Program Files\jboss-4.0.4.GA\ser
ver\default
11:06:04,528 INFO [Server] Server Home URL: file:/C:/Program Files/jboss-4.0.4.
GA/server/default/
11:06:04,528 INFO [Server] Server Log Dir: C:\Program Files\jboss-4.0.4.GA\serv
er\default\log
11:06:04,528 INFO [Server] Server Temp Dir: C:\Program Files\jboss-4.0.4.GA\ser
ver\default\tmp
11:06:04,528 INFO [Server] Root Deployment Filename: jboss-service.xml
11:06:04,856 INFO [ServerInfo] Java version: 1.5.0_07,Sun Microsystems Inc.
11:06:04,856 INFO [ServerInfo] Java VM: Java HotSpot(TM) Client VM 1.5.0_07-b03
,Sun Microsystems Inc.
11:06:04,856 INFO [ServerInfo] OS-System: Windows XP 5.1,x86
11:06:05,325 INFO [Server] Core system initialized
11:06:07,403 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resour
ce:log4j.xml
11:06:11,731 INFO [SnmpAgentService] SNMP agent going active
11:06:11,856 INFO [AspectDeployer] Deployed AOP: file:/C:/Program Files/jboss-4
.0.4.GA/server/default/deploy/tc5-cluster.sar/tc5-cluster.aop
11:06:12,044 INFO [TreeCache] setting cluster properties from xml to: UDP(down_
thread=false;enable_bundling=true;ip_ttl=2;loopback=false;max_bundle_size=64000;
max_bundle_timeout=30;mcast_addr=230.1.2.7;mcast_port=45577;mcast_recv_buf_size=
25000000;mcast_send_buf_size=640000;ucast_recv_buf_size=20000000;ucast_send_buf_
size=640000;up_thread=false;use_incoming_packet_handler=true;use_outgoing_packet
_handler=true)ING(down_thread=false;num_initial_members=3;timeout=2000;up_thre
ad=false):MERGE2(down_thread=false;max_interval=100000;min_interval=20000;up_thr
ead=false):FD(down_thread=false;max_tries=5;shun=true;timeout=2500;up_thread=fal
se):VERIFY_SUSPECT(down_thread=false;timeout=1500;up_thread=false):pbcast.NAKACK
(discard_delivered_msgs=true;down_thread=false;gc_lag=50;max_xmit_size=60000;ret
ransmit_timeout=100,200,300,600,1200,2400,4800;up_thread=false;use_mcast_xmit=fa
lse):UNICAST(down_thread=false;timeout=300,600,1200,2400,3600;up_thread=false):p
bcast.STABLE(desired_avg_gossip=50000;down_thread=false;max_bytes=2100000;stabil
ity_delay=1000;up_thread=false):pbcast.GMS(down_thread=false;join_retry_timeout=
2000;join_timeout=3000;print_local_addr=true;shun=true;up_thread=false):FC(down_
thread=false;max_credits=10000000;min_threshold=0.20;up_thread=false):FRAG2(down
_thread=false;frag_size=60000;up_thread=false):pbcast.STATE_TRANSFER(down_thread
=false;up_thread=false)
11:06:12,497 INFO [WebService] Using RMI server codebase: http://G-JACHIMIAK:80
83/
11:06:14,169 INFO [MailService] Mail Service bound to java:/Mail
11:06:14,481 INFO [DefaultPartition] Initializing
11:06:14,606 INFO [TreeCache] interceptor chain is:
class org.jboss.cache.interceptors.CallInterceptor
class org.jboss.cache.interceptors.PessimisticLockInterceptor
class org.jboss.cache.interceptors.UnlockInterceptor
class org.jboss.cache.interceptors.ReplicationInterceptor
11:06:14,606 INFO [TreeCache] cache mode is REPL_ASYNC
11:06:14,700 INFO [NamingService] JNDI bootstrap JNP=/0.0.0.0:1099, RMI=/0.0.0.
0:1098, backlog=50, no client SocketFactory, Server SocketFactory=class org.jbos
s.net.sockets.DefaultSocketFactory
11:06:14,763 INFO [SubscriptionManager] Bound event dispatcher to java:/EventDi
spatcher
11:06:14,778 INFO [STDOUT]
-------------------------------------------------------
GMS: address is G-JACHIMIAK:1997 (additional data: 14 bytes)
-------------------------------------------------------
11:06:16,810 INFO [DefaultPartition] Number of cluster members: 1
11:06:16,810 INFO [DefaultPartition] New cluster view for partition DefaultPart
ition (id: 0, delta: 0) : [10.1.3.86:1099]
11:06:16,810 INFO [DefaultPartition] Other members: 0
11:06:16,825 INFO [DefaultPartition] Fetching state (will wait for 30000 millis
econds):
11:06:16,825 INFO [DefaultPartition] I am (10.1.3.86:1099) received membershipC
hanged event:
11:06:16,825 INFO [DefaultPartition] Dead members: 0 ([])
11:06:16,825 INFO [DefaultPartition] New Members : 0 ([])
11:06:16,825 INFO [DefaultPartition] All Members : 1 ([10.1.3.86:1099])
11:06:16,856 INFO [HANamingService] Started ha-jndi bootstrap jnpPort=1100, bac
klog=50, bindAddress=/0.0.0.0
11:06:16,872 INFO [DetachedHANamingService$AutomaticDiscovery] Listening on /0.
0.0.0:1102, group=230.0.0.4, HA-JNDI address=10.1.3.86:1100
11:06:17,528 INFO [CorbaNamingService] Naming: [IOR:000000000000002B49444C3A6F6
D672E6F72672F436F734E616D696E672F4E616D696E67436F6E746578744578743A312E300000000
0000200000000000000D0000102000000000A31302E312E332E3836000DC8000000114A426F73732
F4E616D696E672F726F6F74000000000000050000000000000008000000004A41430000000001000
0001C00000000000100010000000105010001000101090000000105010001000000210000004C000
000000000000100000000000000240000001C0000007E00000000000000010000000A31302E312E3
32E3836000DC90000000000000000000000000000000000000000000000000000000000000020000
00004000000000000001F00000004000000030000000100000020000000000000000200000020000
00004000000000000001F0000000400000003]
11:06:17,575 INFO [STDOUT]
-------------------------------------------------------
GMS: address is G-JACHIMIAK:1999
-------------------------------------------------------
11:06:19,575 INFO [TreeCache] viewAccepted(): [G-JACHIMIAK:1999|0] [G-JACHIMIAK
:1999]
11:06:19,575 INFO [TreeCache] my local address is G-JACHIMIAK:1999
11:06:19,575 INFO [TreeCache] state could not be retrieved (must be first membe
r in group)
11:06:19,575 INFO [TreeCache] Cache is started!!
11:06:19,575 INFO [TreeCache] new cache is null (may be first member in cluster
)
11:06:19,685 INFO [CorbaTransactionService] TransactionFactory: [IOR:0000000000
00003049444C3A6F72672F6A626F73732F746D2F69696F702F5472616E73616374696F6E46616374
6F72794578743A312E30000000000200000000000000D0000102000000000A31302E312E332E3836
000DC8000000144A426F73732F5472616E73616374696F6E732F4600000005000000000000000800
0000004A414300000000010000001C00000000000100010000000105010001000101090000000105
010001000000210000004C000000000000000100000000000000240000001C0000007E0000000000
0000010000000A31302E312E332E3836000DC9000000000000000000000000000000000000000000
000000000000000000002000000004000000000000001F0000000400000003000000010000002000
000000000000020000002000000004000000000000001F0000000400000003]
11:06:20,169 INFO [Embedded] Catalina naming disabled
11:06:20,231 INFO [ClusterRuleSetFactory] Unable to find a cluster rule set in
the classpath. Will load the default rule set.
11:06:20,231 INFO [ClusterRuleSetFactory] Unable to find a cluster rule set in
the classpath. Will load the default rule set.
11:06:20,544 INFO [Http11BaseProtocol] Initializing Coyote HTTP/1.1 on http-0.0
.0.0-8000
11:06:20,544 INFO [Catalina] Initialization processed in 313 ms
11:06:20,544 INFO [StandardService] Starting service jboss.web
11:06:20,544 INFO [StandardEngine] Starting Servlet Engine: Apache Tomcat/5.5.1
7
11:06:20,575 INFO [StandardHost] XML validation disabled
11:06:20,606 INFO [Catalina] Server startup in 62 ms
11:06:20,778 INFO [TomcatDeployer] deploy, ctxPath=/invoker, warUrl=.../deploy/
http-invoker.sar/invoker.war/
11:06:21,075 INFO [WebappLoader] Dual registration of jndi stream handler: fact
ory already defined
11:06:21,716 INFO [TomcatDeployer] deploy, ctxPath=/, warUrl=.../deploy/jbosswe
b-tomcat55.sar/ROOT.war/
11:06:21,888 INFO [TomcatDeployer] deploy, ctxPath=/jbossws, warUrl=.../tmp/dep
loy/tmp49806jbossws-exp.war/
11:06:22,075 INFO [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil, warUrl=.../
deploy/jms/jbossmq-httpil.sar/jbossmq-httpil.war/
11:06:22,294 INFO [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=.../dep
loy/management/console-mgr.sar/web-console.war/
11:06:23,091 INFO [RARDeployment] Required license terms exist, view META-INF/r
a.xml in .../deploy/jboss-ha-local-jdbc.rar
11:06:23,138 INFO [RARDeployment] Required license terms exist, view META-INF/r
a.xml in .../deploy/jboss-ha-xa-jdbc.rar
11:06:23,185 INFO [RARDeployment] Required license terms exist, view META-INF/r
a.xml in .../deploy/jboss-local-jdbc.rar
11:06:23,216 INFO [RARDeployment] Required license terms exist, view META-INF/r
a.xml in .../deploy/jboss-xa-jdbc.rar
11:06:23,294 INFO [RARDeployment] Required license terms exist, view META-INF/r
a.xml in .../deploy/jms/jms-ra.rar
11:06:23,325 INFO [RARDeployment] Required license terms exist, view META-INF/r
a.xml in .../deploy/mail-ra.rar
11:06:23,997 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jb
oss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'javaefaultDS'
11:06:24,231 INFO [A] Bound to JNDI name: queue/A
11:06:24,231 INFO [B] Bound to JNDI name: queue/B
11:06:24,247 INFO [C] Bound to JNDI name: queue/C
11:06:24,247 INFO [D] Bound to JNDI name: queue/D
11:06:24,247 INFO [ex] Bound to JNDI name: queue/ex
11:06:24,263 INFO [testTopic] Bound to JNDI name: topic/testTopic
11:06:24,263 INFO [securedTopic] Bound to JNDI name: topic/securedTopic
11:06:24,263 INFO [testDurableTopic] Bound to JNDI name: topic/testDurableTopic

11:06:24,278 INFO [testQueue] Bound to JNDI name: queue/testQueue
11:06:24,325 INFO [UILServerILService] JBossMQ UIL service available at : /0.0.
0.0:8093
11:06:24,653 INFO [DLQ] Bound to JNDI name: queue/DLQ
11:06:24,778 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jb
oss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
11:06:24,856 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jb
oss.jca:service=DataSourceBinding,name=OracleDS' to JNDI name 'java:OracleDS'
11:06:25,138 INFO [TomcatDeployer] deploy, ctxPath=/javatest, warUrl=.../tmp/de
ploy/tmp49852javatest-exp.war/
11:06:25,310 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../dep
loy/jmx-console.war/
11:06:25,622 INFO [Http11BaseProtocol] Starting Coyote HTTP/1.1 on http-0.0.0.0
-8000
11:06:25,716 INFO [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
11:06:25,731 INFO [JkMain] Jk running ID=0 time=0/46 config=null
11:06:25,747 INFO [Server] JBoss (MX MicroKernel) [4.0.4.GA (build: CVSTag=JBos
s_4_0_4_GA date=200605151000)] Started in 21s:219ms
Puis après accès à la page de test.

11:09:11,653 ERROR [STDERR] javax.naming.NameNotFoundException: OracleDS not bou
nd
11:09:11,653 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(Naming
Server.java:529)
11:09:11,653 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(Naming
Server.java:537)
11:09:11,653 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingS
erver.java:543)
11:09:11,653 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServ
er.java:296)
11:09:11,653 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServ
er.java:270)
11:09:11,653 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(Namin
gContext.java:625)
11:09:11,653 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(Namin
gContext.java:587)
11:09:11,653 ERROR [STDERR] at foo.DBTest.init(DBTest.java:20)
11:09:11,653 ERROR [STDERR] at org.apache.jsp.index_jsp._jspService(index_js
p.java:54)
11:09:11,653 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.service
(HttpJspBase.java:97)
11:09:11,653 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpSe
rvlet.java:810)
11:09:11,653 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.s
ervice(JspServletWrapper.java:332)
11:09:11,653 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJ
spFile(JspServlet.java:314)
11:09:11,653 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(
JspServlet.java:264)
11:09:11,653 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpSe
rvlet.java:810)
11:09:11,653 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha
in.internalDoFilter(ApplicationFilterChain.java:252)
11:09:11,653 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha
in.doFilter(ApplicationFilterChain.java:173)
11:09:11,653 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilte
r.doFilter(ReplyHeaderFilter.java:96)
11:09:11,653 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha
in.internalDoFilter(ApplicationFilterChain.java:202)
11:09:11,653 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha
in.doFilter(ApplicationFilterChain.java:173)
11:09:11,653 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve
.invoke(StandardWrapperValve.java:213)
11:09:11,653 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve
.invoke(StandardContextValve.java:178)
11:09:11,653 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssocia
tionValve.invoke(SecurityAssociationValve.java:175)
11:09:11,653 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValv
e.invoke(JaccContextValve.java:74)
11:09:11,653 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.in
voke(StandardHostValve.java:126)
11:09:11,653 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.i
nvoke(ErrorReportValve.java:105)
11:09:11,653 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.
invoke(StandardEngineValve.java:107)
11:09:11,653 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.s
ervice(CoyoteAdapter.java:148)
11:09:11,653 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.proc
ess(Http11Processor.java:869)
11:09:11,653 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$H
ttp11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
11:09:11,653 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.pr
ocessSocket(PoolTcpEndpoint.java:527)
11:09:11,653 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerT
hread.run(MasterSlaveWorkerThread.java:112)
11:09:11,653 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
Et ici le code de ma classe de test qui est appelé par mon index.jsp

package foo;

import javax.naming.*;
import javax.sql.*;
import java.sql.*;

public class DBTest {

String foo = "Not Connected";
int bar = -1;

public void init() {
try{
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context");

Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("OracleDS");

if (ds != null) {
Connection conn = ds.getConnection();

if(conn != null) {
foo = "Got Connection "+conn.toString();
Statement stmt = conn.createStatement();
ResultSet rst =
stmt.executeQuery(
"select id, foo, bar from testdata");
if(rst.next()) {
foo=rst.getString(2);
bar=rst.getInt(3);
}
conn.close();
}
}
}catch(Exception e) {
e.printStackTrace();
}
}

public String getFoo() { return foo; }
public int getBar() { return bar;}
}

Merci