mushaofeng / java-ws-discovery

Automatically exported from code.google.com/p/java-ws-discovery
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Unable to multicast probe in java-ws-discovery #6

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Copy/paste the code from 
2.
3.

Hi!

I have a WsDiscoveryNetworkException when I'm using java-ws-discovery inside an 
OSGI bundle. I have pasted the code of the WsDiscoveryExample at 
http://code.google.com/p/java-ws-discovery/wiki/WsDiscoveryFinderExample inside 
the start() method of my bundle.

I'm expecting the discovery service to succeed its multicast operations and 
return results about Web services on a specified target.

My OS is Windows 7. I am using the distributed provided by the ZIP file of the 
Google Code site.

This is my code:

    public void start(BundleContext context) throws Exception
    {
        System.out.println("Creating new finder-instance...");

        WsDiscoveryFinder finder = new WsDiscoveryFinder();

        /**
         * Search for a specific service
         */
        {
            // Describe the port type of the service we are looking for. Namespace is optional.
            //QName myPortType = new QName("http://calculatorservice.examples.wsdiscovery.ms.com/", "CalculatorService");
            QName myPortType = new QName("http://132.210.47.44/", "CalculatorService");

            // Search for with 5 second timeout...
            System.out.println("Searching for service with port type \"" + myPortType.toString() + "\"");
            IWsDiscoveryServiceCollection result = finder.find(myPortType, 5000);

            // Display the results.
            System.out.println("** Discovered services: **");

            for (WsDiscoveryService service : result) {
                // Print service info
                System.out.println(service.toString());

                System.out.println("---");
            }
        }

        /**
         * Search for any service
         */

        {
            System.out.println("Searching for all services (2 sec).");
            IWsDiscoveryServiceCollection result = finder.findAll(2000);

            // Display the results.
            System.out.println("** Discovered services: **");

            for (WsDiscoveryService service : result) {
                // Print service info
                System.out.println(service.toString());

                System.out.println("---");
            }
        }

        // Stop finder
        finder.done();
    }

This is the output I have:

Welcome to Felix
================

Creating new finder-instance...
Searching for service with port type "{http://132.210.47.44/}CalculatorService"
11-Oct-2010 3:16:27 PM com.ms.wsdiscovery.logger.WsDiscoveryLogger fine
FINE: Multicasting probe (not using proxy).
com.ms.wsdiscovery.exception.WsDiscoveryNetworkException: Unable to multicast 
probe
        at com.ms.wsdiscovery.standard11.WsDiscoveryS11DispatchThread.sendProbe(WsDiscoveryS11DispatchThread.java:159)
        at com.ms.wsdiscovery.WsDiscoveryServer.probe(WsDiscoveryServer.java:150)
ERROR: Error starting 
file:/C:/Users/Pierre-Alexandre/Documents/NetBeansProjects/Prototype3Client/targ
et/Prototype3Client-1.0-SNAPSHOT.jar (org.osgi.framework.BundleException: 
Activator start error in bundle domus.usherbrooke.Prototype3Client [13].)
        at com.ms.wsdiscovery.WsDiscoveryFinder.find(WsDiscoveryFinder.java:151)
        at com.ms.wsdiscovery.WsDiscoveryFinder.find(WsDiscoveryFinder.java:213)
        at com.ms.wsdiscovery.WsDiscoveryFinder.find(WsDiscoveryFinder.java:324)
        at domus.usherbrooke.prototype3client.Prototype3ClientActivator.start(Prototype3ClientActivator.java:32)
        at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:640)
        at org.apache.felix.framework.Felix.activateBundle(Felix.java:1700)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1622)
        at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1077)
        at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
        at java.lang.Thread.run(Unknown Source)
Caused by: com.skjegstad.soapoverudp.exceptions.SOAPOverUDPException: Unable to 
convert SOAPMessage to XML.
        at com.skjegstad.soapoverudp.messages.SOAPOverUDPMessage.toString(SOAPOverUDPMessage.java:406)
        at com.skjegstad.soapoverudp.SOAPOverUDP.sendMulticast(SOAPOverUDP.java:83)
        at com.ms.wsdiscovery.standard11.WsDiscoveryS11DispatchThread.sendProbe(WsDiscoveryS11DispatchThread.java:157)
        ... 11 more
Caused by: com.skjegstad.soapoverudp.exceptions.SOAPOverUDPException: Unable to 
create JAXB instance: com.skjegstad.soapoverudp.jaxb.wsaddressing200508
        at com.skjegstad.soapoverudp.SOAPOverUDPUtilities.createJAXBContext(SOAPOverUDPUtilities.java:48)
        at com.skjegstad.soapoverudp.datatypes.SOAPOverUDPNamespaces.getJAXBContext(SOAPOverUDPNamespaces.java:60)
        at com.skjegstad.soapoverudp.datatypes.SOAPOverUDPNamespaces.getUnmarshaller(SOAPOverUDPNamespaces.java:73)
        at com.skjegstad.soapoverudp.messages.SOAPOverUDPWSA200508Message.removeWSAHeader(SOAPOverUDPWSA200508Message.java:71)
        at com.skjegstad.soapoverudp.messages.SOAPOverUDPWSA200508Message.saveWSAHeader(SOAPOverUDPWSA200508Message.java:118)
        at com.skjegstad.soapoverudp.messages.SOAPOverUDPMessage.saveChanges(SOAPOverUDPMessage.java:173)
        at com.ms.wsdiscovery.standard11.WsDiscoveryS11SOAPMessage.saveChanges(WsDiscoveryS11SOAPMessage.java:526)
        at com.skjegstad.soapoverudp.messages.SOAPOverUDPMessage.toString(SOAPOverUDPMessage.java:398)
        ... 13 more
Caused by: javax.xml.bind.JAXBException: 
"com.skjegstad.soapoverudp.jaxb.wsaddressing200508" doesnt contain 
ObjectFactory.class or jaxb.index
        at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at javax.xml.bind.ContextFinder.newInstance(Unknown Source)
        at javax.xml.bind.ContextFinder.find(Unknown Source)
        at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
        at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
        at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
        at com.skjegstad.soapoverudp.SOAPOverUDPUtilities.createJAXBContext(SOAPOverUDPUtilities.java:46)
        ... 20 more

Please help.

Original issue reported on code.google.com by paga...@quazal.com on 11 Oct 2010 at 7:21