Hi, 

I got a similar problem.
I have downloaded a Calculator example from the following web page: 
http://www.java2s.com/Code/Java/EJB3/webserviceandStatelesssessionbeanOpenEJB.htm
OpenEJB and Web service junit test example 
http://openejb.979440.n4.nabble.com/file/n3804672/simple-webservice.zip
simple-webservice.zip 
There is an error when I execute it: 

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.superbiz.calculator.CalculatorTest
Apache OpenEJB 3.1.4    build: 20101112-03:32
http://openejb.apache.org/
INFO - openejb.home = C:\work\simple-webservice
INFO - openejb.base = C:\work\simple-webservice
INFO - Configuring Service(id=Default Security Service,
type=SecurityService, provider-id=Default Security Service)
INFO - Configuring Service(id=Default Transaction Manager,
type=TransactionManager, provider-id=Default Transaction Manager)
INFO - Found EjbModule in classpath:
C:\work\simple-webservice\target\classes
INFO - Beginning load: C:\work\simple-webservice\target\classes
INFO - Configuring enterprise application: classpath.ear
INFO - Configuring Service(id=Default Stateless Container, type=Container,
provider-id=Default Stateless Container)
INFO - Auto-creating a container for bean CalculatorImpl:
Container(type=STATELESS, id=Default Stateless Container)
INFO - Enterprise application "classpath.ear" loaded.
INFO - Assembling app: classpath.ear
INFO - Jndi(name=CalculatorImplLocal) --> Ejb(deployment-id=CalculatorImpl)
INFO - Created Ejb(deployment-id=CalculatorImpl, ejb-name=CalculatorImpl,
container=Default Stateless Container)
INFO - Deployed Application(path=classpath.ear)
INFO - Initializing network services
INFO - Creating ServerService(id=httpejbd)
INFO - Creating ServerService(id=cxf)
INFO - Creating ServerService(id=admin)
INFO - Creating ServerService(id=ejbd)
INFO - Creating ServerService(id=ejbds)
INFO - Initializing network services
  ** Starting Services **
  NAME                 IP              PORT  
  httpejbd             127.0.0.1       4204  
2011-9-11 13:47:05
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromClass
�Ϣ: Creating Service {http://superbiz.org/wsdl}CalculatorWsService from
class org.superbiz.calculator.CalculatorWs
2011-9-11 13:47:06 org.apache.cxf.endpoint.ServerImpl initDestination
�Ϣ: Setting the server's publish address to be http://nopath:80
  admin thread         127.0.0.1       4200  
  ejbd                 127.0.0.1       4201  
  ejbd                 127.0.0.1       4203  
-------
Ready!
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.77 sec <<<
FAILURE!

Results :

Tests in error: 
  testCalculatorViaWsInterface(org.superbiz.calculator.CalculatorTest):
Could not find service named null in wsdl
http://127.0.0.1:4204/CalculatorImpl?wsdl

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

Here is the junit code: 

public class CalculatorTest extends TestCase {

        //START SNIPPET: setup
        private InitialContext initialContext;

    protected void setUp() throws Exception {
        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);
    }
    //END SNIPPET: setup

    /**
     * Create a webservice client using wsdl url
     *
     * @throws Exception
     */
    //START SNIPPET: webservice
    public void testCalculatorViaWsInterface() throws Exception {
        Service calcService = Service.create(new
URL("http://127.0.0.1:4204/CalculatorImpl?wsdl";), null);
        assertNotNull(calcService);

        CalculatorWs calc = calcService.getPort(CalculatorWs.class);
        assertEquals(10, calc.sum(4,6));
                assertEquals(12, calc.multiply(3,4));
    }
    //END SNIPPET: webservice

}

I also attached a copy of the example here for reference. 

Any suggestion is very appreciated. 
Thanks 
Sam 

--
View this message in context: 
http://openejb.979440.n4.nabble.com/OpenEJB-with-JAX-WS-Unit-Test-Web-Service-not-coming-up-tp982214p3804672.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Reply via email to