9 Replies Latest reply on Jun 25, 2013 1:22 PM by wdfink

    Cannot lookup datasource remotely in Jboss 7.10 final


      hi, I am newly to Jboss 7 and I am testing remote lookup XA datasource from JNDI but no luck. Admittedly, this is not a recommend solution for connection usage remotely, however I just do a testing since it should be provided in the previous jboss version.


      Here is my datasource configuration.


       <xa-datasource jndi-name="java:jboss/exported/datasources/abc" pool-name="abc" enabled="true" use-java-context="false" use-ccm="false">
                          <xa-datasource-property name="ServerName">
                          <xa-datasource-property name="DatabaseName">



      And here is my client


      public class DataSourceClient {
                // *************** DATASOURCE *************************
      //          public final static String DATASOURCE = "java:/datasources/abc";
                public final static String DATASOURCE = "datasources/abc";
                private DataSource myDS;
                public DataSource init(Context ctx) throws NamingException,
                                    JMSException {
                          return myDS = (DataSource) ctx.lookup(DATASOURCE);
                public void test() throws SQLException{
                          String sql = "INSERT INTO test values (null,'xxx');";
                    Connection con = myDS.getConnection();
                    Statement stat = con.createStatement();
                public static void main(String[] args) throws Exception {
                          final Properties env = new Properties();
                          env.put(Context.INITIAL_CONTEXT_FACTORY, org.jboss.naming.remote.client.InitialContextFactory.class.getName());
                          env.put(Context.PROVIDER_URL, "remote://");
                          env.put(Context.SECURITY_PRINCIPAL, "user");
                          env.put(Context.SECURITY_CREDENTIALS, "user");
                          InitialContext remoteContext = new InitialContext(env);
                          DataSourceClient qs = new DataSourceClient();



      When I trigger client I hit the following error.


      ERROR: java.io.EOFException

      Exception in thread "main" javax.naming.NamingException: Failed to lookup [Root exception is java.io.NotSerializableException: org.jboss.jca.core.connectionmanager.pool.strategy.OnePool]


      I had googled a lot with no luck. And I have another confuse is that when use-java-context marked to false, it should no need to start the jndi name with "java:", however, server can't start when I removed the prefix and get similar error message  "jndi name should start with java: or java:jboss".


      Can somebody tell me whether the jboss 7 support remotely datasource? if so can somebody point out whats the problem of my client, tons thanks!