• java.lang.IllegalArgumentException: No enum constant org.apache.ws.commons.schema.XmlSchemaForm.


    一次系统断电维护之后,apache cxf 的 web service 接口调用一直报错:

    java.lang.IllegalArgumentException: No enum constant org.apache.ws.commons.schema.XmlSchemaForm.
    at java.lang.Enum.valueOf(Unknown Source)
    at org.apache.ws.commons.schema.EnumUtil.valueOf(EnumUtil.java:33)
    at org.apache.ws.commons.schema.XmlSchemaForm.schemaValueOf(XmlSchemaForm.java:32)
    at org.apache.ws.commons.schema.SchemaBuilder.getFormDefault(SchemaBuilder.java:181)
    at org.apache.ws.commons.schema.SchemaBuilder.handleSchemaElementBasics(SchemaBuilder.java:1489)
    at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:649)
    at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:540)
    at org.apache.cxf.common.xmlschema.SchemaCollection.read(SchemaCollection.java:129)
    at org.apache.cxf.wsdl11.SchemaUtil.extractSchema(SchemaUtil.java:140)
    at org.apache.cxf.wsdl11.SchemaUtil.getSchemas(SchemaUtil.java:73)
    at org.apache.cxf.wsdl11.SchemaUtil.getSchemas(SchemaUtil.java:65)
    at org.apache.cxf.wsdl11.SchemaUtil.getSchemas(SchemaUtil.java:60)
    at org.apache.cxf.wsdl11.WSDLServiceBuilder.getSchemas(WSDLServiceBuilder.java:372)
    at org.apache.cxf.wsdl11.WSDLServiceBuilder.buildServices(WSDLServiceBuilder.java:339)
    at org.apache.cxf.wsdl11.WSDLServiceBuilder.buildServices(WSDLServiceBuilder.java:203)
    at org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:175)
    at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:428)
    at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:548)
    at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:265)
    at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:215)
    at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102)
    at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:91)
    at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:157)
    at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142)
    at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:478)
    at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:345)
    at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:336)
    at javax.xml.ws.Service.getPort(Unknown Source)
    at cn.com.xxxx.PTService.getPTServiceHttpSoap11Endpoint(PTService.java:72)

    这个错误很奇特:

    java.lang.IllegalArgumentException: No enum constant org.apache.ws.commons.schema.XmlSchemaForm.
    at java.lang.Enum.valueOf(Unknown Source)
    at org.apache.ws.commons.schema.EnumUtil.valueOf(EnumUtil.java:33)

    XmlSchemaForm.  这里 点 . 后面 是空的?????

    尼玛啥意思。。。

    原因应该是传给 Enum.valueOf 方法的参数有问题( java.lang.Enum.valueOf(Unknown Source)),导致报错了。

    最后 定位到 jar包:xmlschema-core-2.1.0.jar ,查看源码:

    public enum XmlSchemaForm {
        NONE,
        QUALIFIED,
        UNQUALIFIED;
        
        public static XmlSchemaForm schemaValueOf(String name) {
            return EnumUtil.valueOf(XmlSchemaForm.class, name);
        }
    
        @Override
        public String toString() {
            switch (this) {
            case QUALIFIED:
                return "qualified";
            case UNQUALIFIED:
                return "unqualified";
            }
            return "none";
        }
    }

    所以 org.apache.ws.commons.schema.XmlSchemaForm. 可能应该是 org.apache.ws.commons.schema.XmlSchemaForm.NONE 

    把 2.1.0 换成最新的 xmlschema-core-2.2.3.jar,测试通过。不再报错。

    具体什么原因还是没有查清楚,不过问题解决了。记录一下。

  • 相关阅读:
    nyoj 115------城市平乱( dijkstra // bellman )
    nyoj-----284坦克大战(带权值的图搜索)
    nyoj-----42一笔画问题
    hdu-------1081To The Max
    nyoj------170网络的可靠性
    HDUOJ-------1052Tian Ji -- The Horse Racing(田忌赛马)
    初学Java之Pattern与Matcher类
    初学java之StringBuffer类的常用方法
    初学java之大数处理
    hdu---1024Max Sum Plus Plus(动态规划)
  • 原文地址:https://www.cnblogs.com/digdeep/p/9725037.html
Copyright © 2020-2023  润新知