It's all about the answers!

Ask a question

Creating command line from Java API Client


Moti Wertheimer (18913628) | asked Jun 08 '09, 8:46 a.m.
JAZZ DEVELOPER
In order to support automation I have created a Java API client based on the RTC SDK.
The client performs operations on an existing workitem (change it's status).
The client works fine under eclipse environment. but when I'm trying to export it to an executable Jar I get an exception.

Can anybody help?
Thanks,
Moti

The output looks like that:
L:\RTCSource\readyPrograms>java -jar SuccessfulBuildDeamon.jar https://somwhere.ibm.com:9921/jazz/ myUserName myPAssword MyWorkspaceName
log4j:WARN No appenders could be found for logger (org.apache.commons.httpclient.params.DefaultHttpParams).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.ibm.team.repository.client.internal.TeamRepository.<init>(TeamRepository.java:374)
at com.ibm.team.repository.client.internal.TeamRepositoryService.createSharedTeamRepository(TeamRepositoryService.java:366)
at com.ibm.team.repository.client.internal.TeamRepositoryService.getTeamRepository(TeamRepositoryService.java:91)
at com.ibm.team.repository.client.internal.TeamRepositoryService.getTeamRepository(TeamRepositoryService.java:110)
at SuccessfulBuildDaemon.login(SuccessfulBuildDaemon.java:210)
at SuccessfulBuildDaemon.main(SuccessfulBuildDaemon.java:248)
Caused by: java.lang.IllegalArgumentException: The type name Contributor and the namespace URI com.ibm.team.repository do not resolve to an IItemType.

at com.ibm.team.repository.common.internal.querypath.AbstractQueryPathModel$Implementation.getItemType(AbstractQueryPathModel.java:173)
at com.ibm.team.repository.common.query.IQuery$Factory.newInstance(IQuery.java:92)
at com.ibm.team.repository.client.internal.ContributorManager.createAllContributorsQuery(ContributorManager.java:55)
at com.ibm.team.repository.client.internal.ContributorManager.<clinit>(ContributorManager.java:43)
... 6 more

4 answers



permanent link
Patrick Streule (4.9k21) | answered Jun 10 '09, 5:45 a.m.
JAZZ DEVELOPER
In order to support automation I have created a Java API client based
on the RTC SDK.
The client performs operations on an existing workitem (change it's
status).
The client works fine under eclipse environment. but when I'm trying
to export it to an executable Jar I get an exception.

Can anybody help?

The exception is a sign that the plugin.xmls could not be read. Please
make sure that all Plain Java Client jars are on the classpath when you
run your application from the command line. From the readme in the
snippets directory:

Since there are several jar files which are part of the client library,
the simplest mechanism to add them to
the external libraries classpath.

$ java -Djava.ext.dirs=<location>:snippets:.
snippets.Snippet1

or an example is

$ java -Djava.ext.dirs=/home/jm/jdk1.5.0_13/jre/lib/ext:snippets:.
snippets.Snippet1

Note: On Linux the java.ext.dirs separator is ':' and on Windows it's ';'.

--
Regards,
Patrick
Jazz Work Item Team

permanent link
Moti Wertheimer (18913628) | answered Jun 14 '09, 3:55 a.m.
JAZZ DEVELOPER
Thanks Patrick,

I see some improvement but still I get other exception.

L:\RTCSource\SuccessfulBuildDaemon\bin>java -Djava.ext.dirs=L:\RTCSource\JazzClient;SuccessfulBuildDaemon.successfulBuildDaemon;"C:\Program Files\Java
\jdk1.6.0_10" SuccessfulBuildDaemon https://qsrv131.lexma.ibm.com:9921/jazz/ MyName MyPasswd Rhapsody_Test3 9699 "Fix Ready" Resolved
"Test: Resolved at build 123456"
log4j:WARN No appenders could be found for logger (org.apache.commons.httpclient.params.DefaultHttpParams).
log4j:WARN Please initialize the log4j system properly.
com.ibm.team.repository.common.transport.TeamServiceException: CRJAZ0099I HTTP error "RSA premaster secret error" accessing URL "https://qsrv131.lexma
.ibm.com:9921/jazz/service/com.ibm.team.repository.common.internal.IRepositoryRemoteService".
at com.ibm.team.repository.transport.client.ClientHttpUtil.executeHttpMethod(ClientHttpUtil.java:175)
at com.ibm.team.repository.transport.client.RemoteTeamService.executeCancelableHttpMethod(RemoteTeamService.java:530)
at com.ibm.team.repository.transport.client.RemoteTeamService.invokePost(RemoteTeamService.java:506)
at com.ibm.team.repository.transport.client.RemoteTeamService.executeMethod(RemoteTeamService.java:451)
at com.ibm.team.repository.transport.client.RemoteTeamService.invoke(RemoteTeamService.java:184)
at com.ibm.team.repository.transport.client.ServiceInvocationHandler.invoke(ServiceInvocationHandler.java:43)
at $Proxy0.describe(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.ibm.team.repository.client.internal.ServiceInterfaceProxy.invokeServiceCall(ServiceInterfaceProxy.java:149)
at com.ibm.team.repository.client.internal.ServiceInterfaceProxy.invoke(ServiceInterfaceProxy.java:84)
at $Proxy0.describe(Unknown Source)
at com.ibm.team.repository.client.internal.TeamRepository$4.run(TeamRepository.java:1342)
at com.ibm.team.repository.client.internal.TeamRepository$4.run(TeamRepository.java:1)
at com.ibm.team.repository.client.internal.TeamRepository$3.run(TeamRepository.java:1129)
at com.ibm.team.repository.common.transport.CancelableCaller.call(CancelableCaller.java:76)
at com.ibm.team.repository.client.internal.TeamRepository.callCancelableService(TeamRepository.java:1122)
at com.ibm.team.repository.client.internal.TeamRepository.internalLogin(TeamRepository.java:1335)
at com.ibm.team.repository.client.internal.TeamRepository.login(TeamRepository.java:536)
at SuccessfulBuildDaemon.login(SuccessfulBuildDaemon.java:212)
at SuccessfulBuildDaemon.main(SuccessfulBuildDaemon.java:248)
Caused by: javax.net.ssl.SSLKeyException: RSA premaster secret error
at com.sun.net.ssl.internal.ssl.RSAClientKeyExchange.<init>(RSAClientKeyExchange.java:97)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:634)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:226)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:516)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:454)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:884)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1096)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:623)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at java.io.FilterOutputStream.flush(FilterOutputStream.java:123)
at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:502)
at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:1973)
at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:993)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
at com.ibm.team.repository.transport.client.ClientHttpUtil.executeHttpMethod(ClientHttpUtil.java:144)
... 22 more
Caused by: java.security.NoSuchAlgorithmException: SunTlsRsaPremasterSecret KeyGenerator not available
at javax.crypto.KeyGenerator.<init>(DashoA13*..)
at javax.crypto.KeyGenerator.getInstance(DashoA13*..)
at com.sun.net.ssl.internal.ssl.JsseJce.getKeyGenerator(JsseJce.java:223)
at com.sun.net.ssl.internal.ssl.RSAClientKeyExchange.<init>(RSAClientKeyExchange.java:89)

Regards,
Moti

permanent link
Patrick Streule (4.9k21) | answered Jun 15 '09, 2:12 a.m.
JAZZ DEVELOPER
I see some improvement but still I get other exception.

L:\RTCSource\SuccessfulBuildDaemon\bin>java
-Djava.ext.dirs=L:\RTCSource\JazzClient;SuccessfulBuildDaemon.successfulBuildDaemon;"C:\Program
Files\Java
\jdk1.6.0_10" SuccessfulBuildDaemon
https://qsrv131.lexma.ibm.com:9921/jazz/ MyName MyPasswd
Rhapsody_Test3 9699 "Fix Ready" Resolved
"Test: Resolved at build 123456"
log4j:WARN No appenders could be found for logger
(org.apache.commons.httpclient.params.DefaultHttpParams).
log4j:WARN Please initialize the log4j system properly.
com.ibm.team.repository.common.transport.TeamServiceException:
CRJAZ0099I HTTP error "RSA premaster secret error"
accessing URL "https://qsrv131.lexma
ibm.com:9921/jazz/service/com.ibm.team.repository.common.internal.IRepositoryRemoteService".

You are probably seeing the problem described in:
http://jazz.net/forums/viewtopic.php?t=5204

--
Regards,
Patrick
Jazz Work Item Team

permanent link
Moti Wertheimer (18913628) | answered Jun 23 '09, 9:27 a.m.
JAZZ DEVELOPER
Thanks Patrick,

Using the JRE shipped with the Rational Team Concert solved the problem.

Regards,
Moti

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.