Loading [MathJax]/jax/output/CommonHTML/config.js
社区首页 >问答首页 >错误呈现宏-无法初始化类org.apache.xmlrpc.util.SAXParsers

错误呈现宏-无法初始化类org.apache.xmlrpc.util.SAXParsers
EN

Stack Overflow用户
提问于 2016-07-18 12:31:03
回答 1查看 241关注 0票数 1

我正在创建聚合宏,它应该执行我的Java客户端。

我测试了我的Java客户端,它在eclipse (主函数)中终止了它--它工作得很好,

但是当我试图将它与汇流连接时,我得到了错误

(宏已成功安装-错误作为输出)

呈现宏'TESTLINK插件‘错误:无法初始化类

有人能帮我了解一下这是怎么回事吗?我读到它可能是外部jar的问题--但是如果一个人不解决我的问题。

另外,我使用mvn命令安装了我的xmlrpc,并将依赖项添加到我的pom.xml中,SAXParsers应该包含在那里.

下面是我到目前为止所做的代码:

testlink.java:

代码语言:javascript
代码运行次数:0
复制
package com.project.testlink.api;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Map;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
public class testlink {
    public testlink() {
        // TODO Auto-generated constructor stub
    }

    // Substitute your Dev Key Here
    public static final String DEV_KEY =  "zzzzZZz";
    // Substitute your Server URL Here
    public static final String SERVER_URL = "zzzZZZZ/xmlrpc.php";   

       public static String testLinkReport(String link)
       {
        String title="Error Ocurred";
        String tcid = link.substring(link.lastIndexOf("=")+1);
           try
           {
               XmlRpcClient rpcClient;
               XmlRpcClientConfigImpl config;

               config = new XmlRpcClientConfigImpl();
               config.setServerURL(new URL(SERVER_URL));
               rpcClient = new XmlRpcClient();
               rpcClient.setConfig(config);       

               ArrayList<Object> params = new ArrayList<Object>();
               Hashtable<String, Object> executionData = new Hashtable<String, Object>();   

               executionData.put("devKey", DEV_KEY);
               executionData.put("testcaseexternalid", tcid);
               params.add(executionData);
               Object[] result = (Object[]) rpcClient.execute("tl.getTestCase", params);

                   Map item = (Map)result[0];
                   title = tcid+":"+ item.get("name").toString();


           }
           catch (MalformedURLException e)
           {
               e.printStackTrace();
           }
           catch (XmlRpcException e)
           {
               e.printStackTrace();
           }
           return title;
       }

}

mymacro.java:

代码语言:javascript
代码运行次数:0
复制
package com.project.testlink.api;
import java.util.Map;
import com.atlassian.confluence.content.render.xhtml.ConversionContext;
import com.atlassian.confluence.macro.Macro;
import com.atlassian.confluence.macro.MacroExecutionException;

public class mymacro implements Macro {
    public mymacro() {
        // TODO Auto-generated constructor stub
    }
    @Override
    public String execute(Map<String, String> arg0, String arg1, ConversionContext arg2)
            throws MacroExecutionException {
        // TODO Auto-generated method stub

        return testlink.testLinkReport("HL&item=testcase&id=7780");
    }
    @Override
    public BodyType getBodyType() {
        // TODO Auto-generated method stub
        return BodyType.NONE;
    }
    @Override
    public OutputType getOutputType() {
        // TODO Auto-generated method stub
        return OutputType.BLOCK;
    }
    /*
     public static void main(String[] args) {
            // TODO Auto-generated method stub
            System.out.println(testlink.testLinkReport("HL&item=testcase&id=7780"));
        }
    */

}

atlassian-plugin.xml:

代码语言:javascript
代码运行次数:0
复制
<atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}" plugins-version="2">
    <plugin-info>
        <description>${project.description}</description>
        <version>${project.version}</version>
        <vendor name="${project.organization.name}" url="${project.organization.url}" />
        <param name="plugin-icon">images/pluginIcon.png</param>
        <param name="plugin-logo">images/pluginLogo.png</param>
    </plugin-info>
    <!-- add our i18n resource -->
    <resource type="i18n" name="i18n" location="testlink"/>

    <xhtml-macro name="TESTLINK PLUGIN" class="com.project.testlink.api.mymacro" key="mymacro" icon="/download/resources/${project.groupId}.${project.artifactId}/images/pluginIcon.png">
    <category name="external-content"/> 
    <parameters>
        <parameter name="Testlink" type="string" required="true"/>
    </parameters>
    <description>Inserts a calendar for the week into the current page</description>
    </xhtml-macro>


    <!-- add our web resources -->
    <web-resource key="testlink-resources" name="testlink Web Resources">
        <dependency>com.atlassian.auiplugin:ajs</dependency>

        <resource type="download" name="testlink.css" location="/css/testlink.css"/>
        <resource type="download" name="testlink.js" location="/js/testlink.js"/>
        <resource type="download" name="images/" location="/images"/>
        <context>testlink</context>
    </web-resource>

</atlassian-plugin>

pom.xml:

代码语言:javascript
代码运行次数:0
复制
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.project.testlink</groupId>
    <artifactId>testlink</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <organization>
        <name>Example Company</name>
        <url>http://www.example.com/</url>
    </organization>
    <name>testlink</name>
    <description>This is the com.project.testlink:testlink plugin for Atlassian Confluence.</description>
    <packaging>atlassian-plugin</packaging>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.10</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence</artifactId>
            <version>${confluence.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-annotation</artifactId>
            <version>${atlassian.spring.scanner.version}</version>
            <scope>compile</scope>
        </dependency>


        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-runtime</artifactId>
            <version>${atlassian.spring.scanner.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
            <scope>provided</scope>
        </dependency>
        <!-- WIRED TEST RUNNER DEPENDENCIES -->
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi-testrunner</artifactId>
            <version>${plugin.testrunner.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>jsr311-api</artifactId>
            <version>1.1.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.2.2-atlassian-1</version>
        </dependency>
         <dependency>
            <groupId>org.apache.xmlrpc</groupId>
            <artifactId>xml-common</artifactId>
            <version>3.1.3</version>
        </dependency>
         <dependency>
            <groupId>org.apache.xmlrpc</groupId>
            <artifactId>xml-client</artifactId>
            <version>3.1.3</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-confluence-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <productVersion>${confluence.version}</productVersion>
                    <productDataVersion>${confluence.data.version}</productDataVersion>
                    <enableQuickReload>true</enableQuickReload>
                    <enableFastdev>false</enableFastdev>
                    <!-- See here for an explanation of default instructions: -->
                    <!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins -->
                    <instructions>
                        <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
                        <!-- Add package to export here -->
                        <Export-Package>
                            com.project.testlink.api,
                        </Export-Package>
                        <!-- Add package import here -->
                        <Import-Package>
                            org.springframework.osgi.*;resolution:="optional",
                            org.eclipse.gemini.blueprint.*;resolution:="optional",
                            *
                        </Import-Package>
                        <!-- Ensure plugin is spring powered -->
                        <Spring-Context>*</Spring-Context>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.atlassian.plugin</groupId>
                <artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
                <version>1.2.6</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>atlassian-spring-scanner</goal>
                        </goals>
                        <phase>process-classes</phase>
                    </execution>
                </executions>
                <configuration>
                    <scannedDependencies>
                        <dependency>
                            <groupId>com.atlassian.plugin</groupId>
                            <artifactId>atlassian-spring-scanner-external-jar</artifactId>
                        </dependency>
                    </scannedDependencies>
                    <verbose>false</verbose>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <properties>
        <confluence.version>5.10.2</confluence.version>
        <confluence.data.version>5.10.1</confluence.data.version>
        <amps.version>6.2.4</amps.version>
        <plugin.testrunner.version>1.2.3</plugin.testrunner.version>
        <atlassian.spring.scanner.version>1.2.6</atlassian.spring.scanner.version>
        <!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
        <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
    </properties>
</project>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-07-19 09:19:13

问题解决了.

将“排除”添加到像这里这样的依赖项中

之后,我不得不从SAXParsers文件中删除.jar类,现在它可以工作了:)

问题是,您正在使用的Apache客户端库有许多其他依赖项,它们在编译时将绑定到您的插件中,并且它们与JIRA中已经提供的库发生冲突。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38445527

复制
相关文章
MacOS 下如何安装 gnu 版本的 sed
原因是由于 MacOS 下默认的 sed 和 Linux 下是不一样的,导致 -i 无法正确识别,通常的做法是安装一个 gnu-sed 已替换原本的 sed 命令
LinkinStar
2024/09/03
1480
pycharm哪个版本_pycharm版本选择
社区版: 可以供广大python爱好者免费使用,具备常用的python库,可以实现基本的python用法,可以用于试验在工作中出现的错误
全栈程序员站长
2022/09/27
4.5K0
pycharm哪个版本_pycharm版本选择
pycharm选哪个版本_pycharm版本区别
在pycharm中点击file->setting->project->project Interpreter。
全栈程序员站长
2022/09/27
1.1K0
pycharm选哪个版本_pycharm版本区别
php用哪个版本_php什么版本好
1.1 autoload的使用;当在代码中使用一个未定义的类的时候,该函数就会被调用
全栈程序员站长
2022/09/20
4.3K0
办公软件有哪些版本,哪个版本office好用?
目前最新的版本就是office2021; 具体哪个版本好用主要看你的用途和系统匹配;
用户10307898
2023/02/07
8.2K0
ERP系统用的哪个版本?
声明:本文仅代表原作者观点,仅用于SAP软件的应用与学习,不代表SAP公司。注:文中所示截图来源SAP软件,相应著作权归SAP所有。
齐天大圣
2022/11/28
2.6K0
ERP系统用的哪个版本?
学习 Java,使用哪个版本最好
工欲善其事,必先利其器。我们要学习和使用 Java 语言,就需要搭建好 Java 的开发环境,边学习知识,边实践编码,可以更好的体会 Java 这门语言的精髓。
蜗牛互联网
2021/03/01
2.1K0
学习 Java,使用哪个版本最好
office下载哪个版本比较好
哪个版本的office最好用?Office是我们经常使用的办公工具软件,到现在有很多版本。很多人都想知道哪个版本的office最好用。下面为大家推荐Office版。让我们看一看。
用户9693436
2022/07/03
4.1K0
MGR用哪个版本?5.7 vs 8.0
前几天有人问:“8.0的MGR与5.7相比较,有哪些不一样的地方?”,在这篇文章里,将通过增加的系统变量说明一下MySQL8.0在MGR上的变化。
MySQLSE
2020/09/28
1.4K0
MGR用哪个版本?5.7 vs 8.0
uniqueidentifier转换_unique函数哪个版本有
uniqueidentifier数据类型是16个字节的二进制值,应具有唯一性,必须与NEWID()函数配合使用。
全栈程序员站长
2022/10/04
5280
Python初学者应该选择哪个版本
目前,根据数据显示,使用Python2.xd 开发者站63.7%,而使用Python3.x的用户站36.3%,由此可见使用使用Python2.x的用户还是占多数。2014年,Python的创始人宣布将Python2.7支持时间延长到2020年,那么初学者应该选择什么版本呢?目前建议初学者选择Python3.x版本 1、目前,使用Python3.x是大势所趋 2、Python3.x在Python2.x的基础上做了功能升级 3、Python3.x和Python2.x思想基本是共通的 当然选择Python3.x也会有缺点,那就是很多扩展库的发行总是滞后于Python的发行版本,甚至目前还有很多库不支持Python3.x。因此,在选择Python时候,一定要先考虑清楚自己的学习目的,例如,打算做哪方面的开发、需要用到哪些扩展库,以及扩展库支持的最高Python版本等。明确这些问题后再做出适合自己的选择。 中文编程参考资料
py3study
2020/01/07
1.7K0
皕杰报表(关于怎么查看是哪个版本)
3)、在META-INF文件夹下MANIFEST.MF里查看Version和label值。
用户10133222
2022/11/11
6510
JDK 11都有了,你还在用哪个版本?
  JDK是 Java 语言的软件开发工具包,主要用于移动设备、嵌入式设备上的java应用程序。JDK是整个java开发的核心,它包含了JAVA的运行环境。(JVM+Java系统类库)和JAVA工具。   没有JDK的话,无法编译Java程序(指java源码.java文件),如果想只运行Java程序(指class或jar或其它归档文件),要确保已安装相应的JRE。
程序员云帆哥
2022/05/12
9470
JDK 11都有了,你还在用哪个版本?
哪个版本的gcc才支持c11
(而我此处的eglibc 2.17,和那人的glibc-2.16.0,都是需要支持c11的gcc的)
bear_fish
2018/09/19
7.9K0
哪个版本的gcc才支持c11
查询mysql版本号命令_怎么看自己mysql是哪个版本
+————+ | version() | +————+ | 5.7.23-log | +————+ 1 row in set (0.12 sec)
全栈程序员站长
2022/11/08
3K0
微软史上最成功的操作系统是哪个版本?
到现在为止个人还是觉得微软最成功的的操作系统还是XP系统,现在很多人还在使用着这个版本,只不过由于软件的支持力度问题,很多软件已经运行不起来了,说到微软的操作系统的演化史其实就是科技技术的进步史,最初的微软dos系统基本上纯正命令行的时代,后来有了图形界面,然后是飞速的体验时代。
程序员互动联盟
2019/07/04
3.5K0
微软史上最成功的操作系统是哪个版本?
做开发环境用哪个版本的win服务器?
做开发环境的服务器,那么就选择win2008,在win2008当中,整理了一下的版本:
习惯说一说
2019/08/01
5.1K0
做开发环境用哪个版本的win服务器?
python3 软连接_python3哪个版本好用
在ubuntu下面发现pip的默认版本指向的是python3.6,而因项目需要利用Python2.7.
全栈程序员站长
2022/09/27
9250
GNU风格的版本号管理
项目初版本时,版本号可以为 0.1 或 0.1.0, 也可以为 1.0 或 1.0.0,如果你为人很低调,我想你会选择那个主版本号为 0 的方式; 当项目在进行了局部修改或 bug 修正时,主版本号和子版本号都不变,修正版本号加 1 当项目在原有的基础上增加了部分功能时,主版本号不变,子版本号加 1,修正版本号复位为 0,因而可以被忽略掉 当项目在进行了重大修改或局部修正累积较多,而导致项目整体发生全局变化时,主版本号加 1 另外,编译版本号一般是编译器在编译过程中自动生成的,我们只定义其格式,并不进行人
随心助手
2019/12/19
1.2K0
​【译】哪个版本的java性能最佳?结论可能超出你想像……
众所周知,Java在不同软件版本中的性能可能存在差异,并且这种差异会受到许多因素的影响。
Masutaa大师
2023/08/21
4260
​【译】哪个版本的java性能最佳?结论可能超出你想像……

相似问题

哪个版本的X引入了特征Y?

40

如何确定要安装哪个内核版本?

10

如何确定我正在构建的RHEL的哪个版本?

20

libvirt支持哪个版本的VBOX?

10

哪个版本的unix来自shell?

10
添加站长 进交流群

领取专属 10元无门槛券

AI混元助手 在线答疑

扫码加入开发者社群
关注 腾讯云开发者公众号

洞察 腾讯核心技术

剖析业界实践案例

扫码关注腾讯云开发者公众号
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
查看详情【社区公告】 技术创作特训营有奖征文