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

NoClassDefFoundError: org/threeten/extra/AmPm #1670

Closed
djh82 opened this issue Jun 8, 2020 · 11 comments · Fixed by #1794
Closed

NoClassDefFoundError: org/threeten/extra/AmPm #1670

djh82 opened this issue Jun 8, 2020 · 11 comments · Fixed by #1794
Assignees

Comments

@djh82
Copy link

djh82 commented Jun 8, 2020

ErrorProne 2.4, using error_prone_core-2.4.0-with-dependencies.jar, appears not to contain the threeten dependencies for the new FromTemporalAccessor check.

@omeryounus
Copy link

which JDK are you running on ?

@djh82
Copy link
Author

djh82 commented Jun 18, 2020

Using JDK 8.

@kleinj
Copy link

kleinj commented Jun 23, 2020

I'm running into the same problem (on JDK11).

To reproduce:

  1. Create new/empty directory, go there and put the ShortSet.java example from http://errorprone.info/ there.
  2. Execute the 3 wget commands from the 'Command Line - Java 9, 10, and 11' section of http://errorprone.info/docs/installation
  3. Run
    javac -XDcompilePolicy=simple -processorpath error_prone_core-2.4.0-with-dependencies.jar:dataflow-shaded-3.1.2.jar:jFormatString-3.0.0.jar '-Xplugin:ErrorProne' ShortSet.java

Output:

error: An unhandled exception was thrown by the Error Prone static analysis plugin.
     Please report this at https://github.com/google/error-prone/issues/new and include the following:

     error-prone version: 2.4.0
     BugPattern: (see stack trace)
     Stack Trace:
     java.lang.NoClassDefFoundError: org/threeten/extra/AmPm
  	at com.google.errorprone.bugpatterns.time.FromTemporalAccessor.<clinit>(FromTemporalAccessor.java:103)
  	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
  	at com.google.errorprone.scanner.ScannerSupplierImpl.instantiateChecker(ScannerSupplierImpl.java:84)
  	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
  	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
  	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
  	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
  	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
  	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
  	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
  	at com.google.errorprone.scanner.ScannerSupplierImpl.get(ScannerSupplierImpl.java:102)
  	at com.google.errorprone.scanner.ScannerSupplierImpl.get(ScannerSupplierImpl.java:40)
  	at com.google.errorprone.ErrorProneAnalyzer.lambda$scansPlugins$0(ErrorProneAnalyzer.java:79)
  	at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:167)
  	at com.google.errorprone.ErrorProneAnalyzer.finished(ErrorProneAnalyzer.java:152)
  	at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:132)
  	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1418)
  	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1365)
  	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:960)
  	at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:311)
  	at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:170)
  	at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
  	at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
  Caused by: java.lang.ClassNotFoundException: org.threeten.extra.AmPm
  	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
  	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
  	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
  	... 26 more
1 error

@kluever
Copy link
Member

kluever commented Jun 28, 2020

This seems like a dependency issue - CC'ing myself.

@kluever kluever self-assigned this Jun 28, 2020
@dtomassi
Copy link

@kluever Any updates on this?

@kluever
Copy link
Member

kluever commented Aug 21, 2020

Have an internal CL pending - should be sync'ed out shortly (switching to use FQCN string literals for the ThreeTenExtra types to avoid a dependency)

copybara-service bot pushed a commit that referenced this issue Aug 24, 2020
…r a dependency on ThreeTenExtra.

Fixes #1670

PiperOrigin-RevId: 327862374
copybara-service bot pushed a commit that referenced this issue Aug 24, 2020
…r a dependency on ThreeTenExtra.

Fixes #1670

PiperOrigin-RevId: 327862374
copybara-service bot pushed a commit that referenced this issue Aug 24, 2020
…r a dependency on ThreeTenExtra.

Fixes #1670

PiperOrigin-RevId: 327862374
@chenqihong
Copy link

I am having the same problem. Is there any way to fix this problem?

Thank you

@cushon
Copy link
Collaborator

cushon commented Jan 9, 2021

I am having the same problem. Is there any way to fix this problem?

This was fixed in #1794, which will be in the next release (#2061).

You could wait for the next release, or add an explicit dependency on org.threeten:threeten-extra:

    <dependency>
      <groupId>org.threeten</groupId>
      <artifactId>threeten-extra</artifactId>
      <version>1.5.0</version>
    </dependency>

@chenqihong
Copy link

I just add this dependency on my local mac, which is in .m2/repository/org/threeten/threeten-extra/1.5.0/threeten-extra-1.5.0.jar. When I run the same command, it still reports the same issue. I am just wondering if I place this dependency in the incorrect location? Thank you.

@cushon
Copy link
Collaborator

cushon commented Jan 9, 2021

It needs to be on the processorpath when you run Error Prone, e.g. by adding an entry in <annotationProcessorPaths> to your pom.xml if you're using maven, or adding it to javac's -processorpath if you're using the 'command line' instructions in http://errorprone.info/docs/installation.

@chenqihong
Copy link

@cushon Resolved! Thank you so much!

stevie400 pushed a commit to HubSpot/error-prone that referenced this issue Jan 15, 2021
…r a dependency on ThreeTenExtra.

Fixes google#1670

PiperOrigin-RevId: 328144552
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants