Hey all,

> I'd like to use an URL resource manager instead of a 
> classical Database
> resource manager, but
> I don't know how to configure my bean.
> 
> 
> My ejb-jar.xml is :
> 
> 
> <ejb-jar>
>      <description>My first EJB</description>
>      <display-name>test</display-name>
> 
>     <enterprise-beans>
> 
>        <session>
>             <ejb-name>HelloWorld</ejb-name>
>             <home>first.HelloHome</home>
>             <remote>first.Hello</remote>
>             <ejb-class>first.HelloBean</ejb-class>
>             <session-type>Stateful</session-type>
>             <transaction-type>Container</transaction-type>
> 
>      <resource-ref>
>           <description>dossier des drivers</description>
>       <res-ref-name>url/devices</res-ref-name>
>       <res-type>javax.net.URL</res-type>
>       <res-auth>Container</res-auth>
>      </resource-ref>
> 
>         </session>
> 
>     </enterprise-beans>
> </ejb-jar>

<res-type> must be java.net.URL, not javax.net.URL. For the rest it is OK.
It is possible lookup the resource from JNDI using java:comp/env/url/devices
in the case above, obtaining a java.net.URL object on which is possible call
openConnection().

> and my jboss.xml is :
> 
> <jboss>
>   <secure>false</secure>
>   <container-configurations />
> 
>   <enterprise-beans>
>      <session>
>        <ejb-name>HelloWorld</ejb-name>
>        <jndi-name>hello/HelloWorld</jndi-name>
>        <configuration-name></configuration-name>
>      </session>
>   </enterprise-beans>
> 
>   <resource-managers>
>     <resource-manager>
>       <res-name>url/devices</res-name>
> 
> <res-jndi-name>java:comp/env/url/file:/c:/Wokup/server/drivers
> /devices</res-jndi-name>
> 
>     </resource-manager>
>   </resource-managers>
> </jboss>

The resource-managers part must look like:

<resource-managers>
   <resource-manager>
      <res-name>url/devices</res-name>
      <res-url>http://myhost/files/file.txt</res-url>
   </resource-manager>
</resource-managers>

It is not possible to use file: protocol (see below for detailed
explanation).

HTH,

Simon

PS: why file: protocol does not work.
It finally goes down to the fact that the data member of class URL called
"path" is transient; since a java.net.URL object is registered in JNDI, when
you look it up, this is serialized and brought to your EJB, but of course
the path member is now null; this cause a call to openConnection() to fail
with a NPE in the sun.net.www.* classes.


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]

Reply via email to