tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laird Nelson <ljnel...@gmail.com>
Subject Re: Web services deployment example?
Date Thu, 09 Apr 2009 13:42:42 GMT
Hi, Jonathan; when I follow that example, the test that exercises the
stateless session bean functionality can no longer find anything in the
InitialContext.

To be more specific, my class under test is both an SLSB and a web service.

Here's the interface:

@WebService(targetNamespace="http://foobar.net/wsdl")
public interface SayHello {
  public String sayHello();
}

...and the implementation:

@Stateless
@WebService(portName="SayHelloPort",
            serviceName="SayHelloService",
            targetNamespace="http://foobar.net/wsdl",
            endpointInterface="net.foobar.SayHello")
public class SayHelloImpl implements SayHello {
  @WebMethod
  public String sayHello() {
    return "Hello!";
  }
}

and the relevant test case code:

    final Object o = this.context.lookup("SayHelloImpl");
    assertNotNull(o);
    final SayHello sh = (SayHello)PortableRemoteObject.narrow(o,
SayHello.class);
    assertNotNull(sh);
    assertEquals("Hello!", sh.sayHello());

...and, finally, the output from the container that is relevant to this
problem:

INFO - Created Ejb(deployment-id=SayHelloImpl, ejb-name=SayHelloImpl,
container=Default Stateless Container)
INFO - Deployed Application(path=classpath.ear)
INFO - Starting network services
  ** Starting Services **
  NAME                 IP              PORT
  admin thread         127.0.0.1       4200
  ejbd                 127.0.0.1       4201
-------
Ready!

The test fails thusly:

javax.naming.NameNotFoundException: Name "SayHelloImpl" not found.

I've also enumerated the name bindings in the context via context.list(),
and the output from that is:

.:java.lang.String

...showing that as far as I can tell the context is empty.  It wasn't empty
before I added the remotable property.

Any help here would obviously be appreciated.  :-)  I can't see where I've
deviated from the examples you referred me to, except that I'm blending
annotations--my class under test is both a web service and a stateless
session bean.

Best,
Laird

On Wed, Apr 8, 2009 at 5:21 PM, Jonathan Gallimore <
jonathan.gallimore@gmail.com> wrote:

> Sorry - I made a typo, that should be port 4204.
>
> On Wed, Apr 8, 2009 at 10:08 PM, Jonathan Gallimore <
> jonathan.gallimore@gmail.com> wrote:
>
> > If you haven't already, check out the webservice examples here:
> > https://svn.apache.org/repos/asf/openejb/trunk/openejb3/examples/ -
> > specifically the simple-webservice, webservice-security and
> > webservice-ws-security which I think do you what you want.
> >
> > When you start OpenEJB by creating an InitialContext, make sure you have
> > the remoteable setting on:
> >
> > Properties properties = new Properties();
> > properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
> "org.apache.openejb.client.LocalInitialContextFactory");
> >
> > properties.setProperty("openejb.embedded.remotable", "true");
> >
> > initialContext = new InitialContext(properties);
> >
> > This will ensure that the webservice part of the container is started and
> > your webservice is deployed. By default, your test will expose
> webservices
> > on port 4202.
> >
> > Hope that helps.
> >
> > Jon
> >
> >
> >
> > On Wed, Apr 8, 2009 at 4:58 PM, Laird Nelson <ljnelson@gmail.com> wrote:
> >
> >> Hello; is there an example out there of how to get a JAX-WS web service
> >> running in a local container?
> >>
> >> With Glassfish, I can mark an SLSB implementation class with the
> >> @WebService
> >> annotation, drop the .jar file into the autodeploy directory, and the
> >> webservice is available.
> >>
> >> Currently, I have an OpenEJB container running locally as part of my
> test
> >> suite, but I don't see evidence that the same EJB is deployed as a web
> >> service.  I'd like to have that local container automatically deploy my
> >> web
> >> service so that I can write a stupid little test case that hits the
> >> service
> >> via a URL and verify that it comes up.
> >>
> >> I searched the openejb.apache.org site, and didn't find anything that
> >> addresses this issue specifically--there was a pointer to the Apache CXF
> >> project, but that kind of left me high and dry.
> >>
> >> Any thoughts heartily appreciated.
> >>
> >> Best,
> >> Laird
> >>
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message