jazz-community / work-item-command-line

Work Item Command Line for RTC/EWM
https://rsjazz.wordpress.com/2017/03/29/the-work-item-command-line-is-now-open-source/
MIT License
23 stars 18 forks source link

WCL keeps crashing with java.lang.NoSuchMethod #22

Closed Kittyfisto closed 4 years ago

Kittyfisto commented 5 years ago

I am trying to get WCL to work but the tool keeps crashing:

The following is my wcl.bat file:

@setlocal
@echo off
set JAVA_HOME=C:\Program Files\Java\jdk8
set PLAIN_JAVA=C:\Program Files\IBM\PlainJavaLibraries

"%JAVA_HOME%\bin\java.exe" -Djava.security.policy=rmi_no.policy -Djava.ext.dirs="C:\Program Files\WCL\lib\;%PLAIN_JAVA%;%JAVA_HOME%\jre\lib\ext" -cp "C:\Program Files\WCL\lib\;%PLAIN_JAVA%" -jar wcl.jar %*

endlocal

Whenever I invoke it with the following command:

> wcl.bat -printworkitem repository="..." user="..." password="..." id="581294

It crashes with the following output:

StartTime: Aug 28, 2019 3:03:48 PM
WorkItemCommandLine Version 5.0

Starting Team Platform ...
Executing command: printworkitem

Exception in thread "main" com.ibm.team.repository.common.transport.ServiceMethodInvocationError: java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.<init>(I)V
        at com.ibm.team.repository.transport.client.RemoteTeamService.getAppropriateException(RemoteTeamService.java:737)
        at com.ibm.team.repository.transport.client.RemoteTeamService.executeMethod(RemoteTeamService.java:573)
        at com.ibm.team.repository.transport.client.RemoteTeamService.invoke(RemoteTeamService.java:202)
        at com.ibm.team.repository.transport.client.ServiceInvocationHandler.invoke(ServiceInvocationHandler.java:43)
        at com.sun.proxy.$Proxy1.describe(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.ibm.team.repository.client.internal.ServiceInterfaceProxy.invokeServiceCall(ServiceInterfaceProxy.java:254)
        at com.ibm.team.repository.client.internal.ServiceInterfaceProxy.invoke(ServiceInterfaceProxy.java:110)
        at com.sun.proxy.$Proxy1.describe(Unknown Source)
        at com.ibm.team.repository.client.internal.TeamRepository$4.run(TeamRepository.java:1564)
        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:1327)
        at com.ibm.team.repository.common.transport.CancelableCaller.call(CancelableCaller.java:79)
        at com.ibm.team.repository.client.internal.TeamRepository.callCancelableService(TeamRepository.java:1322)
        at com.ibm.team.repository.client.internal.TeamRepository.internalLogin(TeamRepository.java:1557)
        at com.ibm.team.repository.client.internal.TeamRepository.login(TeamRepository.java:653)
        at com.ibm.team.repository.client.internal.TeamRepository.login(TeamRepository.java:627)
        at com.ibm.js.team.workitem.commandline.framework.AbstractTeamRepositoryCommand.login(AbstractTeamRepositoryCommand.java:189)
        at com.ibm.js.team.workitem.commandline.framework.AbstractTeamRepositoryCommand.execute(AbstractTeamRepositoryCommand.java:79)
        at com.ibm.js.team.workitem.commandline.WorkitemCommandLine.runCommands(WorkitemCommandLine.java:297)
        at com.ibm.js.team.workitem.commandline.WorkitemCommandLine.run(WorkitemCommandLine.java:231)
        at com.ibm.js.team.workitem.commandline.WorkitemCommandLine.main(WorkitemCommandLine.java:183)
Caused by: java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.<init>(I)V
        at org.apache.http.impl.auth.BasicScheme.<init>(BasicScheme.java:65)
        at org.apache.http.impl.auth.BasicSchemeFactory.create(BasicSchemeFactory.java:68)
        at org.apache.http.impl.client.AuthenticationStrategyImpl.select(AuthenticationStrategyImpl.java:175)
        at org.apache.http.impl.client.TargetAuthenticationStrategy.select(TargetAuthenticationStrategy.java:43)
        at org.apache.http.impl.auth.HttpAuthenticator.handleAuthChallenge(HttpAuthenticator.java:154)
        at org.apache.http.impl.execchain.MainClientExec.needAuthentication(MainClientExec.java:557)
        at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:275)
        at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
        at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
        at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
        at com.ibm.team.repository.transport.client.RemoteTeamServer.executePrimitiveRequest(RemoteTeamServer.java:1693)
        at com.ibm.team.repository.transport.client.RemoteTeamServer.executeWithAuthHandling(RemoteTeamServer.java:1398)
        at com.ibm.team.repository.transport.client.RemoteTeamServer.executeMethod(RemoteTeamServer.java:1027)
        at com.ibm.team.repository.transport.client.RemoteTeamServer.executeMethod(RemoteTeamServer.java:976)
        at com.ibm.team.repository.transport.client.RemoteTeamService.executeCancelableHttpMethod(RemoteTeamService.java:658)
        at com.ibm.team.repository.transport.client.RemoteTeamService.invokePost(RemoteTeamService.java:605)
        at com.ibm.team.repository.transport.client.RemoteTeamService.executeMethod(RemoteTeamService.java:548)
        ... 23 more

I've downloaded both opencsv 3.7 as well as apache commons-lang 3-3.1, renamed those files to opencsv.jar and commons-lang.jar and placed them in the /lib folder. Acoording to stackoverflow, org.apache.commons.codec.binary.Base64.<init> is part of the commons-lang project so I suspect I must be doing something wrong here but I can't find the problem.

I've tried specifying both relative and absolute file paths to no avail.

rsjazz commented 5 years ago

I use and have tested WCL 5.0 with Java 1.8 and the 6.0.6 Plain Java Client Libraries. I have NOT deployed the additional libraries, so the lib folder is empty.

I execute wcl -printworkitem /ignoreErrors repository="https://clm.example.com:9443/ccm" user=ralph password=ralph id=31 /allColumns /suppressAttributeExceptions attachmentFolder="c:\aaTemp\export" /attribute_NamesAsIDs /asrt_ceclipse

My JAVA_HOME is

C:\temp\WCL>echo %JAVA_HOME%

C:\PROGRA-1\Java\JDK18-2.0_1 (replace the - with ~ github creates a strikethrough if you use the tilde twice)

C:\temp\WCL>java -version java version "1.8.0_221" Java(TM) SE Runtime Environment (build 1.8.0_221-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)

My wcl.bat looks like this:

rem set JAVA_HOME=C:\PROGRA~1\Java\jre1.8.0_191 set PLAIN_JAVA=C:\RTC606Dev\Installs\PlainJavaAPI

rem In the -Djava.ext.dirs always keep the Java distribution in the front "%JAVA_HOME%\bin\java" -Djava.security.policy=rmi_no.policy -Djava.ext.dirs="%JAVA_HOME%/lib/ext;%JAVA_HOME%/jre/lib/ext;./lib;%PLAIN_JAVA%" -cp "./lib;%PLAIN_JAVA%" -jar wcl.jar %*

Note the following: I try to avoid installing anything in C:\Program Files\ where it is unavoidable. I DO NOT put libraries like the plain Java client libraries there. I avoid spaces in paths because they are a not working well as they are an afterthought in windows. In batch files I use the special directory path that omits the space in the name.

Not sure if the space is the issue.

Please note that I ran into an issue on a customer laptop with another tool and found that there are some constraints on the -Djava.ext.dirs where the order mattered on some machines - odd. I have not addressed that in the released WCL.

Please let me know if this is helpful.

rsjazz commented 5 years ago

Note: to be more specific, can you try if the changed order

-Djava.ext.dirs="%JAVA_HOME%/lib/ext;%JAVA_HOME%/jre/lib/ext;./lib;%PLAIN_JAVA%"

Fixes your problem?

Vijayalaxmibb commented 4 years ago

@rsjazz : I am getting the following error when i try to run the importworkitem command Here is the command i use: wcl -importworkitems /importdebug user=* password= projectArea="abc" /importmultipass /ignoreemptycolumnvalues importFile="D:..\importData_Jazz.csv” /forcelinkcreation /enforceSizeLimits repository="repo link" mappingFile="D:..\MKSToJazz.xml" delimiter=","

Exception in thread "main" com.ibm.team.repository.common.transport.ServiceMethodInvocationError: java.lang.NoClassDefFoundError: org/apache/commons/httpclient/Header at com.ibm.team.repository.transport.client.RemoteTeamService.getAppropriateException(RemoteTeamService.java:738) at com.ibm.team.repository.transport.client.RemoteTeamService.executeMethod(RemoteTeamService.java:572) at com.ibm.team.repository.transport.client.RemoteTeamService.invoke(RemoteTeamService.java:202) at com.ibm.team.repository.transport.client.ServiceInvocationHandler.invoke(ServiceInvocationHandler.java:43) at com.sun.proxy.$Proxy3.describe(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.ibm.team.repository.client.internal.ServiceInterfaceProxy.invokeServiceCall(ServiceInterfaceProxy.java:254) at com.ibm.team.repository.client.internal.ServiceInterfaceProxy.invoke(ServiceInterfaceProxy.java:110) at com.sun.proxy.$Proxy3.describe(Unknown Source) at com.ibm.team.repository.client.internal.TeamRepository$4.run(TeamRepository.java:1592) 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:1355) at com.ibm.team.repository.common.transport.CancelableCaller.call(CancelableCaller.java:79) at com.ibm.team.repository.client.internal.TeamRepository.callCancelableService(TeamRepository.java:1350) at com.ibm.team.repository.client.internal.TeamRepository.internalLogin(TeamRepository.java:1585) at com.ibm.team.repository.client.internal.TeamRepository.login(TeamRepository.java:674) at com.ibm.team.repository.client.internal.TeamRepository.login(TeamRepository.java:647) at com.ibm.js.team.workitem.commandline.framework.AbstractTeamRepositoryCommand.login(AbstractTeamRepositoryCommand.java:189) at com.ibm.js.team.workitem.commandline.framework.AbstractTeamRepositoryCommand.execute(AbstractTeamRepositoryCommand.java:79) at com.ibm.js.team.workitem.commandline.WorkitemCommandLine.runCommands(WorkitemCommandLine.java:297) at com.ibm.js.team.workitem.commandline.WorkitemCommandLine.run(WorkitemCommandLine.java:231) at com.ibm.js.team.workitem.commandline.WorkitemCommandLine.main(WorkitemCommandLine.java:183) Caused by: java.lang.NoClassDefFoundError: org/apache/commons/httpclient/Header at com.ibm.team.repository.transport.client.RemoteTeamServer.getHttp3ResponseHeaders(RemoteTeamServer.java:2089) at com.ibm.team.repository.transport.client.RemoteTeamServer.executeMethod(RemoteTeamServer.java:1348) at com.ibm.team.repository.transport.client.RemoteTeamServer.executeMethod(RemoteTeamServer.java:1221) at com.ibm.team.repository.transport.client.RemoteTeamService.executeCancelableHttpMethod(RemoteTeamService.java:659) at com.ibm.team.repository.transport.client.RemoteTeamService.invokePost(RemoteTeamService.java:604) at com.ibm.team.repository.transport.client.RemoteTeamService.executeMethod(RemoteTeamService.java:547) ... 23 more Caused by: java.lang.ClassNotFoundException: org.apache.commons.httpclient.Header at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 29 more

I am using

java version "1.8.0_221" Java(TM) SE Runtime Environment (build 1.8.0_221-b32) Java HotSpot(TM) 64-Bit Server VM (build 25.221-b32, mixed mode)

wcl.bat set JAVA_HOME=C:\PROGRA~1\Java\jdk1.8.0_211 set PLAIN_JAVA=D:\Reporting\RTCWCL\PlainJavaAPI

rem "%JAVA_HOME%\bin\java" -Djava.security.policy=rmi_no.policy -Djava.ext.dirs="./lib;%PLAIN_JAVA%;%JAVA_HOME%/jre/lib/ext" -cp "./lib;%PLAIN_JAVA%" -jar wcl.jar % rem In the -Djava.ext.dirs always keep the Java distribution in the front "%JAVA_HOME%\bin\java" -Djava.security.policy=rmi_no.policy -Djava.ext.dirs="%JAVA_HOME%/lib/ext;%JAVA_HOME%/jre/lib/ext;./lib;%PLAIN_JAVA%" -cp "./lib;%PLAIN_JAVA%" -jar wcl.jar %

rsjazz commented 4 years ago

I can not reproduce the issue. Sorry, I can not help. Note that I have doubts that the paths in your parameters are correct, but that likely is not the issue.

rsjazz commented 4 years ago

Note that it a good practice to create your own issue, if you want to discuss something.