Please provide a sample *reproducing* the error. This one doesnt + @POST
without body doesn't make much sense.

Side note: don't add a star at the end of @ApplicationPath mapping please


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-04-06 17:35 GMT+02:00 David Goodenough <
[email protected]>:

> No static blocks in the code.  Here is a really basic test:-
>
> RestApp.java
>
> package uk.co.dga.test;
>
> import java.util.HashSet;
> import java.util.Set;
>
> import javax.ws.rs.ApplicationPath;
> import javax.ws.rs.core.Application;
>
> @ApplicationPath("/*")
> public class RestApp extends Application {
>         @Override public Set<Class<?>>getClasses() {
>                 Set<Class<?>>s = new HashSet<Class<?>>();
>                 s.add(RestEjb.class);
>                 return s;
>                 }
>         }
>
> RestEjb.java
>
> package uk.co.dga.test;
>
> import javax.ejb.Stateless;
> import javax.ws.rs.POST;
> import javax.ws.rs.Path;
> import javax.ws.rs.Produces;
> import javax.ws.rs.core.MediaType;
>
> @Stateless
> @Path("/test")
> public class RestEjb {
>         @POST
>         @Produces(MediaType.TEXT_PLAIN)
>         public String process() {
>                 return "Hello World";
>                 }
>         }
>
> and the file structure in webapps/test is:-
>
> webapps/test/
> |-- HelloWorld
> |   |-- META-INF
> |   |   `-- MANIFEST.MF
> |   `-- WEB-INF
> |       |-- classes
> |       |   `-- uk
> |       |       `-- co
> |       |           `-- dga
> |       |               `-- test
> |       |                   |-- RestApp.class
> |       |                   `-- RestEjb.class
> |       `-- lib
> `-- HelloWorld.war
>
> David
>
>
> On Monday 06 April 2015 17:17:47 Romain Manni-Bucau wrote:
> > Hi
> >
> > Can it be a static block failing or something like that?
> >
> > Can you share a project showing it?
> > I have a JAX-RS application, and if I can I want to use the no-xml
> > configuration with annotations instead.
> >
> > So I have written the main stateless EJB with @Path, which
> > has an @POST annotated method on it, and a second class
> > derived from Application which has an @ApplicationPath annotation.
> > The Application has an overridden method:-
> >
> >         @Override public Set<Class<?>>getClasses() {
> >                 Set<Class<?>>s = new HashSet<Class<?>>();
> >                 s.add(Ejb.class);
> >                 return s;
> >                 }
> >
> > I then put the whole lot in a war file which contains just those
> > classes and a few others that I reference from the @POST method.
> > They all make reference to libraries that are in the {tomee}/lib
> > directory.  In the war file is also a persistence.xml which defines
> > the postgresql driver and the JDBC connection info (the driver is
> > included in the  war file)
> >
> > I finally put the war file in its own directory in the webapps directory
> > and start tomee (using bin/startup.sh).
> >
> > In the log file I get information which seems to say that it has
> > found everything:-
> >
> > INFO - REST Application: http://localhost:8080/test/*           ->
> > uk.co.dga.test.App
> > INFO -      Service URI: http://localhost:8080/test/ejb  ->  EJB
> > uk.co.dga.test.Ejb
> > INFO -              POST http://localhost:8080/test/ejb/ ->      Reply
> > process(JAXBElement<Request>)
> >
> > So it seems to have found both classes.
> >
> > Then however is starts to complain:-
> >
> > SEVERE - Error waiting for multi-thread deployment of directories to
> > complete
> > java.util.concurrent.ExecutionException: java.lang.InternalError:
> > LocalBeanProxyFactory.createProxy:
> > java.lang.reflect.InvocationTargetException
> >
> > and a whole stack trace ending with as the inner most part:-
> >
> > Caused by: java.lang.ClassNotFoundException: uk.co.dga.test.Ejb
> >         at
> >
> org.apache.openejb.core.TempClassLoader.loadClass(TempClassLoader.java:186)
> >         at
> >
> org.apache.openejb.core.TempClassLoader.loadClass(TempClassLoader.java:83)
> >         ... 26 more
> >
> > How can it have found it and not found it?
> >
> > David
>
>

Reply via email to