My Oracle Support Banner

Problem To Make REST And SOAP Webservice Work In A Simlpe Web Application (Doc ID 1989407.1)

Last updated on OCTOBER 19, 2018

Applies to:

Oracle WebLogic Server - Version and later
Information in this document applies to any platform.


Simple web application which exposes both a REST Service and a SOAP Webservice could be packaged in a WAR file.


The 2 Service class are :
- TESTMediaLibraryREST for the REST service
- TESTMediaLibraryWS for the SOAP Webservice

public class TESTMediaLibraryWS
   @WebMethod(operationName = "trouverCD")
   public CompactDisc findCD(@WebParam(name = "id") final String p_identifiant)
      final CompactDisc cd = new CompactDisc();
      cd.setTitle("Titre = " + p_identifiant);
      return cd;


public class TESTMediaLibraryREST
   @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
   public Book findBook(@PathParam("id") final Long p_identifiant)
      final Book book = new Book();
      book.setTitle("Titre " + p_identifiant);
      return book;


- TESTMediaLibraryWS works fine when declared @Stateless and @WebService AND TESTMediaLibraryREST is not declared @Stateless.

- TESTMediaLibraryREST fails when @Stateless annotation is enabled.

public class TESTMediaLibraryREST  {}

public class TESTMediaLibraryWS {}

Example application :
1/ is based upon Oracle's Java EE 6 example application
2/ deploys fine with just two EJBs within a war (not exposed with jax-ws or jax-rs).
3/ crashes as soon as exposed EJBs with jax-ws and jax-rs, as reported.

Throws below Exception:

AVERTISSEMENT: An instance of EJB class could not be looked up using simple form name. Attempting
to look up using the fully-qualified form name.
javax.naming.NameNotFoundException: While trying to look up comp/env/TESTMediaLibraryREST in /app/webapp/test-exposition-rest-ws.war/2746819.; remaining name 'comp/env/TESTMediaLibraryREST'
        at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(
        at weblogic.jndi.internal.ApplicationNamingNode.lookup(
        at weblogic.jndi.internal.WLEventContextImpl.lookup(
        at weblogic.jndi.internal.WLContextImpl.lookup(
        at weblogic.jndi.internal.AbstractURLContext.lookup(
        at javax.naming.InitialContext.lookup(
        at weblogic.jaxrs.onwls.deploy.ejb.provider.EJBComponentProviderFactory.lookupSimpleForm(
        at weblogic.jaxrs.onwls.deploy.ejb.provider.EJBComponentProviderFactory.lookup(
        at weblogic.jaxrs.onwls.deploy.ejb.provider.EJBComponentProviderFactory.getComponentProvider(



To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.