2 Replies Latest reply on Apr 10, 2009 10:13 AM by lee roy malac

    InitialContext error in JBoss 5.x.x

    lee roy malac Newbie

      Hi,

      I have a strange error when I try to use a DatatSource with JNDI in JBoss 5.0.0.GA, 5.0.1.GA or 5.1.0.Beta1 but not with JBoss 4.2.2

      with JRE 1.6

      ...
      11:29:19,223 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
      11:29:19,317 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=jdbc/MyDatasource' to JNDI name 'java:jdbc/MyDatasource'
      ...
      javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory. Root exception is
      java.lang.ClassCastException: org.jnp.interfaces.NamingContextFactory cannot be cast to javax.naming.spi.InitialContextFactory
       at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:659)
       at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:250)
       at javax.naming.InitialContext.init(InitialContext.java:226)
       at javax.naming.InitialContext.<init>(InitialContext.java:182)
       at com.MyPackage.MyClass.MyFunction(MyClass.java:xxx)
      and it's nearly with JDK 1.5
      ...
      11:29:19,223 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
      11:29:19,317 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=jdbc/MyDatasource' to JNDI name 'java:jdbc/MyDatasource'
      ...
      javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory. Root exception is
      java.lang.ClassCastException: org.jnp.interfaces.NamingContextFactory
       at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:659)
       at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:250)
       at javax.naming.InitialContext.init(InitialContext.java:226)
       at javax.naming.InitialContext.<init>(InitialContext.java:182)
       at com.MyPackage.MyClass.MyFunction(MyClass.java:xxx)

      In MyFunction, the error appear on
      Context initCtx = new InitialContext();


      I use de default serveur and I have copyed then edited mssql-ds.xml in server\default\deploy
      I have Windows XP SP3.

      I don't understand what can be my mistake because the error seem be in JBoss source.