Joda Time - Cannot run JUnit tests in Eclipse or IntelliJ - eclipse

I cloned the joda-time GitHub repository locally, imported it as a Maven project in both Eclipse and IntelliJ Idea and it built absolutelly fine in both IDEs. But when trying to run the JUnit tests it just will not work in either IDE and I cannot see what the issue is.
I know that I need to create an additional folder
src\tz-data\org\joda\time\tz\data
and place in there the two files
CET
ZoneInfoMap
and I have done all that.
The JUnit tests still do not run and the funny thing is that I get completelly different errors under Eclipse:
java.lang.ExceptionInInitializerError
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.getTest(JUnit3TestLoader.java:100)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.loadTests(JUnit3TestLoader.java:51)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.IllegalArgumentException: The datetime zone id 'Europe/Paris' is not recognised
at org.joda.time.DateTimeZone.forID(DateTimeZone.java:234)
at org.joda.time.TestLocalDate_Basics.<clinit>(TestLocalDate_Basics.java:50)
... 10 more
and under IntelliJ Idea:
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.joda.time.TestAbstractPartial
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at junit.framework.TestSuite.createTest(TestSuite.java:58)
at junit.framework.TestSuite.addTestMethod(TestSuite.java:280)
at junit.framework.TestSuite.<init>(TestSuite.java:140)
at com.intellij.junit3.TestRunnerUtil.createClassOrMethodSuite(TestRunnerUtil.java:147)
at com.intellij.junit3.TestAllInPackage2.<init>(TestAllInPackage2.java:32)
at com.intellij.junit3.TestRunnerUtil.getTestSuite(TestRunnerUtil.java:78)
at com.intellij.junit3.JUnit3IdeaTestRunner.startRunnerWithArgs(JUnit3IdeaTestRunner.java:43)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Any tips on how to get around this would be really appreciated.

I am new to maven and it turns out the issue was with the way I was trying to run the tests.
As noted by roby, I should have used the maven bar in IntelliJ to run the correct maven goal (simmilarly, I should have used Run As.. and the correct maven goal in Eclipse), whereas I was just trying to run the tests by using the IDE, i.e. right click on the project and 'Run All Tests' which understandably did not work as it was not using the correct configuration.

Related

Hibernate Logger Error for Hibernate-Search

I have been getting Logger error for Hibernate-Search.
I am trying with different versions, also with all possible ways, possible solutions, but no luck :(
Can any folks help me in resolving this? Am stuck in this for a week now.
We are using Spring Boot-2 and Hibernate 5. Everything works fine when run from eclipse with embedded Tomcat of spring-boot, but fails to build/run with bellow error when deployed in External Tomcat in Linux server.
Caused by: java.lang.NoSuchMethodError: org.hibernate.search.util.logging.impl.LoggerFactory.make()Lorg/hibernate/search/util/logging/impl/Log;
at org.hibernate.search.hcore.impl.HibernateSearchIntegrator.(HibernateSearchIntegrator.java:32)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
... 158 more
This looks like you are using two different versions of Hibernate Search: one version for hibernate-search-orm, and another for hibernate-search-engine.
Pick one version, use it for both JARs, and you should be fine.

Copied IntelliJ project machine A to B, but it won't build on B

I have IntelliJ, Scala and SBT at work (Win8) and on my laptop (OSX). I've never had a problem like this before. I'm stuck in a hotel because of weather, and I have a copy of my IDEA project on my laptop. I tried building the project on my laptop, and it failed with the message below. As far as I know I have all the dependent JARs, the latest plugins, etc. I don't think I'm missing anything. But I'm mystified how something so simple could eat up time that could be spent programming while I try to figure out what went wrong after zipping and copying an IntelliJ project from one machine to another.
Error:scalac: Error: xsbt.CompilerInterface
java.lang.ClassNotFoundException: xsbt.CompilerInterface
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:249)
at sbt.compiler.AnalyzingCompiler.getInterfaceClass(AnalyzingCompiler.scala:117)
at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:99)
at sbt.compiler.AnalyzingCompiler.newCachedCompiler(AnalyzingCompiler.scala:57)
at sbt.compiler.AnalyzingCompiler.newCachedCompiler(AnalyzingCompiler.scala:52)
at sbt.compiler.CompilerCache$$anon$2.apply(CompilerCache.scala:50)
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:39)
at org.jetbrains.jps.incremental.scala.local.IdeaIncrementalCompiler.compile(IdeaIncrementalCompiler.scala:29)
at org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:26)
at org.jetbrains.jps.incremental.scala.remote.Main$.make(Main.scala:62)
at org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:20)
at org.jetbrains.jps.incremental.scala.remote.Main.nailMain(Main.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.martiansoftware.nailgun.NGSession.run(NGSession.java:319)
Suggestions:
use "Import project" instead of File|Open. Select sbt project
ensure you have access to internet
build the project first on the command line . e.g
sbt compile package
or
sbt compile assembly
- rebuild the project in the IDE (Yes painful, but it is a known bug)
Get back here if you still encounter issues.
It seems the problem with updating IDEA to version 14. Try removing the JDK from IDEA and adding it again. It should work.

Eclipse segfaults when autocompleting code in maven project

I am working with Eclipse and maven in a project, and since my last system update or so, each time I use the code fixing tools (Ctrl.+1) eclipse segfaults.
The abrt log saved by Fedora contains the following stacktrace:
Uncaught java.lang.ClassNotFoundException exception in thread "main" in a method java.lang.ClassLoader.loadClass() with signature (Ljava/lang/String;Z)Ljava/lang/Class;
Exception in thread "main" java.lang.ClassNotFoundException: .home.username.workspace.ibei.target.surefire.surefirebooter1921570312357618538.jar
at java.net.URLClassLoader$1.run(URLClassLoader.java:366) [jar:file:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64/jre/lib/rt.jar!/java/net/URLClassLoader$1.class]
at java.net.URLClassLoader$1.run(URLClassLoader.java:355) [jar:file:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64/jre/lib/rt.jar!/java/net/URLClassLoader$1.class]
at java.security.AccessController.doPrivileged(Native Method) [jar:file:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64/jre/lib/rt.jar!/java/security/AccessController.class]
at java.net.URLClassLoader.findClass(URLClassLoader.java:354) [jar:file:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64/jre/lib/rt.jar!/java/net/URLClassLoader.class]
at java.lang.ClassLoader.loadClass(ClassLoader.java:425) [jar:file:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64/jre/lib/rt.jar!/java/lang/ClassLoader.class]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) [jar:file:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64/jre/lib/rt.jar!/sun/misc/Launcher$AppClassLoader.class]
at java.lang.ClassLoader.loadClass(ClassLoader.java:358) [jar:file:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64/jre/lib/rt.jar!/java/lang/ClassLoader.class]
It seems as if the surefire plugin for maven wouldn't load java.lang.String, what is it wrong?
I've tried using the OpenJDK at Java versions 1.7.0 and 1.8.0, and reinstalling eclipse and maven a bunch of times.
Try removing google-talkplugin if you have one. It's faulty and breaks webkit, causing crashes on every browser show (code assist is browser based).

JOGL throwing ClassNotFoundException?

I've seen this question brought up a couple of times on this website, but never really seen a clear answer, so excuse me from repeating it. While programming with JOGL and Java3D I've encountered some errors. I was trying to create a project that I might eventually put on the Android App Store. I began the project just using Java3D and JOGL and putting them in the system library on my mac, where they worked fine. Then to try to make the project portable I moved the J3D and JOGL files inside the project so they could be compiled into a jar file that would be runnable without needing to install j3d and JOGL. But then every time I ran the project it threw this error:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/GL
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at javax.media.j3d.Pipeline$PipelineCreator.run(Pipeline.java:73)
at javax.media.j3d.Pipeline$PipelineCreator.run(Pipeline.java:61)
at java.security.AccessController.doPrivileged(Native Method)
at javax.media.j3d.Pipeline.createPipeline(Pipeline.java:90)
at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:832)
at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:274)
at javax.media.j3d.GroupRetained.<init>(GroupRetained.java:155)
at javax.media.j3d.TransformGroupRetained.<init>(TransformGroupRetained.java:116)
at javax.media.j3d.TransformGroup.createRetained(TransformGroup.java:114)
at javax.media.j3d.SceneGraphObject.<init>(SceneGraphObject.java:114)
at javax.media.j3d.Node.<init>(Node.java:172)
at javax.media.j3d.Group.<init>(Group.java:549)
at javax.media.j3d.TransformGroup.<init>(TransformGroup.java:87)
at src.Project.<clinit>(Project.java:47)
at src.ProjectPanel.<clinit>(ProjectPanel.java:8)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GL
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:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 17 more
I'm using Eclipse as an IDE, and have the jogl-all.jar and gluegen-rt.jar files in the classpath of the project, as well as all of the require j3d jars, but it cannot find the GL.class file for some reason.
Thanks in advance for help.
When you export your application as a Runnable JAR use the
+ Library handling:
Copy required libraries into a sub-folder next to the generated JAR
or
+ Library handling:
Package required libraries into generated JAR
More information is available in the jogamp jogl wiki:
http://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDE
http://jogamp.org/wiki/index.php/JogAmp_JAR_File_Handling
Also you will need to use the java -jar yourapp.jar command line option to run your application.

Grails test war creation error

I am using Grails 2.1.4 and Maven Integration.
I created pom file for Grails project. I am running a goal like this from Eclipse:
mvn -Dgrails.env=test package
I am getting error like this:
Fatal error forking Grails JVM: java.lang.reflect.InvocationTargetException
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.grails.launcher.GrailsLauncher.launch(GrailsLauncher.java:150)
at org.grails.maven.plugin.tools.ForkedGrailsRuntime.main(ForkedGrailsRuntime.java:168)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.grails.launcher.GrailsLauncher.launch(GrailsLauncher.java:144)
... 1 more
Caused by: java.lang.IllegalStateException: User input is not enabled, cannot obtain input stream
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:54)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:194)
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:391)
The error that you're seeing may happen once in a while, especially in Grails 2.1.x.
Run the command(mvn -Dgrails.env=test package) couple of times and you'll notice that your problem is intermittent, it cannot be reproduced all the time.
Setting the fork option to false in your pom.xml seems to 'fix' it, in most cases. It's probably a Grails bug for 2.1.x releases.
I haven't seen the issue yet in newer Grails versions.
I just encountered the same error after upgrading Grails from 2.2.1 to 2.2.4 .
The issue was that the plugin directory was not cleared out and was clashing with the new plugins coming in.
The solution is to delete all of the plugins in the project root/plugins directory and then run any grails or maven commands to reinstall the new set of plugins.