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 Fri, 10 Apr 2009 20:45:11 GMT
Another whole day spent on this and still no luck.  :-(

I checked out the openejb sources and ran the maven tests inside
simple-webservice.  Everything passed.  Good.  :-)  Next, I changed the
version of the one openejb dependency from that pom to 3.1 (instead of
3.1.1-SNAPSHOT) to match my own.  The tests pass.  That's good.  So if I
make my stuff look like the example, my tests should pass too.

Next, I went back to my source tree and modified my silly stupid web service
artifacts like this:

package net.foobar;

public interface SayHello {
  public String sayHello();
}

// snip

package net.foobar;

import javax.ejb.Remote;
import javax.ejb.Stateless;

import javax.jws.WebService;

@Stateless(name="SayHello")
@WebService
@Remote
public class SayHelloImpl implements SayHello {

  @Override
  public String sayHello() {
    return "Hello!";
  }

}

And my test code now looks like this:

public class TestCaseEJB3 {

  private Context context;

  @Before
  public final void setUp() throws Exception {
    final Properties properties = new Properties();
    properties.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
    properties.put("openejb.embedded.remotable", "true");
    this.context = new InitialContext(properties);
  }

  // This test passes just fine
  @Test
  public void testAll() throws Exception {
    assertNotNull(this.context);
    final Object o = this.context.lookup("SayHelloRemote");
    assertTrue(o instanceof SayHello);
    final SayHello sh = (SayHello)PortableRemoteObject.narrow(o,
SayHello.class);
    assertNotNull(sh);
    assertEquals("Hello!", sh.sayHello());
  }

  // This test FAILS
  @Test
  public void testWebService() throws Exception {
    final Service sayHelloService = Service.create(new URL("
http://127.0.0.1:4204/SayHelloImpl?wsdl"), null);
    assertNotNull(sayHelloService);

    final SayHello sayHello = sayHelloService.getPort(SayHello.class);
    assertNotNull(sayHello);
    assertEquals("Hello!", sayHello.sayHello());
  }

  @After
  public final void shutDown() throws Exception {
    this.context = null;
  }

}

When I run this, I get:

[Fatal Error] SayHelloImpl?wsdl:1:1: Premature end of file.
Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 6.297 sec
<<< FAILURE!
testWebService(net.jenzabar.jxtraining.TestCaseEJB3)  Time elapsed: 0.093
sec  <<< ERROR!
javax.xml.ws.WebServiceException:
org.apache.cxf.service.factory.ServiceConstructionException: Failed to
create service.
    at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:129)
    at
org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:55)
    at javax.xml.ws.Service.<init>(Service.java:56)
    at javax.xml.ws.Service.create(Service.java:680)
    at net.foobar.TestCaseEJB3.testWebService(TestCaseEJB3.java:50)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
    at
org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
    at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
    at
org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
    at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
    at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
    at
org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
    at
org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
    at
org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
    at
org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
    at
org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
    at
org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
    at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
    at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
    at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:165)
    at org.apache.maven.surefire.Surefire.run(Surefire.java:107)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:289)
    at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1005)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException:
Failed to create service.
    at
org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:83)
    at
org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:135)
    at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:127)
    ... 30 more
Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR:
Problem parsing 'http://127.0.0.1:4204/SayHelloImpl?wsdl'.:
org.xml.sax.SAXParseException: Premature end of file.
    at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(Unknown Source)
    at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
    at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
    at
org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:199)
    at
org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:163)
    at
org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:81)
    ... 32 more
Caused by: org.xml.sax.SAXParseException: Premature end of file.
    at
com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:239)
    at
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
    ... 38 more

Thanks in advance for any help.  I know you're sick of me by this
point--*I'm* sick of me by this point.

Best,
Laird

On Fri, Apr 10, 2009 at 8:21 AM, Laird Nelson <ljnelson@gmail.com> wrote:

> On Thu, Apr 9, 2009 at 7:30 PM, David Blevins <david.blevins@visi.com>wrote:
>
>> The long and short of it is the spec is strongly against using a business
>> interface as both local and remote due to the very different semantics --
>> pass by value vs. pass by reference -- the thinking is that it would confuse
>> users and do more harm than good; I think it'd be useful personally.
>
>
> OK, but I still get errors if I change the interface to @Local.  Maybe I
> misunderstood?
>
> Best,
> Laird
>
>

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