Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NoClassDefFoundError: org/vafer/jdeb/Console #1053

Closed
1015bit opened this issue Oct 24, 2017 · 21 comments
Closed

java.lang.NoClassDefFoundError: org/vafer/jdeb/Console #1053

1015bit opened this issue Oct 24, 2017 · 21 comments

Comments

@1015bit
Copy link

1015bit commented Oct 24, 2017

Any ideas/workarounds/fixes very much appreciated.

Expected behaviour

Plugin loads without errors.

Actual behaviour

Loading plugin fails with java.lang.NoClassDefFoundError: org/vafer/jdeb/Console

Information

Versions are sbt-native-packager 1.3.0 and sbt 1.0.2
Archetype: JavaAppPackaging

The full stacktrace is:

[error] java.lang.NoClassDefFoundError: org/vafer/jdeb/Console
[error] 	at java.lang.Class.forName0(Native Method)
[error] 	at java.lang.Class.forName(Class.java:348)
[error] 	at sbt.internal.inc.ModuleUtilities$.getObject(ModuleUtilities.scala:20)
[error] 	at sbt.internal.inc.ModuleUtilities$.getCheckedObject(ModuleUtilities.scala:27)
[error] 	at sbt.internal.inc.ModuleUtilities$.$anonfun$getCheckedObjects$1(ModuleUtilities.scala:31)
[error] 	at scala.collection.immutable.Stream.$anonfun$map$1(Stream.scala:415)
[error] 	at scala.collection.immutable.Stream$Cons.tail(Stream.scala:1169)
[error] 	at scala.collection.immutable.Stream$Cons.tail(Stream.scala:1159)
[error] 	at scala.collection.generic.Growable.loop$1(Growable.scala:54)
[error] 	at scala.collection.generic.Growable.$plus$plus$eq(Growable.scala:58)
[error] 	at scala.collection.generic.Growable.$plus$plus$eq$(Growable.scala:50)
[error] 	at scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:186)
[error] 	at scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:44)
[error] 	at scala.collection.TraversableLike.$plus$plus(TraversableLike.scala:147)
[error] 	at scala.collection.TraversableLike.$plus$plus$(TraversableLike.scala:143)
[error] 	at scala.collection.immutable.List.$plus$plus(List.scala:207)
[error] 	at sbt.internal.PluginDiscovery$.discoverAll(PluginDiscovery.scala:47)
[error] 	at sbt.internal.Load$.loadPlugins(Load.scala:1267)
[error] 	at sbt.internal.Load$.loadPluginDefinition(Load.scala:1212)
[error] 	at sbt.internal.Load$.buildPlugins(Load.scala:1191)
[error] 	at sbt.internal.Load$.plugins(Load.scala:1174)
[error] 	at sbt.internal.Load$.$anonfun$loadUnit$2(Load.scala:683)
[error] 	at sbt.internal.Load$.timed(Load.scala:1343)
[error] 	at sbt.internal.Load$.$anonfun$loadUnit$1(Load.scala:683)
[error] 	at sbt.internal.Load$.timed(Load.scala:1343)
[error] 	at sbt.internal.Load$.loadUnit(Load.scala:677)
[error] 	at sbt.internal.Load$.$anonfun$builtinLoader$4(Load.scala:477)
[error] 	at sbt.internal.BuildLoader$.$anonfun$componentLoader$5(BuildLoader.scala:154)
[error] 	at sbt.internal.BuildLoader.apply(BuildLoader.scala:219)
[error] 	at sbt.internal.Load$.loadURI$1(Load.scala:539)
[error] 	at sbt.internal.Load$.loadAll(Load.scala:555)
[error] 	at sbt.internal.Load$.loadURI(Load.scala:485)
[error] 	at sbt.internal.Load$.load(Load.scala:464)
[error] 	at sbt.internal.Load$.$anonfun$apply$1(Load.scala:249)
[error] 	at sbt.internal.Load$.timed(Load.scala:1343)
[error] 	at sbt.internal.Load$.apply(Load.scala:249)
[error] 	at sbt.internal.Load$.defaultLoad(Load.scala:65)
[error] 	at sbt.BuiltinCommands$.liftedTree1$1(Main.scala:696)
[error] 	at sbt.BuiltinCommands$.doLoadProject(Main.scala:696)
[error] 	at sbt.BuiltinCommands$.$anonfun$loadProjectImpl$2(Main.scala:688)
[error] 	at sbt.Command$.$anonfun$applyEffect$4(Command.scala:125)
[error] 	at sbt.Command$.$anonfun$applyEffect$2(Command.scala:121)
[error] 	at sbt.MainLoop$.processCommand(MainLoop.scala:121)
[error] 	at sbt.MainLoop$.$anonfun$next$2(MainLoop.scala:105)
[error] 	at sbt.State$$anon$1.runCmd$1(State.scala:227)
[error] 	at sbt.State$$anon$1.process(State.scala:233)
[error] 	at sbt.MainLoop$.$anonfun$next$1(MainLoop.scala:105)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] 	at sbt.MainLoop$.next(MainLoop.scala:105)
[error] 	at sbt.MainLoop$.run(MainLoop.scala:98)
[error] 	at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:76)
[error] 	at sbt.io.Using.apply(Using.scala:22)
[error] 	at sbt.MainLoop$.runWithNewLog(MainLoop.scala:70)
[error] 	at sbt.MainLoop$.runAndClearLast(MainLoop.scala:52)
[error] 	at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:37)
[error] 	at sbt.MainLoop$.runLogged(MainLoop.scala:29)
[error] 	at sbt.StandardMain$.runManaged(Main.scala:104)
[error] 	at sbt.xMain.run(Main.scala:71)
[error] 	at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
[error] 	at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
[error] 	at xsbt.boot.Launch$.run(Launch.scala:109)
[error] 	at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
[error] 	at xsbt.boot.Launch$.launch(Launch.scala:117)
[error] 	at xsbt.boot.Launch$.apply(Launch.scala:18)
[error] 	at xsbt.boot.Boot$.runImpl(Boot.scala:41)
[error] 	at xsbt.boot.Boot$.main(Boot.scala:17)
[error] 	at xsbt.boot.Boot.main(Boot.scala)

I tried using version 1.2.2 but it fails with Caused by: java.lang.ClassNotFoundException: org.vafer.jdeb.producers.AbstractDataProducer

@muuki88
Copy link
Contributor

muuki88 commented Oct 24, 2017

Thanks @pbvie for the detailed bug report.

Are you using the JDebPacking?
Either way can you try adding this line to your plugins.sbt

libraryDependencies += "org.vafer" % "jdeb" % "1.3" artifacts (Artifact("jdeb", "jar", "jar"))

If that doesn't help, can you post a small build.sbt / plugins.sbt reproducing this issue?

@1015bit
Copy link
Author

1015bit commented Oct 25, 2017

@muuki88 Thanks! Will try your suggestion today or tomorrow.

I'm using only JavaAppPackaging (no JDebPackaging).

@1015bit
Copy link
Author

1015bit commented Oct 29, 2017

@muuki88 Sorry for the delay...was at a conference.

I tried adding libraryDependencies += "org.vafer" % "jdeb" % "1.3" artifacts (Artifact("jdeb", "jar", "jar"))

with the result of now getting java.lang.ClassNotFoundException: org.vafer.jdeb.producers.AbstractDataProducer...so a slightly different error ;)

I've attached a simple sbt project that reproduces the error on my machine: classnotfound.zip

One thing that might be noteworthy: I'm using coursier (it's in my global plugins.sbt)

@muuki88
Copy link
Contributor

muuki88 commented Oct 29, 2017

no worries @pbvie :)

Yeah. I think coursier is the one that causes this. There is an issue coursier/coursier/issues/450 that tackles this issue. For sbt 0.13.x native-packager integrates the workaround. However in sbt 1.x it seems that the plugin initialization does more than in sbt 0.13.x, because the mentioned workaround is still the same, but the classpathTypes are only extended, when the JDebPackaging plugin is enabled. And even then it doesn't seem to work.

Would you like to provide a small pull request with a scripted test that uses coursier? We may be able to initialize the classpathTypes at the right spot so coursier works correctly.

@1015bit
Copy link
Author

1015bit commented Oct 29, 2017

@muuki88 Thanks for confirming it's really a bug and not just a problem on my machine ;)

Yes, if it's not very urgent I could do that. You mean like https://github.com/sbt/sbt-native-packager/tree/master/src/sbt-test/debian/java-app-archetype, right?

@muuki88
Copy link
Contributor

muuki88 commented Oct 29, 2017

Exactly 😀 fixing errors with a regression test in place is more fun 😎

@1015bit
Copy link
Author

1015bit commented Oct 29, 2017

Great, will send you a PR in the next couple of days then :)

Thanks!

@1015bit
Copy link
Author

1015bit commented Nov 2, 2017

Is there anything that I need to keep in mind when running the debian tests?

I tried running scripted debian/java-app-archetype but it failed with

[info] [info] Building debian package with native implementation
[info] [error] /usr/bin/fakeroot: line 178: dpkg-deb: command not found

Thanks!

@muuki88
Copy link
Contributor

muuki88 commented Nov 2, 2017

Yes. You need fakeroot and dpkg installed 😀

@muuki88
Copy link
Contributor

muuki88 commented Nov 2, 2017

@1015bit
Copy link
Author

1015bit commented Nov 2, 2017

@muuki88
Copy link
Contributor

muuki88 commented Nov 2, 2017

Good point. That would be a better place to put these information 😁

@1015bit
Copy link
Author

1015bit commented Nov 5, 2017

Quick update: Unfortunately, I have a problem installing dpkg on my system 🙁

Hope I can take a closer look next week.

@He-Pin
Copy link
Contributor

He-Pin commented Nov 6, 2017

I see this problem When I switch to macOSSierra

My project is a Play project.

use the fix from :coursier/coursier#450 ,and it works

@1015bit
Copy link
Author

1015bit commented Nov 18, 2017

@muuki88 I think the problem has been fixed with the latest version of sbt-native-packager.

@muuki88
Copy link
Contributor

muuki88 commented Nov 18, 2017

Thanks for sharing. However that really puzzles me as we haven't changed anything regarding the DebianPlugin.

Was there any coursier update in the meantime?

@timcharper
Copy link
Contributor

timcharper commented Sep 24, 2018

I'm running in to this again with 1.3.9. Looks like if you include coursier in your sbt-in-sbt plugins.sbt, then it resurfaces.

mkdir repro-case
cd repro-case
base64 -D <<-EOF | tar xz
H4sIAAAAAAAAA+2X3WrbMBSAfd2nMIbCdhFN/0oHeYfCYLfl2FFct45lbKVsbz8lWQZ1WAwlcml9vhth
WbYkpO/oqIVfD2XtcqgfHi2sbZdcHxrQWh/KwLAML2XChFCcS820CvVMKs6SMsJYztj1HrrQZeecv9Ru
7P1wch8ExdPCbbe28StWGLqhXAmlYLmhhsMSNAXFNTN0qe5AFqCtyG/ee8zI9SBl5auycZ2N18fRf/l/
/6ke+i+oYskkEs3c/zD50l6cGPKZyXdVvSZ9HnMLjPov2NB/rg1F/yegL6CGn7brK9ek31dpxgnjRGZ4
yM+DtnNPtvDfYvax98EYdeH8p2f+KyESFXNQJ2bu/2n9j+dAeGpt5yvbX7OP0fjP+XD9lZEc4/8EhJOf
vBzD/4oRRigG/llx8r+td2XV9FEywTH/mTm7/0kj0P8pgPX6R+7vD6v/JSvclvjfre1hY/dbIUtv0yyU
iwZ89WIXLRTPUNruUM+IIHfZ15vXv6gcCRfKReF2Iaj8bbn/w6uKEGeICJ++9+yRf/5HzAPfkP9JThnm
fxMwXP8YeeAb8j8jGd7/pwDzv3kz9D9GHjjqvxFD/7UwEv2fAEzeEARBEARB5sUfwh2zGQAoAAA=
EOF
sbt

timcharper pushed a commit to d2iq-archive/marathon that referenced this issue Sep 24, 2018
- Restore MAINTAINER label for our Docker image
- Remove left over NativePackager code
- Remove references to jdeb and associated workaround
- Remove sbt-in-sbt loading of Coursier (this causes an issue, see sbt/sbt-native-packager#1053 (comment))
- Sync sbt-in-sbt version
timcharper pushed a commit to d2iq-archive/marathon that referenced this issue Sep 24, 2018
- Restore MAINTAINER label for our Docker image
- Remove left over NativePackager code
- Remove references to jdeb and associated workaround
- Remove sbt-in-sbt loading of Coursier (this causes an issue, see sbt/sbt-native-packager#1053 (comment))
- Sync sbt-in-sbt version
@2m
Copy link
Member

2m commented Sep 24, 2018

Yup. Its the coursier/coursier#450

I keep

classpathTypes += "maven-plugin"

in my ~/.sbt/1.0/global.sbt as a workaround.

@timcharper
Copy link
Contributor

It only happens for sbt-in-sbt, however :)

@muuki88
Copy link
Contributor

muuki88 commented Sep 25, 2018

Yeiks. This is coming back over and over again. The main issue is that the jdeb dependency is not in the provided scope anymore.

I'm still thinking of moving the JDebPlugin into a separate submodule as it causes so much trouble. Logging dependency, coursier issues...

@muuki88
Copy link
Contributor

muuki88 commented Sep 26, 2018

This relates to #1097 and should not be an issue for non-debian users (#1161)

timcharper pushed a commit to d2iq-archive/marathon that referenced this issue Sep 26, 2018
- Restore MAINTAINER label for our Docker image
- Remove left over NativePackager code
- Remove references to jdeb and associated workaround
- Remove sbt-in-sbt loading of Coursier (this causes an issue, see sbt/sbt-native-packager#1053 (comment))
- Sync sbt-in-sbt version
timcharper pushed a commit to d2iq-archive/marathon that referenced this issue Sep 28, 2018
- Restore MAINTAINER label for our Docker image
- Remove left over NativePackager code
- Remove references to jdeb and associated workaround
- Remove sbt-in-sbt loading of Coursier (this causes an issue, see sbt/sbt-native-packager#1053 (comment))
- Sync sbt-in-sbt version
- Use indexWhere to find the split location
tjsilver added a commit to guardian/tagmanager that referenced this issue May 18, 2021
tjsilver added a commit to guardian/tagmanager that referenced this issue May 18, 2021
tjsilver added a commit to guardian/tagmanager that referenced this issue May 18, 2021
tjsilver added a commit to guardian/tagmanager that referenced this issue May 18, 2021
twrichards added a commit to guardian/tagmanager that referenced this issue May 19, 2021
twrichards added a commit to guardian/tagmanager that referenced this issue May 19, 2021
twrichards added a commit to guardian/tagmanager that referenced this issue May 19, 2021
twrichards added a commit to guardian/tagmanager that referenced this issue May 19, 2021
twrichards added a commit to guardian/tagmanager that referenced this issue May 19, 2021
twrichards added a commit to guardian/tagmanager that referenced this issue May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants