zoukankan      html  css  js  c++  java
  • CXF在jdk1.6中运行异常解决

    首先需要运行 需要添加jar包

    cxf-2.2.7.jar

    geronimo-jaxws_2.1_spec-1.0.jar

    jaxb-impl-2.1.12.jar

    jetty-6.1.21.jar

    jetty-util-6.1.21.jar

    jsr311-api-1.0.jar

    wsdl4j-1.6.2.jar

    wstx-asl-3.2.9.jar

    XmlSchema-1.4.5.jar

    在jdk1.6中 运行出现异常

    Exception in thread "main" java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/F:/newItem14/cxfFirst/WebRoot/WEB-INF/lib/jaxb-impl-2.1.12.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) needs 2.1 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader. (See http://java.sun.com/j2se/1.5.0/docs/guide/standards/)

    解决方法

    在运行jdk 目录下的jre/lib  新增一个文件夹 endorsed  如果有就不要增加了

    将 jaxb-api-2.1.jar拷贝到该目录下即可

    出现 xmlstream等异常

    Provider com.bea.xml.stream.MXParserFactory not found

     javax.xml.stream.FactoryConfigurationError: Provider com.bea.xml.stream.MXParserFactory not found
    类路径中的包没有StAX 接口的实现,拷贝包:
    wstx-asl-3.2.0.jar,stax-api-1.0.1.jar,

    问题解决。

    其中jsr173_api-1.0.jar和stax-api-1.0.1.jar,内容相同~

    在myeclipse创建项目 客户端去调用时抛出异常 其实就是读取wsdl描述文件出现问题

    解决方法 设置两个属性(javax.xml.parsers.DocumentBuilderFactory,javax.xml.parsers.SAXParserFactory)值如下:
    System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
           "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
    System.setProperty("javax.xml.parsers.SAXParserFactory",
           "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl");
    再运行就没有错了.

    最后发现原因是我使用MyEclipse创建项目时引用了J2EE 1.4 Library Container库(JAVA构建路径-->库)
    使得sun.boot.class.path增加了myelipse下的jar文件,然后就把javax.xml.parsers.DocumentBuilderFactory变量的值设为org.apache.xerces.jaxp.DocumentBuilderFactoryImpl

    运行时出现 Could not find wsdl:binding operation info for web method

    问题就出在你实例化一个对象转换为接口时

     

    比如 UserService us = (UserService) factory.create();

    原因是UserService 没有加上 @WebService

    在客户端的接口上加上@WebService

  • 相关阅读:
    HDU1013 Digital Roots
    DP---背包问题
    新生代与老年代
    JVM常见问题(二)
    JVM常见问题 一(转载)
    JVM内存模型及分区
    (转载)JVM知识小集
    类加载机制:全盘负责和双亲委托
    mysql 函数GROUP_CONCAT(temp.amount SEPARATOR ',')的用法
    mysql优化--explain关键字
  • 原文地址:https://www.cnblogs.com/liaomin416100569/p/9331770.html
Copyright © 2011-2022 走看看