|
From: Jean-Baptiste M. <mes...@gm...> - 2008-09-10 13:31:50
|
Hi,
I'm trying to use RestEsay and i have never could deploy my war.
I work with beta 6 + jboss 4.2.2 GA + ejb3
first my EJB classes :
@Remote
@Path("/")
public interface IResultDaoRest {
@GET
@Path("/result")
@Produces("text/plain")
String getResults();
}
@Stateless
public class ResultDaoRest implements IResultDaoRest {
@EJB
IResultDao resultDao;
@Override
public String getResults() {
System.out.println("getResult");
return "result";
}
}
@Remote
@Path("/")
public interface ILocatingRessource {
@Path("locating")
IResulDaoRest getLocating();
}
and its implementation
--------------------------------------------------------
my web.wml :
<context-param>
<param-name>resteasy.jndi.resources</param-name>
<param-value>JobTraker/ResultDaoRest/remote,JobTraker/LocatingResourceBean/remote
</param-value>
</context-param>
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>resteasy.resource.method-interceptors</param-name>
<param-value>
org.jboss.resteasy.core.ResourceMethodSecurityInterceptor
</param-value>
</context-param>
<listener>
<listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>
<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>
</web-app>
------------------------------------------------
I have an EAR named JobTracker, and this naming context
+- JobTraker (class: org.jnp.interfaces.NamingContext)
| +- ResultDaoRest (class: org.jnp.interfaces.NamingContext)
| | +- remote (proxy: $Proxy520 implements
interface
com.linkdex.server.resteasy.dao.IResultDaoRest,interface
org.jboss.ejb3.JBossProxy)
| +- LocatingRessourceBean (class:
org.jnp.interfaces.NamingContext)
| | +- remote (proxy: $Proxy523 implements interface
com.linkdex.server.resteasy.dao.ILocatingRessource,interface
org.jboss.ejb3.JBossProxy)
---------------------------------------------------
When I deploy my EAR i have this error :
RuntimeException: Class is not a root resource. It, or one of its
interfaces must be annotated with @Path: $Proxy538 implements:
com.linkdex.server.resteasy.dao.IResulDaoRest org.jboss.ejb3.JBossProxy
at
org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:116)
[..]
14:10:15,484 ERROR [StandardContext] Error listenerStart
14:10:15,484 ERROR [StandardContext] Erreur de démarrage du contexte
[/LinkdexRESTEasy] suite aux erreurs précédentes
14:10:15,562 WARN [ServiceController] Problem starting service
jboss.web.deployment:war=LinkdexRESTEasy.war,id=1822547394
...
somebody can help me ?
|
|
From: Edgar A S. <edg...@re...> - 2008-09-10 13:50:18
|
Jean,
I am not sure you can do that directly with EJBs, maybe Bill can confirm it.
However, you can create a "Façade" for you EJB where you can use EJB
dependency injection capabilities, and so you pojo can can access you
EJB without problems.
Another architectural issue is that maybe your "Dao" returning String
you may have problems in layers that are not suitable for REST, such as
a Swing or even plain JSP pages (whatever JSF or Wicket).
hth
Edgar
Jean-Baptiste Meslin wrote:
> Hi,
>
> I'm trying to use RestEsay and i have never could deploy my war.
>
> I work with beta 6 + jboss 4.2.2 GA + ejb3
>
> first my EJB classes :
>
> @Remote
> @Path("/")
> public interface IResultDaoRest {
>
> @GET
> @Path("/result")
> @Produces("text/plain")
> String getResults();
>
> }
>
> @Stateless
> public class ResultDaoRest implements IResultDaoRest {
>
> @EJB
> IResultDao resultDao;
>
> @Override
> public String getResults() {
> System.out.println("getResult");
> return "result";
> }
> }
>
> @Remote
> @Path("/")
> public interface ILocatingRessource {
> @Path("locating")
> IResulDaoRest getLocating();
> }
>
> and its implementation
>
> --------------------------------------------------------
> my web.wml :
>
>
> <context-param>
> <param-name>resteasy.jndi.resources</param-name>
>
> <param-value>JobTraker/ResultDaoRest/remote,JobTraker/LocatingResourceBean/remote
> </param-value>
>
> </context-param>
>
> <context-param>
> <param-name>resteasy.scan</param-name>
> <param-value>true</param-value>
> </context-param>
>
> <context-param>
> <param-name>resteasy.resource.method-interceptors</param-name>
> <param-value>
> org.jboss.resteasy.core.ResourceMethodSecurityInterceptor
> </param-value>
> </context-param>
>
> <listener>
>
> <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
> </listener>
>
> <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>
> </web-app>
>
> ------------------------------------------------
>
> I have an EAR named JobTracker, and this naming context
>
> +- JobTraker (class: org.jnp.interfaces.NamingContext)
> | +- ResultDaoRest (class: org.jnp.interfaces.NamingContext)
> | | +- remote (proxy: $Proxy520 implements
> interface
> com.linkdex.server.resteasy.dao.IResultDaoRest,interface
> org.jboss.ejb3.JBossProxy)
> | +- LocatingRessourceBean (class:
> org.jnp.interfaces.NamingContext)
> | | +- remote (proxy: $Proxy523 implements interface
> com.linkdex.server.resteasy.dao.ILocatingRessource,interface
> org.jboss.ejb3.JBossProxy)
>
> ---------------------------------------------------
>
> When I deploy my EAR i have this error :
>
> RuntimeException: Class is not a root resource. It, or one of its
> interfaces must be annotated with @Path: $Proxy538 implements:
> com.linkdex.server.resteasy.dao.IResulDaoRest org.jboss.ejb3.JBossProxy
> at
> org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:116)
> [..]
>
> 14:10:15,484 ERROR [StandardContext] Error listenerStart
> 14:10:15,484 ERROR [StandardContext] Erreur de démarrage du contexte
> [/LinkdexRESTEasy] suite aux erreurs précédentes
> 14:10:15,562 WARN [ServiceController] Problem starting service
> jboss.web.deployment:war=LinkdexRESTEasy.war,id=1822547394
> ...
>
> somebody can help me ?
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ------------------------------------------------------------------------
>
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
--
____________________________________________________
Edgar A Silva
Solutions Architect
JBoss, a division of Red Hat
Mobiles: + 55 11 7853-2861
Office: + 55 11 3529-6000
Red Hat Brazil
|
|
From: Bill B. <bb...@re...> - 2008-09-10 13:52:29
|
Your web.xml is wrong. Please take a look at: https://resteasy.svn.sourceforge.net/svnroot/resteasy/tags/RESTEASY_JAXRS_1_0_BETA_6/examples/ejb-integration/ This example comes with the distribution. Turn off scanning. You must also manually define EJBs to register with RESTEasy using the "resteasy.jndi.resources" context-param. Our documentation talks about how to do this. If these changes don't work, let me know on this list. <web-app> <display-name>Archetype Created Web Application</display-name> <context-param> <param-name>resteasy.jndi.resources</param-name> <param-value> JobTraker/IResultDaoRest/remote </param-value> </context-param> <!-- set this if you map the Resteasy servlet to something other than /* <context-param> <param-name>resteasy.servlet.mapping.prefix</param-name> <param-value>/resteasy</param-value> </context-param> --> <listener> <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class> </listener> <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> </web-app> Jean-Baptiste Meslin wrote: > Hi, > > I'm trying to use RestEsay and i have never could deploy my war. > > I work with beta 6 + jboss 4.2.2 GA + ejb3 > > first my EJB classes : > > @Remote > @Path("/") > public interface IResultDaoRest { > > @GET > @Path("/result") > @Produces("text/plain") > String getResults(); > > } > > @Stateless > public class ResultDaoRest implements IResultDaoRest { > > @EJB > IResultDao resultDao; > > @Override > public String getResults() { > System.out.println("getResult"); > return "result"; > } > } > > @Remote > @Path("/") > public interface ILocatingRessource { > @Path("locating") > IResulDaoRest getLocating(); > } > > and its implementation > > -------------------------------------------------------- > my web.wml : > > > <context-param> > <param-name>resteasy.jndi.resources</param-name> > > <param-value>JobTraker/ResultDaoRest/remote,JobTraker/LocatingResourceBean/remote > </param-value> > > </context-param> > > <context-param> > <param-name>resteasy.scan</param-name> > <param-value>true</param-value> > </context-param> > > <context-param> > <param-name>resteasy.resource.method-interceptors</param-name> > <param-value> > org.jboss.resteasy.core.ResourceMethodSecurityInterceptor > </param-value> > </context-param> > > <listener> > > <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class> > </listener> > > <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> > </web-app> > > ------------------------------------------------ > > I have an EAR named JobTracker, and this naming context > > +- JobTraker (class: org.jnp.interfaces.NamingContext) > | +- ResultDaoRest (class: org.jnp.interfaces.NamingContext) > | | +- remote (proxy: $Proxy520 implements > interface > com.linkdex.server.resteasy.dao.IResultDaoRest,interface > org.jboss.ejb3.JBossProxy) > | +- LocatingRessourceBean (class: > org.jnp.interfaces.NamingContext) > | | +- remote (proxy: $Proxy523 implements interface > com.linkdex.server.resteasy.dao.ILocatingRessource,interface > org.jboss.ejb3.JBossProxy) > > --------------------------------------------------- > > When I deploy my EAR i have this error : > > RuntimeException: Class is not a root resource. It, or one of its > interfaces must be annotated with @Path: $Proxy538 implements: > com.linkdex.server.resteasy.dao.IResulDaoRest org.jboss.ejb3.JBossProxy > at > org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:116) > [..] > > 14:10:15,484 ERROR [StandardContext] Error listenerStart > 14:10:15,484 ERROR [StandardContext] Erreur de démarrage du contexte > [/LinkdexRESTEasy] suite aux erreurs précédentes > 14:10:15,562 WARN [ServiceController] Problem starting service > jboss.web.deployment:war=LinkdexRESTEasy.war,id=1822547394 > ... > > somebody can help me ? > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > Resteasy-developers mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-developers -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |