0 Replies Latest reply: Feb 14, 2012 9:43 AM by Daud Khan RSS

RESTEasy - if servlet dispatcher is not used in web.xml, resteasy.jndi.resources properties is not recognized

Daud Khan Newbie
 

 

I am working with JBoss 6.1 - Final and according to the docs, I did not have to specify a servlet in my web.xml for resources to get registered. Further, I did not specify an Application class and instead, set the resteasy.scan variable to true to have my resources detected automatically. But when I wanted to register my EJBs as resources (packaged in a different jar separate from the war containing my web.xml, the war and jar being packaged inside an ear), I had to use the resteasy.jndi.resources context param. The problem is that the following web.xml would not work (there are no resources in the war, so no resteasy.scan is used) :

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

    <context-param>
      <param-name>resteasy.jndi.resources</param-name>
      <param-value>RestEasyEar/InformationResource/local
      </param-value>
   </context-param>

</web-app>

but if I mention the following servlet, it starts working :

<servlet>
      <servlet-name>Resteasy</servlet-name>
      <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
   </servlet>
   <servlet-mapping>
      <servlet-name>Resteasy</servlet-name>
      <url-pattern>/*</url-pattern>
   </servlet-mapping>

I believe that the resteasy.jndi.resources paramter should have worked without the servlet just like the resteasy.scan parameter worked. Am I right ?

Attached is an ear file (with source code) for the above setup.