Bug 1077978

Summary: zanata-cli push printed: Exception in thread "main" java.lang.NoClassDefFoundError: antlr/TokenStreamException
Product: [Fedora] Fedora Reporter: Ding-Yi Chen <dchen>
Component: zanata-clientAssignee: Patrick Huang <pahuang>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 20CC: dchen, pahuang, sflaniga
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-30 05:41:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ding-Yi Chen 2014-03-19 03:05:51 UTC
Description of problem:
zanata-cli push produce following error messages:
Exception in thread "main" java.lang.NoClassDefFoundError: antlr/TokenStreamException
        at org.zanata.adapter.po.PoReader2.createParser(PoReader2.java:278)
        at org.zanata.adapter.po.PoReader2.extractTemplate(PoReader2.java:200)
        at org.zanata.client.commands.push.AbstractGettextPushStrategy.loadSrcDoc(AbstractGettextPushStrategy.java:82)
        at org.zanata.client.commands.push.PushCommand.pushCurrentModule(PushCommand.java:416)
        at org.zanata.client.commands.push.PushCommand.run(PushCommand.java:207)
        at org.zanata.client.commands.ArgsUtil.runCommand(ArgsUtil.java:56)
        at org.zanata.client.ZanataClient.processArgs(ZanataClient.java:164)
        at org.zanata.client.ZanataClient.main(ZanataClient.java:90)
Caused by: java.lang.ClassNotFoundException: antlr.TokenStreamException
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        ... 8 more


Version-Release number of selected component (if applicable):
zanata-client-3.1.1-1.fc20.noarch


How reproducible:
Always

Steps to Reproduce:
1. zanata-cli -e -B -s . -t.

Actual results:
Exception in thread "main" java.lang.NoClassDefFoundError: antlr/TokenStreamException
        at org.zanata.adapter.po.PoReader2.createParser(PoReader2.java:278)
        at org.zanata.adapter.po.PoReader2.extractTemplate(PoReader2.java:200)
        at org.zanata.client.commands.push.AbstractGettextPushStrategy.loadSrcDoc(AbstractGettextPushStrategy.java:82)
        at org.zanata.client.commands.push.PushCommand.pushCurrentModule(PushCommand.java:416)
        at org.zanata.client.commands.push.PushCommand.run(PushCommand.java:207)
        at org.zanata.client.commands.ArgsUtil.runCommand(ArgsUtil.java:56)
        at org.zanata.client.ZanataClient.processArgs(ZanataClient.java:164)
        at org.zanata.client.ZanataClient.main(ZanataClient.java:90)
Caused by: java.lang.ClassNotFoundException: antlr.TokenStreamException
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        ... 8 more


Expected results:
Push successfully.

Additional info:

Comment 1 Sean Flanigan 2014-07-14 04:30:54 UTC
This is apparently happening because the classpath we create for the zanata-cli script in zanata-client.spec (using maven's dependency:build-classpath at build time) is no longer valid at runtime.

In zanata-client.spec, I think we should instead try using dependency:copy-dependencies to copy the jars to one place, and then xmvn-subst to replace them with symlinks to their runtime locations.  Then we could either include the symlinks in the rpm, or get a list of their link targets and use them directly in the zanata-cli script.

Comment 2 Patrick Huang 2014-07-15 06:01:57 UTC
I think I found an easy workaround. We just need to change the script to use antlr.jar instead of antlr-2.7.7.jar. Same goes with the xom.jar. They used to place the jar with version in the name. But not anymore therefore breaks the classpath.

Comment 3 Patrick Huang 2014-07-21 02:33:34 UTC
zanata-client-3.3.2-3.fc20 is in update-testing repo

Comment 4 Patrick Huang 2014-07-30 05:40:52 UTC
pushed to stable both in f19 and f20