Hi,
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 :
web.xml
<resource-env-ref id="ResourceEnvRef_1234792399813">
<description>
</description>
<resource-env-ref-name>spring/fileConfiguration</resource-env-ref-name>
<resource-env-ref-type>java.lang.String</resource-env-ref-type>
</resource-env-ref>
jboss-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<resource-env-ref>
<resource-env-ref-name>spring/fileConfiguration</resource-env-ref-name>
<jndi-name>spring/fileConfigurationName</jndi-name>
</resource-env-ref>
</jboss-web>
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(
applicationContextPath);
To create my resource, I'm using this example :
http://community.jboss.org/wiki/LocalOnlyContextFactory
And I add this line on the "bindings" :
<entry>
<key>spring/fileConfigurationName</key>
<value class="java.lang.String">properties/spring/ServicesContext.xml</value>
</entry>
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>
<depends>jboss:service=Naming</depends>
</mbean:xml>
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
François