cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1071
Views
0
Helpful
4
Replies

Helpe me to edit demo.java from developer.cisco.com for CUCM10

wisit_jan
Level 1
Level 1

I download sample from developer.cisco.com. That sample code is support CUCM 8.

I want to edit code to use with CUCM 10.

Frist I changed import com.cisco.axl.api._8.*; to import com.cisco.axl.api._10.*;

E:\tity\Eclipse_workspace\axl>java -classpath demo.jar com.cisco.axl.demo.Demo

Welcome to the Cisco AXL Sample APP.
  Host: 10.1.1.1
  OS Admin Account: administrator
  OS Admin Password: password

Enter the name of the phone you want to retrieve information about.
  Phone Name: SEPF09E630F9E31
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
        Unhandled exception type AXLError

        at com.cisco.axl.demo.Demo.getPhone(Demo.java:152)
        at com.cisco.axl.demo.Demo.getPhoneInfo(Demo.java:120)
        at com.cisco.axl.demo.Demo.main(Demo.java:101)

Second,

I changed follow eclipse suggest.

01.png

02.png

I got error

E:\tity\Eclipse_workspace\axl>java -classpath demo.jar com.cisco.axl.demo.Demo

Welcome to the Cisco AXL Sample APP.
  Host: 10.104.202.200
  OS Admin Account: administrator
  OS Admin Password: password

Enter the name of the phone you want to retrieve information about.
  Phone Name: SEPF09E630F9E31
Mar 14, 2015 3:01:09 PM com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser pa
rseWSDL
WARNING: Import of file:/E:/tity/Eclipse_workspace/axl/schema/current/AXLSoap.xs
d is violation of BP 1.1 R2001. Proceeding with a warning.
R2001 A DESCRIPTION MUST only use the WSDL "import" statement to import another
WSDL description.
Exception in thread "main" com.sun.xml.internal.ws.client.ClientTransportExcepti
on: HTTP transport error: javax.net.ssl.SSLHandshakeException: java.security.cer
t.CertificateException: No subject alternative names present
        at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.get
Output(Unknown Source)
        at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.proce
ss(Unknown Source)
        at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.proce
ssRequest(Unknown Source)
        at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processReques
t(Unknown Source)
        at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Unknown Source)
        at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Unknown Source)
        at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Unknown Source)
        at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Unknown Source)
        at com.sun.xml.internal.ws.client.Stub.process(Unknown Source)
        at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(Unknown Source)
        at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown S
ource)
        at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown S
ource)
        at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source)
        at com.sun.proxy.$Proxy29.getPhone(Unknown Source)
        at com.cisco.axl.demo.Demo.getPhone(Demo.java:156)
        at com.cisco.axl.demo.Demo.getPhoneInfo(Demo.java:123)
        at com.cisco.axl.demo.Demo.main(Demo.java:103)
Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateEx
ception: No subject alternative names present
        at sun.security.ssl.Alerts.getSSLException(Unknown Source)
        at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
        at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
        at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
        at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source)
        at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
        at sun.security.ssl.Handshaker.processLoop(Unknown Source)
        at sun.security.ssl.Handshaker.process_record(Unknown Source)
        at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source
)
        at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
        at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
        at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect
(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown S
ource)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unk
nown Source)
        ... 17 more
Caused by: java.security.cert.CertificateException: No subject alternative names
present
        at sun.security.util.HostnameChecker.matchIP(Unknown Source)
        at sun.security.util.HostnameChecker.match(Unknown Source)
        at sun.security.ssl.X509TrustManagerImpl.checkIdentity(Unknown Source)
        at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source)
        at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Sour
ce)
        ... 29 more

E:\tity\Eclipse_workspace\axl>

Please help and suggest me for edit demo sample code.

4 Replies 4

npetrele
Cisco Employee
Cisco Employee

It looks like you need to add your server's security certificate to the Java keystore. You can download and export the certificate using Firefox.  Then you need to add it to the keystore, which is called "cacert".  Here's the basic command syntax:

$JAVA_HOME/jre/bin/keytool -import -trustcacerts -file /path/to/ca/ca.pem -alias CA_ALIAS -keystore $JAVA_HOME/jre/lib/security/cacerts



Hi Nicholas,

I already added cert to cacerts. But same error still show.

Normally my role is UC engineer, never do programing. I just try to coding but it's very hard for me.

Thank you for your guidance

Or, add a method like this to the code and call it from main (something like

if (!init())

return;

before the call to demo.getPhoneInfo();

public boolean init()

    {

        X509TrustManager xtm = new MyTrustManager();

        TrustManager[] mytm = { xtm };

        SSLContext ctx;

        try

        {

            ctx = SSLContext.getInstance("SSL");

            ctx.init(null, mytm, null);

            SSLSocketFactory sf = ctx.getSocketFactory();

            HttpsURLConnection.setDefaultSSLSocketFactory(sf);

            HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier()

            {

                public boolean verify(String hostname, SSLSession session)

                {

                    return true;

                }

            });

        }

        catch (NoSuchAlgorithmException ex)

        {

           return false;

        }

        catch (KeyManagementException ex)

        {

            return false;

        }  

    }

This is a variation of the code I'm using.. it allows any self-signed cert. I know.. security best practices and all, but this is a test, right?

yuanzli
Level 1
Level 1

Hi, wisit_jan

     I met the same problem.

     Could you tell me how did you solve it?

     Thank you!