User development,

A new message was posted in the thread "Resources injection in JBoss 5":

http://community.jboss.org/message/531823#531823

Author  : jaikiran pai
Profile : http://community.jboss.org/people/jaikiran

Message:
--------------------------------------------------------------
Luca, welcome to the forums 
 
Nice thing you are trying out there!
 
> morettoni wrote:
>  
> 
> Another solution talks about creating a file with this:
> > <?xml version="1.0" encoding="UTF-8"?>
> > <jndi:binding name="theConfig">
> >   <java:properties xmlns:java="urn:jboss:java-properties" 
> > xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"; 
> > xs:schemaLocation="urn:jboss:java-properties 
> > resource:java-properties_1_0.xsd">
> >     <java:property>
> >       <java:key>remote.address</java:key>
> >       <java:value>192.168.0.7</java:value>
> >     </java:property>
> >     <java:property>
> >       <java:key>dumpinfo</java:key>
> >       <java:value>1</java:value>
> >     </java:property>
> >   </java:properties>
> > </jndi:binding>
> ... but exploring the jndi tree I can't find any "theConfig" resource name! 
> There are any solutions to this? Thanks!
> 
> 
 
1) That file isn't complete. What you need is this:
 
 
<?xml version="1.0" encoding="UTF-8"?>
 <mbean code="org.jboss.naming.JNDIBindingServiceMgr"     
        name="jboss.apps:name=myapp">    
     <attribute name="BindingsConfig" serialDataType="jbxb">    
         <jndi:bindings 
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"     
                        xmlns:jndi="urn:jboss:jndi-binding-service:1.0"    
                        xs:schemaLocation="urn:jboss:jndi-binding-service 
resource:jndi-binding-service_1_0.xsd">     
            <jndi:binding name="theConfig">

                <java:properties xmlns:java="urn:jboss:java-properties" 
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"; 
xs:schemaLocation="urn:jboss:java-properties resource:java-properties_1_0.xsd">
                    <java:property>
                        <java:key>remote.address</java:key>
                        <java:value>192.168.0.7</java:value>
                    </java:property>
                    <java:property>
                        <java:key>dumpinfo</java:key>
                        <java:value>1</java:value>
                    </java:property>
                </java:properties>
            </jndi:binding>

        </jndi:bindings>    
     </attribute>    
</mbean>    


 
2) Name this file to end with -service.xml (ex: myapp-service.xml) and place it 
in JBOSS_HOME/server/< servername>/deploy folder and start the server. You 
should be able to find "theConfig" jndi binding available under the Global 
namespace in JNDIView through jmx-console.
 
3) Finally to inject this, you will have to use the mappedName of the @Resource 
annotation. Like this:
 
@Resource(mappedName = "theConfig")
private Properties configProperties;


--------------------------------------------------------------

To reply to this message visit the message page: 
http://community.jboss.org/message/531823#531823


_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to