Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: how to post an issue into JIRA bug tracking system(installed in server) from java

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default how to post an issue into JIRA bug tracking system(installed in server) from java

    hi,
    I am new to the network programming,while i am connecting to remote server from a java program,my requirement is login to the JIRA software which is installed in server,and post my issue into JIRA.
    Iam getting below errors.....

    org.apache.xmlrpc.XmlRpcException: java.lang.Exception: RPC handler object "jira1" not found and no default handler registered
    at org.apache.xmlrpc.client.XmlRpcStreamTransport.rea dResponse(XmlRpcStreamTransport.java:197)
    at org.apache.xmlrpc.client.XmlRpcStreamTransport.sen dRequest(XmlRpcStreamTransport.java:156)
    at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendR equest(XmlRpcHttpTransport.java:143)
    at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.se ndRequest(XmlRpcSunHttpTransport.java:69)
    at org.apache.xmlrpc.client.XmlRpcClientWorker.execut e(XmlRpcClientWorker.java:56)
    at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlR pcClient.java:167)
    at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlR pcClient.java:158)
    at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlR pcClient.java:147)
    at com.prayog.JavaClient.main(JavaClient.java:181)



    import java.net.MalformedURLException;
    import java.net.URL;
    import java.util.Map;
    import java.util.Vector;
    import org.apache.xmlrpc.client.XmlRpcClient;
    //import org.apache.xmlrpc.client.XmlRpcCommonsTransportFac tory;
    import org.apache.xmlrpc.XmlRpcException;
    import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;

    import java.security.KeyManagementException;
    import java.security.NoSuchAlgorithmException;
    import java.security.cert.X509Certificate;

    import javax.net.ssl.HostnameVerifier;
    import javax.net.ssl.HttpsURLConnection;
    import javax.net.ssl.SSLContext;
    import javax.net.ssl.SSLSession;
    import javax.net.ssl.TrustManager;
    import javax.net.ssl.X509TrustManager;

    public class JavaClient{


    public static final String JIRA_URI = "http://host ip:8880";
    public static final String RPC_PATH = "/rpc/xmlrpc";
    public static final String USER_NAME = "username";
    public static final String PASSWORD = "password";

    @SuppressWarnings("unchecked")
    public static void main(String[] args) throws NoSuchAlgorithmException,
    KeyManagementException {
    try {
    // Create a trust manager that does not validate certificate chains
    TrustManager[] trustAllCerts = new TrustManager[] {

    new X509TrustManager() {
    public X509Certificate[] getAcceptedIssuers() {
    return null;
    }

    public void checkClientTrusted(X509Certificate[] certs,
    String authType) {
    // Trust always
    }

    public void checkServerTrusted(X509Certificate[] certs,
    String authType) {
    // Trust always
    }
    } };

    // Install the all-trusting trust manager
    SSLContext sc = SSLContext.getInstance("SSL");
    // Create empty HostnameVerifier
    HostnameVerifier hv = new HostnameVerifier() {
    public boolean verify(String arg0, SSLSession arg1) {
    return true;
    }
    };

    sc.init(null, trustAllCerts, new java.security.SecureRandom());
    HttpsURLConnection.setDefaultSSLSocketFactory(sc.g etSocketFactory());
    HttpsURLConnection.setDefaultHostnameVerifier(hv);

    //********************************
    System.setProperty("https.proxyHost", "host");
    System.setProperty("https.proxyPort", "port");

    // Set the protocol for handling SSL based connecting

    System.out.println(System.getProperties());

    XmlRpcClient rpcClient = new XmlRpcClient();
    XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();

    config.setServerURL(new URL(JIRA_URI + RPC_PATH));
    rpcClient.setConfig(config);

    // Login and retrieve logon token
    Vector loginParams = new Vector(2);
    loginParams.add(USER_NAME);
    loginParams.add(PASSWORD);

    String loginToken = (String) rpcClient.execute("jira1.login",
    loginParams);
    System.out.println("Login sucess");

    // Retrieve projects
    Vector loginTokenVector = new Vector(1);
    loginTokenVector.add(loginToken);


    Object stuff = rpcClient.execute("jira1.getProjectsNoSchemes",
    loginTokenVector);
    Object[] projects = (Object[]) rpcClient.execute(
    "jira1.getProjectsNoSchemes", loginTokenVector);
    System.out.println("getProjects Sucess");
    // Print projects
    for (int i = 0; i < projects.length; i++) {
    Map project = (Map) projects[i];
    System.out.println("KEY: " + project.get("key") + "\tNAME: "
    + project.get("name") + "\tLEAD: "
    + project.get("lead"));
    }

    // Log out
    Boolean bool = (Boolean) rpcClient.execute("jira1.logout",
    loginTokenVector);
    System.out.println("Logout successful: " + bool);

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

    }

    }


  2. #2
    Junior Member
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: how to post an issue into JIRA bug tracking system(installed in server) from java

    thanks in advance....

Similar Threads

  1. atlas tracking and webtrend tracking
    By mrsreddy65@gmail.com in forum Java Theory & Questions
    Replies: 0
    Last Post: August 17th, 2011, 06:01 AM
  2. jdk is not installed properly error..
    By bczm8703 in forum Java SE APIs
    Replies: 6
    Last Post: June 1st, 2011, 06:33 AM
  3. Using 1.5 jre/webstart on a computer with 1.6 installed
    By qman32 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: January 27th, 2011, 12:29 PM
  4. Problem sending POST request with Java..
    By lost in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 20th, 2010, 09:16 PM
  5. Java: Handling cookies when logging in with POST
    By cloakbot in forum What's Wrong With My Code?
    Replies: 0
    Last Post: June 16th, 2010, 04:31 PM