• 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,测试通过。不再报错。

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

  • 相关阅读:
    css+javascript 仿outlook滑动菜单效果代码
    闭包
    AJAX式多数据源及节点异步加载树_meetrice
    CSS圆角边框表格
    Editplus 3.0 开发ext 教程
    IE右键快速转载到博客
    自已扩展EXT组件(Extending Ext Components)
    Ext程序规划入门
    EXT2联动选框 (Linked Combos Tutorial for Ext 2)
    EXT snippets 笔记
  • 原文地址:https://www.cnblogs.com/digdeep/p/9725037.html
Copyright © 2020-2023  润新知