Bug 1077978 - zanata-cli push printed: Exception in thread "main" java.lang.NoClassDefFoundError: antlr/TokenStreamException
Summary: zanata-cli push printed: Exception in thread "main" java.lang.NoClassDefFound...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: zanata-client
Version: 20
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: ---
Assignee: Patrick Huang
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-03-19 03:05 UTC by Ding-Yi Chen
Modified: 2014-07-30 05:41 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-30 05:41:18 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

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


Note You need to log in before you can comment on or make changes to this bug.