You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Chris Christo <_c...@mail.com> on 2014/02/03 15:33:34 UTC

Using multiple Rest Api services when testing

Hi,

I’m using the ApplicationComposer and the EnableServices(“jaxrs”) when running my test:

@EnableServices(value = "jaxrs")
@RunWith(ApplicationComposer.class)
public final class MyTest {
	@Configuration
	public Properties config() { return PROPERTIES; }

	@Module
	public EjbModule ejb() { return EJB_MODULE; }
}

When I create the EjbModule and add my @Stateless beans to it, if a bean is marked with an @Path annotation, the Application Composer will publish it at the 127.0.0.1…./MyTest/path address. 

Problem is, if I have multiple @Stateless+@Path annotated beans added to the EjbModule, then the application composer attempts to publish all these beans at the 127.0.0.1/MyTest/path address, which results in an error (RuntimeException - Already a destination on https://127.0.0.1:port/MyTest).

Is there a way to have multiple rest beans when using the @EnableServices(“jaxrs”)?

Regards,

Chris




Re: Using multiple Rest Api services when testing

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

using a jaxrs Application?
http://svn.apache.org/repos/asf/tomee/tomee/trunk/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/ApplicationFromWebXmlTest.java
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2014-02-03 Chris Christo <_c...@mail.com>:
> Hi,
>
> I'm using the ApplicationComposer and the EnableServices("jaxrs") when running my test:
>
> @EnableServices(value = "jaxrs")
> @RunWith(ApplicationComposer.class)
> public final class MyTest {
>         @Configuration
>         public Properties config() { return PROPERTIES; }
>
>         @Module
>         public EjbModule ejb() { return EJB_MODULE; }
> }
>
> When I create the EjbModule and add my @Stateless beans to it, if a bean is marked with an @Path annotation, the Application Composer will publish it at the 127.0.0.1..../MyTest/path address.
>
> Problem is, if I have multiple @Stateless+@Path annotated beans added to the EjbModule, then the application composer attempts to publish all these beans at the 127.0.0.1/MyTest/path address, which results in an error (RuntimeException - Already a destination on https://127.0.0.1:port/MyTest).
>
> Is there a way to have multiple rest beans when using the @EnableServices("jaxrs")?
>
> Regards,
>
> Chris
>
>
>