0 Replies Latest reply on Sep 10, 2010 9:25 AM by Francois Richard

    Deploy resource-env-ref on Jboss 5.1

    Francois Richard Newbie



      I'm trying to deploy on JBoss 5.1 an EAR which is usually running on a websphere server6.0. The only WAR of the EAR use a resource-env-ref :


      I give you a quick look of my configuration :



      <resource-env-ref id="ResourceEnvRef_1234792399813">



      <?xml version="1.0" encoding="UTF-8"?>


      Code :

      String jndiName = "java:comp/env/spring/fileConfiguration";
                      Context jndiContext = new InitialContext();
                      Reference reference = (Reference) jndiContext.lookup(jndiName);
                      RefAddr addr = reference.get(0);
                      String applicationContextPath = addr.getContent().toString();
                      applicationContext = new ClassPathXmlApplicationContext(


      To create my resource, I'm using this example :


      And I add this line on the "bindings" :

          <value class="java.lang.String">properties/spring/ServicesContext.xml</value>


      My problem is that my lookup retrieve a String and not a javax.naming.Reference so I've got a ClassCastException : java.lang.String cannot be cast to javax.naming.Reference.


      I tried to deploy this mbean to do a linkRef (and changing the jboss-web.xml redirection) with no success :

      <mbean code="org.jboss.naming.NamingAlias" name="com.bnppa.logviewer:alias=spring/fileConfigurationNameTEST">
          <attribute name="FromName">spring/fileConfigurationLink</attribute>
          <attribute name="ToName">spring/fileConfigurationName</attribute>



      An extract of my jmx-console :

      Global JNDI Namespace
      +- spring (class: org.jnp.interfaces.NamingContext)
        |   +- fileConfigurationLink[link -> spring/fileConfigurationName] (class: javax.naming.LinkRef)
        |   +- fileConfigurationName (class: java.lang.String)

      Anyone knows what's wrong with my configuration ?


      Thanks in advance