Hello All,
 I am using CXF-2.3.2 to generate Jax-b'ed objects which I use to invoke
several web services. I'm working within an OSGI container which I believe
is complicating the issue somewhat.

When I invoke two services I see one block until the other is completed:
--------------------------------------------------------------------------------
//thread 1 will take ten seconds to return
                        try
                        {
                                System.out.println("preservice");
                                _myService = new ControlService(url, 
SERVICE_NAME);
                                System.out.println("postservice");
                        }
                        catch(WebServiceException e)
                        {
                                StringBuffer message = new StringBuffer();
                                message.append("Unable to connect to Control 
Service:");
                                message.append(" ");
                                message.append(e.getMessage());
                                RuntimeException ex= new 
RuntimeException(message.toString(), e);
                                throw ex;
                        }
                      System.out.println("preport");
                      Control control=myService .getControlPort();
                      System.out.println("postport");

                      System.out.println("prewait");
                     JobDetails jobDetails = control.waitTenSecs(loj);
                     System.out.println("postwait");
-----------------------------------------------------------------------------------------
//thread 2 will return immediatly if invoked on its own.
                        try
                        {
                                System.out.println("preservice");
                                _myService = new ControlService(url, 
SERVICE_NAME);
                                System.out.println("postservice");
                        }
                        catch(WebServiceException e)
                        {
                                StringBuffer message = new StringBuffer();
                                message.append("Unable to connect to Control 
Service:");
                                message.append(" ");
                                message.append(e.getMessage());
                                RuntimeException ex= new 
RuntimeException(message.toString(), e);
                                throw ex;
                        }
                      System.out.println("preport");
                      Control control=myService .getControlPort();
                      System.out.println("postport");

                      System.out.println("preimed");
                     JobDetails jobDetails = control.immediateReturn(loj);
                     System.out.println("postimed");
----------------------------------------------------------------
Output:

preservice //thread 1
postservice //thread 1
preport  //thread 1
postport //thread 1
prewait //thread 1

preservice //Thread 2
postservice //Thread 2
preport //Thread 2
postport //Thread 2
preimed //Thread 2
//ten seconds pass
postwait //Thread 1
postimed //Thread 2

I see this behavior even when I am invoking two completely different
services from two different wsdl's.
I've also used Soap-UI to verify that the services can be invoked
simultaneously from the server end.

I've tried upgrading to the latest version (2.5.2) but when I invoke the
service I get the following exception:
----------------------------------------------------------------------------------------------------
Apr 4, 2012 11:53:08 AM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromWSDL
INFO: Creating Service {http://services.raytheon.com/}ControlService from
WSDL: https://aurd-isfl018211:61620/control/?wsdl
Exception in thread "Status Service-1333561987939"
javax.xml.ws.WebServiceException:
org.apache.cxf.service.factory.ServiceConstructionException
        at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:334)
        at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:319)
        at javax.xml.ws.Service.getPort(Service.java:40)
        at
com.raytheon.services.ControlService.getControlPort(ControlService.java:78)
        at
com.raytheon.services.status.processing.StatusServiceProcessing.process(StatusServiceProcessing.java:106)
        at
com.raytheon.services.status.processing.StatusServiceProcessing.run(StatusServiceProcessing.java:192)
        at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
        at 
org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:294)
        at
org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
        at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:401)
        at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:506)
        at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:242)
        at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:205)
        at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)
        at
org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90)
        at
org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:155)
        at
org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:155)
        at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:465)
        at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:332)
        ... 6 more
Caused by: javax.xml.bind.JAXBException: Unable to create context
 - with linked exception:
[java.lang.reflect.InvocationTargetException]
        at javax.xml.bind.ContextFinder.find(ContextFinder.java:106)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:65)
        at org.apache.cxf.jaxb.JAXBContextCache$2.run(JAXBContextCache.java:268)
        at org.apache.cxf.jaxb.JAXBContextCache$2.run(JAXBContextCache.java:267)
        at java.security.AccessController.doPrivileged(Native Method)
        at
org.apache.cxf.jaxb.JAXBContextCache.createContext(JAXBContextCache.java:266)
        at
org.apache.cxf.jaxb.JAXBContextCache.getCachedContextAndSchemas(JAXBContextCache.java:172)
        at
org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContextAndSchemas(JAXBDataBinding.java:424)
        at 
org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:292)
        ... 17 more
Caused by: java.lang.reflect.InvocationTargetException
        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 javax.xml.bind.ContextFinder.find(ContextFinder.java:104)
        ... 25 more
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts
of IllegalAnnotationExceptions
The createJobDetailsInput method has @XmlElementMapping on it, but it
doesn't return a sub-type of JAXBElement.
        this problem is related to the following location:
                at @javax.xml.bind.annotation.XmlElementDecl(scope=class
javax.xml.bind.annotation.XmlElementDecl$GLOBAL, substitutionHeadName=,
defaultValue=


-------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------

I have used the 2.5.2 jars in my build scripts to generate the jax-b'ed
files:
     *******
        <target name="generate-CXF-Client" description="">
                <java classname="org.apache.cxf.tools.wsdlto.WSDLToJava" 
fork="true">
                <jvmarg value="-Djava.endorsed.dirs=${cxf.endorsed.dir}" />
                        <arg value="-client" />
                        <arg value="-d" />
                        <arg value="${src.dir}" />
                        <arg value="-b" />
                        <arg value="${jaxb.path}" />
                        <arg value="-classdir" />
                        <arg value="${bin.dir}" />
                        <arg value="-p" />
                        <arg 
value="http://www.company.com/enterprise/productrequest/service"; />
                        
                        <arg value="${wsdl.path}" />
                        <classpath>
                              <path refid="cxf.classpath" />
                        </classpath>
                </java>
        </target>

        <target name="compile">
            <javac destdir="${classes.dir}" fork="${value.compile.fork}"
debug="true">
                <compilerarg line="-Djava.endorsed.dirs=${cxf.endorsed.dir}" />
                <src path="${src.dir}" />
                <classpath>
                        <pathelement location="${provider.classpath}" />
                        <fileset dir="${lib.dir}">
                                <include name="*.jar" />
                        </fileset>
                </classpath>
            </javac>
        </target>
  *******
I am fairly confident in my build script not so confident in my OSGI
Configuration:
I use cxf-dosgi-ri-singlebundle-distribution-1.3.jar to expose cxf at
runtime:
Manifest.MF
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: ProductDetailedStatusService
Bundle-SymbolicName: ProductDetailedStatusPlugIn
Bundle-Version: 1.0.0.0
Bundle-Activator: productdetailedstatusservice.Activator
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.osgi.framework;version="1.3.0"
Export-Package: com.company.services.status.models,
 com.company.services.status.processing
Require-Bundle:
cxf-dosgi-ri-singlebundle-distribution;bundle-version="1.3.0"

>From feature.xml:
...
   <requires>
      <import plugin="cxf-dosgi-ri-singlebundle-distribution"/>
   </requires>
...

For good measure I added :
-Djava.endorsed.dirs="C:\OpenSource\ECLIPSE\ApacheCXF\2.5.2\lib\endorsed";
To endorse the libs dir.



SO my question is two fold:
1. How do I invoke two service simultaneously within the same JVM.  
2. if upgrading is the solution what am I doing wrong?


--
View this message in context: 
http://cxf.547215.n5.nabble.com/Blocking-issue-in-CFX-Client-tp5618710p5618710.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to