cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: svn commit: r723026 - in /cxf/branches/2.1.x-fixes: ./ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ systests/src/test/java/org/apache/cxf/systest/jaxws/
Date Mon, 08 Dec 2008 06:10:18 GMT
Hi Dan,

I got this error when I ran the ClientServerMiscTest in 2.1.x-fixes
branch. Could you have a look at this ?

java.lang.annotation.AnnotationTypeMismatchException: Incorrectly typed
data found for annotation element public abstract boolean
javax.xml.bind.annotation.XmlElement.required() (Found data of type
class java.lang.String[true])
	at
sun.reflect.annotation.AnnotationTypeMismatchExceptionProxy.generateException(Unknown
Source)
	at sun.reflect.annotation.AnnotationInvocationHandler.invoke(Unknown
Source)
	at $Proxy37.required(Unknown Source)
	at
com.sun.xml.bind.v2.model.annotation.XmlElementQuick.required(XmlElementQuick.java:48)
	at
com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl.getTypes(ElementPropertyInfoImpl.java:139)
	at
com.sun.xml.bind.v2.model.impl.RuntimeElementPropertyInfoImpl.getTypes(RuntimeElementPropertyInfoImpl.java:86)
	at
com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.size(ElementPropertyInfoImpl.java:78)
	at java.util.AbstractList$Itr.hasNext(Unknown Source)
	at
com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:255)
	at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:98)
	at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:79)
	at
com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:209)
	at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:93)
	at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:79)
	at
com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:315)
	at
com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:330)
	at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:432)
	at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:286)
	at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
	at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:117)
	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
org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContextAndSchemas(JAXBDataBinding.java:431)
	at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:257)
	at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:359)
	at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:519)
	at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:410)
	at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:189)
	at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:164)
	at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:100)
	at
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:117)
	at
org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:168)
	at org.apache.cxf.systest.jaxws.ServerMisc.run(ServerMisc.java:76)
	at
org.apache.cxf.testutil.common.AbstractTestServerBase.start(AbstractTestServerBase.java:67)
	at org.apache.cxf.systest.jaxws.ServerMisc.main(ServerMisc.java:112)

Willem


dkulp@apache.org wrote:
> Author: dkulp
> Date: Wed Dec  3 11:28:56 2008
> New Revision: 723026
> 
> URL: http://svn.apache.org/viewvc?rev=723026&view=rev
> Log:
> Merged revisions 723024 via svnmerge from 
> https://svn.apache.org/repos/asf/cxf/trunk
> 
> ........
>   r723024 | dkulp | 2008-12-03 14:24:56 -0500 (Wed, 03 Dec 2008) | 2 lines
>   
>   [CXF-1930] Fix for anonymous wrappers when asm is found
> ........
> 
> Modified:
>     cxf/branches/2.1.x-fixes/   (props changed)
>     cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java
>     cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
>     cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java
> 
> Propchange: cxf/branches/2.1.x-fixes/
> ------------------------------------------------------------------------------
> --- svn:mergeinfo (original)
> +++ svn:mergeinfo Wed Dec  3 11:28:56 2008
> @@ -1 +1 @@
> -/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150,705235,705274,705340,705446,705548,705614,705692,705708,706482,706631,706675,706900,706909,707034,707089,707100,707902,708035,708044,708074,708410,708417,708550,708554,709353-709354,709425,710076,710150,71
015
>  4,711193,711388,711410,711490,711635,711975,712194,712198,712238,712272,712299,712312,712670,712893,713082,713095-713096,713099,713584,713597,713737,713804,713899,714167-714168,714245,714255,717937-717961,718281,718439,718448,718565,718620,718640,718665,718970,719017,719210,719215-719218,719222,719273,719305,719327,719354,719362,719368,719382,719649,719680,720053,720119,720238
> +/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150,705235,705274,705340,705446,705548,705614,705692,705708,706482,706631,706675,706900,706909,707034,707089,707100,707902,708035,708044,708074,708410,708417,708550,708554,709353-709354,709425,710076,710150,71
015
>  4,711193,711388,711410,711490,711635,711975,712194,712198,712238,712272,712299,712312,712670,712893,713082,713095-713096,713099,713584,713597,713737,713804,713899,714167-714168,714245,714255,717937-717961,718281,718439,718448,718565,718620,718640,718665,718970,719017,719210,719215-719218,719222,719273,719305,719327,719354,719362,719368,719382,719649,719680,720053,720119,720238,723024
> 
> Propchange: cxf/branches/2.1.x-fixes/
> ------------------------------------------------------------------------------
> Binary property 'svnmerge-integrated' - no diff available.
> 
> Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java
> URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java?rev=723026&r1=723025&r2=723026&view=diff
> ==============================================================================
> --- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java
(original)
> +++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java
Wed Dec  3 11:28:56 2008
> @@ -161,14 +161,17 @@
>                                          boolean isRequest) {
>  
>          QName wrapperElement = messageInfo.getName();
> +        
> +        boolean anonymous = factory.getAnonymousWrapperTypes();
>  
>          ClassWriter cw = createClassWriter();
> -        String className = getPackageName(method) + ".jaxws_asm." 
> +        String pkg = getPackageName(method) + ".jaxws_asm" + (anonymous ? "_an" : "");
> +        String className =  pkg + "." 
>              + StringUtils.capitalize(op.getName().getLocalPart());
>          if (!isRequest) {
>              className = className + "Response";
>          }
> -        String pname = getPackageName(method) + ".jaxws_asm.package-info";
> +        String pname = pkg + ".package-info";
>          Class<?> def = findClass(pname, method.getDeclaringClass());
>          if (def == null) {
>              generatePackageInfo(pname, wrapperElement.getNamespaceURI(),
> @@ -195,8 +198,12 @@
>          av0.visitEnd();
>  
>          av0 = cw.visitAnnotation("Ljavax/xml/bind/annotation/XmlType;", true);
> -        av0.visit("name", wrapperElement.getLocalPart());
> -        av0.visit("namespace", wrapperElement.getNamespaceURI());
> +        if (!anonymous) {
> +            av0.visit("name", wrapperElement.getLocalPart());
> +            av0.visit("namespace", wrapperElement.getNamespaceURI());
> +        } else {
> +            av0.visit("name", "");            
> +        }
>          av0.visitEnd();
>  
>          // add constructor
> 
> Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
> URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java?rev=723026&r1=723025&r2=723026&view=diff
> ==============================================================================
> --- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
(original)
> +++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
Wed Dec  3 11:28:56 2008
> @@ -19,12 +19,16 @@
>  
>  package org.apache.cxf.systest.jaxws;
>  
> +import java.io.InputStream;
>  import java.lang.reflect.UndeclaredThrowableException;
> +import java.net.HttpURLConnection;
>  import java.net.URL;
>  import java.util.ArrayList;
>  import java.util.Arrays;
>  import java.util.Collections;
> +import java.util.HashMap;
>  import java.util.List;
> +import java.util.Map;
>  import java.util.Set;
>  
>  import javax.xml.namespace.QName;
> @@ -32,6 +36,10 @@
>  import javax.xml.ws.Service;
>  import javax.xml.ws.soap.SOAPBinding;
>  import javax.xml.ws.soap.SOAPFaultException;
> +import javax.xml.xpath.XPathConstants;
> +
> +import org.w3c.dom.Document;
> +import org.w3c.dom.Node;
>  
>  import org.apache.cxf.anonymous_complex_type.AnonymousComplexType;
>  import org.apache.cxf.anonymous_complex_type.AnonymousComplexTypeService;
> @@ -39,7 +47,10 @@
>  import org.apache.cxf.anonymous_complex_type.RefSplitNameResponse;
>  import org.apache.cxf.anonymous_complex_type.SplitName;
>  import org.apache.cxf.anonymous_complex_type.SplitNameResponse.Names;
> +import org.apache.cxf.binding.soap.Soap11;
>  import org.apache.cxf.frontend.ClientProxyFactoryBean;
> +import org.apache.cxf.helpers.XMLUtils;
> +import org.apache.cxf.helpers.XPathUtils;
>  import org.apache.cxf.jaxb_element_test.JaxbElementTest;
>  import org.apache.cxf.jaxb_element_test.JaxbElementTest_Service;
>  import org.apache.cxf.ordered_param_holder.ComplexStruct;
> @@ -556,4 +567,44 @@
>          assertEquals(2, port.operationInSub1(2));
>          assertEquals(3, port.operationInSub2(3));
>      }
> +    
> +    
> +    
> +    @Test
> +    public void testAnonymousMinOccursConfig() throws Exception {
> +        HttpURLConnection httpConnection = 
> +            getHttpConnection(ServerMisc.DOCLIT_CODEFIRST_SETTINGS_URL + "?wsdl"); 
  
> +        httpConnection.connect();        
> +        
> +        assertEquals(200, httpConnection.getResponseCode());
> +        assertEquals("OK", httpConnection.getResponseMessage());
> +        InputStream in = httpConnection.getInputStream();
> +        assertNotNull(in);
> +        
> +        Document doc = XMLUtils.parse(in);
> +        assertNotNull(doc);
> +        
> +        
> +        Map<String, String> ns = new HashMap<String, String>();
> +        ns.put("soap", Soap11.SOAP_NAMESPACE);
> +        ns.put("tns", "http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService");
> +        ns.put("wsdl", "http://schemas.xmlsoap.org/wsdl/");
> +        ns.put("xs", "http://www.w3.org/2001/XMLSchema");
> +        
> +        
> +        XPathUtils xu = new XPathUtils(ns);
> +        
> +        //make sure the wrapper types are anonymous types
> +        Node ct = (Node) xu.getValue("//wsdl:definitions/wsdl:types/xs:schema"
> +                                     + "/xs:element[@name='getFooSetResponse']/xs:complexType/xs:sequence",
> +                                     doc, XPathConstants.NODE);
> +        assertNotNull(ct);
> +        
> +        //make sure the params are nillable, not minOccurs=0
> +        ct = (Node) xu.getValue("//wsdl:definitions/wsdl:types/xs:schema"
> +                                + "/xs:element[@name='multiInOut']/xs:complexType/xs:sequence"
> +                                + "/xs:element[@nillable='true']",
> +                                doc, XPathConstants.NODE);
> +        assertNotNull(ct);
> +    }
>  }
> 
> Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java
> URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java?rev=723026&r1=723025&r2=723026&view=diff
> ==============================================================================
> --- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java
(original)
> +++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java
Wed Dec  3 11:28:56 2008
> @@ -26,9 +26,11 @@
>  import org.apache.cxf.jaxws.JAXWSMethodInvoker;
>  import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
>  import org.apache.cxf.ordered_param_holder.OrderedParamHolderImpl;
> +import org.apache.cxf.service.factory.AbstractServiceConfiguration;
>  import org.apache.cxf.service.invoker.Factory;
>  import org.apache.cxf.service.invoker.PerRequestFactory;
>  import org.apache.cxf.service.invoker.PooledFactory;
> +import org.apache.cxf.service.model.MessagePartInfo;
>  import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
>  
>  
> @@ -41,6 +43,8 @@
>          "http://localhost:9003/DocLitWrappedCodeFirstServiceBaseService/";
>      public static final String DOCLITBARE_CODEFIRST_URL = 
>          "http://localhost:9003/DocLitBareCodeFirstService/";
> +    public static final String DOCLIT_CODEFIRST_SETTINGS_URL = 
> +        "http://localhost:9003/DocLitWrappedCodeFirstServiceSettings/";
>      
>      protected void run() {
>          
> @@ -48,11 +52,28 @@
>          factory = new PooledFactory(factory, 4);
>          
>          JAXWSMethodInvoker invoker = new JAXWSMethodInvoker(factory);
> -        JaxWsServerFactoryBean factoryBean = new JaxWsServerFactoryBean();
> +        JaxWsServerFactoryBean factoryBean;
> +        
> +        factoryBean = new JaxWsServerFactoryBean();
>          factoryBean.setAddress(DOCLIT_CODEFIRST_URL);
>          factoryBean.setServiceClass(DocLitWrappedCodeFirstServiceImpl.class);
>          factoryBean.setInvoker(invoker);
>          factoryBean.create();
> +        
> +        factoryBean = new JaxWsServerFactoryBean();
> +        factoryBean.setAddress(DOCLIT_CODEFIRST_SETTINGS_URL);
> +        factoryBean.setServiceClass(DocLitWrappedCodeFirstServiceImpl.class);
> +        factoryBean.setInvoker(invoker);
> +        factoryBean.getServiceFactory().setAnonymousWrapperTypes(true);
> +        factoryBean.getServiceFactory().getServiceConfigurations().add(0, new AbstractServiceConfiguration()
{
> +            public Boolean isWrapperPartNillable(MessagePartInfo mpi) {
> +                return Boolean.TRUE;
> +            }
> +            public Long getWrapperPartMinOccurs(MessagePartInfo mpi) {
> +                return Long.valueOf(1L);
> +            }
> +        });
> +        factoryBean.create();
>           
>          //Object implementor4 = new DocLitWrappedCodeFirstServiceImpl();
>          //Endpoint.publish(DOCLIT_CODEFIRST_URL, implementor4);
> 
> 
> 


Mime
View raw message