I've a project which has requirement to use with IBM JDK 7. I'm using Intellij Idea 15.0.2 on windows 7. My project is multi-module maven project and uses some groovy scripts and also uses gradle to flatten the POMs using maven org.fortasoft:gradle-maven-plugin. Now when I try to build my application (Build -> Rebuild Project), I get a one liner error in Messages window
Error:java.lang.NullPointerException
When I check build.log (C:\Users\.IntelliJIdea15\system\log\build-log\build.log), I see following exception. As soon as I change the project SDK to Oracle JDK 7, everything works fine. Any idea on whats going wrong here?
[Update 1:] I also tried to invalidate cache and restarted idea, just to rule out cache is playing foul play here.
2015-12-22 14:16:23,343 [ 4126] INFO - .incremental.IncProjectBuilder - java.lang.NullPointerException
org.jetbrains.jps.incremental.ProjectBuildException: java.lang.NullPointerException
at org.jetbrains.jps.incremental.groovy.GroovyBuilder.build(GroovyBuilder.java:142)
at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1230)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:904)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:976)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:870)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:695)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:386)
at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:193)
at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:137)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:294)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:125)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:232)
at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:42)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:482)
at java.util.concurrent.FutureTask.run(FutureTask.java:273)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1176)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:795)
Caused by: java.lang.NullPointerException
at java.lang.ClassLoader.loadClass(ClassLoader.java:731)
at java.lang.ClassLoader.loadClass(ClassLoader.java:707)
at org.jetbrains.jps.incremental.groovy.InProcessGroovyc.createCompilationClassLoader(InProcessGroovyc.java:179)
at org.jetbrains.jps.incremental.groovy.InProcessGroovyc.runGroovyc(InProcessGroovyc.java:76)
at org.jetbrains.jps.incremental.groovy.GroovyBuilder.runGroovycOrContinuation(GroovyBuilder.java:201)
at org.jetbrains.jps.incremental.groovy.GroovyBuilder.build(GroovyBuilder.java:117)
... 17 more
Any idea on whats going wrong here?
IF we look to InProcessGroovyc.createCompilationClassLoader, we can see code
private JointCompilationClassLoader createCompilationClassLoader(Collection<String> compilationClassPath) throws Exception {
ClassLoader parent = obtainParentLoader(compilationClassPath);
ClassLoader groovyClassLoader = null;
try {
ClassLoader auxiliary = parent != null ? parent : buildCompilationClassLoader(compilationClassPath, null).get();
Class<?> gcl = auxiliary.loadClass("groovy.lang.GroovyClassLoader"); // 179 line, we throw NullPointer Exception
In ClassLoader.loadClass
public Class<?> loadClass(String name) throws ClassNotFoundException {
return loadClass(name, false); // 131 line
}
protected Class<?> loadClass(String name, boolean resolve)
throws ClassNotFoundException
{
synchronized (getClassLoadingLock(name)) {
// First, check if the class has already been loaded
Class<?> c = findLoadedClass(name); // return null if class not found
So main problem that IBM JDK 7 can't find groovy.lang.GroovyClassLoader, please check that groovy install correctly, IBM JDK can see groovy lib (groovy was downloaded, GROOVY_HOME environment variable is set correctly and GROOVY_HOME/bin added to your PATH environment variable).
So it seems that this is actually a bug with v15.0.2. Workaround is to add -Didea.parallel.class.loader=false under Settings | Build, Execution, Deployment | Compiler | User-local build process VM options
More details here. Fix should be available with v15.0.3. Till that time this workaround works (at least for me).
Related
On Windows 10 I downloaded and installed Eclipse Oxygen [Release (4.7.1a)
Build id: 20171005-1200] using the Eclipse Installer.
I then created a trivial Java project (no module stuff) using the New Project wizard:
public class Demo1 {
public static void main(String[] args) {
new Demo1().test(0L);
}
void test(int i) {
doStuff();
}
void test(long l) {
doStuff();
}
void doStuff() {
String s = "abcde";
s = s.substring(2,4);
System.out.print("s=");
System.out.println( s.toString());
}
}
It runs OK, and if I do CTL=>Open Implementation for test() or doStuff() or System or String or toString() or substr() everything is fine.
However, for println() and print() an error message is displayed:
Also, a stack trace is written to the Error Log:
!ENTRY org.eclipse.jdt.ui 4 0 2017-10-23 01:42:54.695 !MESSAGE An
error occurred while searching for implementations of 'print'. See
error log for details. !STACK 1 Java Model Exception: Java Model
Status [ is not on its project's build path] at
org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:570)
at
org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:247)
at
org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:505)
at
org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:241)
at
org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:505)
at
org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:241)
at
org.eclipse.jdt.internal.core.SourceRefElement.generateInfos(SourceRefElement.java:107)
at
org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:583)
at
org.eclipse.jdt.internal.core.BinaryType.getElementInfo(BinaryType.java:287)
at
org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:306)
at
org.eclipse.jdt.internal.core.BinaryType.isInterface(BinaryType.java:725)
at
org.eclipse.jdt.internal.ui.javaeditor.JavaElementImplementationHyperlink$1.run(JavaElementImplementationHyperlink.java:237)
at
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)
!SUBENTRY 1 org.eclipse.jdt.core 4 1006 2017-10-23 01:42:54.695
!MESSAGE is not on its project's build path
However, after clicking OK, the Implementation popup is displayed as expected, and clicking PrintStream sends me to the correct method implementation:
This looks like a bug in Eclipse or its installer, but the issue is very basic yet I don't see any reports for it. I have a few questions arising:
Does anyone else get this issue, or is it working?
Is there any configuration I could/should do to fix this?
Any ideas why Open Implementation would be giving the error only for print() and println()?
This seems to be a bug in the current implementation as pointed out by #ZhekaKozlov and from another thread where #Stephan has shared a work in progress documentation for the future release's New & Noteworthy for Photon M3 states that:-
Note: It is not mandatory to run Eclipse with Java Runtime 9 to get the Java 9 support. However, a Java runtime 9 is required to be on
a project's build path to compile a modular project against the system
modules.
When a Java Runtime 9 is added to a project's build path, the system modules are listed under the System library in the package explorer:
I am assuming the --add-modules=ALL-SYSTEM was solving this while users were appending this as a -vmargs arg to eclipse.ini.
Here's a simple program that I try to run:
public class TutorialExample {
public static void main(String[] args) {
boolean example = true;
assert example == true;
}
}
I have tried to follow these steps exactly for this common issue, but am unsuccessful. I still get the resulting error that reads:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
assert cannot be resolved to a type
Duplicate local variable example
Syntax error on token "==", = expected
Here is a sample image of my run configurations with the VM argument -ea included.
The Run Configuration only sets options for when you run your code. You have a problem with compiling the code.
Open the Preferences and go to the 'Java > Compiler' page. Check that the 'Compiler compliance level' is set the same level as the Java release you are running (but must be at least 1.4 for assert).
It is also possible to have Java settings specific to a project so also check the project 'Java Compiler' page in the Properties for the the project.
I want to do something with the HypergraphDB in Java. I'm not very familiar with this language and IDE Netbeans.
I followed steps describing the HGDB installation:Link to tutorial
Now I want to write an example in Java (using NetbeansIDE).
So I created new project, added refferences to the downloaded libraries. OK, now I'm able to import packages with HGDB. The only thing I have in my main method is HyperGraph HG = new HyperGraph(dbLocation);. This code compiles. But get following runtime error:
run:
checkpoint kbytes:0
checkpoint minutes:0
java.lang.IllegalStateException: There is 1 existing transaction opened against the Environment.
Aborting open transactions ...
aborting <Transaction id="28">
at com.sleepycat.je.Environment.close(Environment.java:383)
at org.hypergraphdb.storage.bje.BJEStorageImplementation.shutdown(BJEStorageImplementation.java:178)
at org.hypergraphdb.HGStore.close(HGStore.java:355)
at org.hypergraphdb.HyperGraph.open(HyperGraph.java:392)
at org.hypergraphdb.HyperGraph.open(HyperGraph.java:213)
at org.hypergraphdb.HyperGraph.<init>(HyperGraph.java:200)
at hgdbtest.HgdbTest.main(HgdbTest.java:16)
Exception in thread "main" org.hypergraphdb.HGException: java.lang.NoSuchMethodError: org.hypergraphdb.storage.bje.LinkBinding.objectToEntry(Ljava/lang/Object;Lcom/sleepycat/je/DatabaseEntry;)V
at org.hypergraphdb.HyperGraph.open(HyperGraph.java:395)
at org.hypergraphdb.HyperGraph.open(HyperGraph.java:213)
at org.hypergraphdb.HyperGraph.<init>(HyperGraph.java:200)
at hgdbtest.HgdbTest.main(HgdbTest.java:16)
Caused by: java.lang.NoSuchMethodError: org.hypergraphdb.storage.bje.LinkBinding.objectToEntry(Ljava/lang/Object;Lcom/sleepycat/je/DatabaseEntry;)V
at org.hypergraphdb.storage.bje.BJEStorageImplementation.store(BJEStorageImplementation.java:234)
at org.hypergraphdb.HGStore.store(HGStore.java:119)
at org.hypergraphdb.HGTypeSystem.addPrimitiveTypeToStore(HGTypeSystem.java:185)
at org.hypergraphdb.HGTypeSystem.bootstrap(HGTypeSystem.java:234)
at org.hypergraphdb.HyperGraph.open(HyperGraph.java:355)
... 3 more
Java Result: 1
BUILD SUCCESSFUL (total time: 4 seconds)
I guess it's caused by the native API of the BerkeleyDB.
According to the tutorial, in project options I supply the -Djava.library.path=$HGDB_ROOT/lib/native/$PLATFORM argument on Run card as a VM Option. Instead of the system variables I use full-path to the libraries.
My OS in Windows7. I'm not sure about using slashes or backslashes or double-backslashes as a path-separator.?
So a simply question is: how have I to set up the IDE for using the HypergraphDB?
Thank you for advices!
Judging from the stack trace, you are using the latest version of HyperGraphDB. In that version, the native API is not used. Rather, it's Java only libraries. You have to include the BerkeleyDB Java Edition 5.0.34 jar in your runtime classpath. You can get it either from the Oracle http://www.oracle.com/technetwork/products/berkeleydb/downloads/index.html or from the HyperGraphDB Maven repository: http://hypergraphdb.org/maven/org/hypergraphdb/hgbdbje/1.2/hgbdbje-1.2.jar
I had the same issue. I fixed it (by accident) by fixing the order of the libraries on which you're HyperGraphDB application relies on. The library je-[version].jar has to be ABOVE (and hence to be referenced before) db-[version].jar
I recently bought a Macbook Air and it's now running Mountain Lion, but i have some problems running the company's project, the only other person using a mac on work runs Lion on his Macbook Pro and he had no such problems.
As the title says theres no problem compiling the project on the command line, but when i try to compile it inside IntelliJ i get this error
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (requireJS-Optimizer) on project MarfeelTouch: Command execution failed. Cannot run program "node" (in directory "/Users/pedrompg/Documents/Marfeel/MarfeelTouch"): error=2, No such file or directory -> [Help 1]
The problem also happens when i compile it from the command line and try to run the program
Caused by: java.util.concurrent.ExecutionException: java.io.IOException: Cannot run program "phantomjs" (in directory "/Users/pedrompg/Documents/Tenants/vhosts/discoverint"): error=2, No such file or directory
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:232) ~[na:1.6.0_35]
at java.util.concurrent.FutureTask.get(FutureTask.java:91) ~[na:1.6.0_35]
at com.marfeel.pressSystem.impl.SectionPressImpl.getAllItemsFromSectionFeeds(SectionPressImpl.java:137) ~[MarfeelPressSystem-1.0.jar:na]
... 29 common frames omitted
It seems that i can't run any command line programs from inside the project
This is how we the phantomJS call:
private Process buildProcess() throws IOException {
Process process;
String[] invocationCmd = getInvocationCmd();
if (executionDirectory != null) {
if (LOG.isDebugEnabled()) {
LOG.info("Invoking PhantomJS with {} in {}.", Arrays.toString(invocationCmd), executionDirectory);
}
process = Runtime.getRuntime().exec(invocationCmd, null,
new File(executionDirectory));
} else {
if (LOG.isDebugEnabled()) {
LOG.info("Invoking PhantomJS with {} in {}.", Arrays.toString(invocationCmd));
}
process = Runtime.getRuntime().exec(invocationCmd, null);
}
return process;
}
the getInvocationCmd() returns the following array
[phantomjs,--load-images=no,--disk-cache=yes,--max-disk-cache-size=1048576,/Users/pedrompg/Documents/Marfeel/MarfeelHub/target/webapp/WEB-INF/classes/whiteCollar.js,marca/marca.js,http://www.marca.com/]
Don't know if i leave any relevant information
We use Maven, tomcat 7, nodeJS, phantomJS 1.5, nginx 1.2.4, java 1.6.0_35 on the project
Hope someone can help, i'm getting really worried about this, already wasted 2 days trying to solve this problem.
Thanks in advance
As you are using Mac, it's most likely environment related issue. Please note that on Mac GUI applications do not inherit Terminal environment variables, therefore if you have adjusted PATH variable and command works from the Terminal, it will not work when you try to run from other applications.
See the related questions about this Mac feature. Pay attention to the second link, Mountain Lion has different behavior for environment variables.
The easiest way to verify that it's the case and workaround the problem is to run IntelliJ IDEA from Terminal:
open -a /Applications/IntelliJ\ IDEA\ 11.app/
This way Terminal environment will be passed to IDEA and commands you can run from Terminal will also run from IntelliJ IDEA.
I encountered an error when my application tries to load a RSA Algorithm provider class from JAVA. The exception stack is as follow:
javax.jms.JMSException: RSA premaster secret error
at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:49)
at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1255)
at org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1350)
at org.apache.activemq.ActiveMQConnection.setClientID(ActiveMQConnection.java:388)
at com.trendmicro.tmsm.TMSMAgent.open(TMSMAgent.java:63)
Caused by: javax.net.ssl.SSLKeyException: RSA premaster secret error
at com.sun.net.ssl.internal.ssl.RSAClientKeyExchange.<init>(RSAClientKeyExchange.java:97)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:634)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:226)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:516)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:454)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:884)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1112)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:623)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
at org.apache.activemq.transport.tcp.TcpBufferedOutputStream.flush(TcpBufferedOutputStream.java:115)
at java.io.DataOutputStream.flush(DataOutputStream.java:106)
at org.apache.activemq.transport.tcp.TcpTransport.oneway(TcpTransport.java:167)
at org.apache.activemq.transport.InactivityMonitor.oneway(InactivityMonitor.java:237)
at org.apache.activemq.transport.WireFormatNegotiator.sendWireFormat(WireFormatNegotiator.java:168)
at org.apache.activemq.transport.WireFormatNegotiator.sendWireFormat(WireFormatNegotiator.java:84)
at org.apache.activemq.transport.WireFormatNegotiator.start(WireFormatNegotiator.java:74)
at org.apache.activemq.transport.failover.FailoverTransport.doReconnect(FailoverTransport.java:715)
at org.apache.activemq.transport.failover.FailoverTransport$2.iterate(FailoverTransport.java:115)
at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122)
at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:637)
Caused by: java.security.NoSuchAlgorithmException: SunTlsRsaPremasterSecret KeyGenerator not available
at javax.crypto.KeyGenerator.<init>(DashoA13*..)
at javax.crypto.KeyGenerator.getInstance(DashoA13*..)
at com.sun.net.ssl.internal.ssl.JsseJce.getKeyGenerator(JsseJce.java:223)
at com.sun.net.ssl.internal.ssl.RSAClientKeyExchange.<init>(RSAClientKeyExchange.java:89)
... 22 more
I've googled the error message and most of posts says it's because JVM cannot find sunjce_provider.jar. However, I can find the file in /Library/Java/Home/lib/ext folder.
The platform is Mac OS X 10.6 and Java version is 1.6.0_17.
My questions are:
Why JVM does not search /Library/Java/Home/lib/ext for jar files?
Can we change CLASSPATH or java.ext.dirs property by modify any config file?
Any suggestion to solve this problem?
Thanks in advance.
I've had the same problem after upgrading to new Java version on Mac.
My (maven) project ran OK from command line but got the "SunTlsRsaPremasterSecret" error in Eclipse.
The solution was to remove Installed JREs in Eclipse configuration and add them again (using the "Search..." button).
had a similar issue. Adding the classpath to the ext directory fixed it for me. This fix worked for me on windows 7 with java 1.6
java -Djava.ext.dirs=lib -classpath "%java_home%\lib\ext\*" myapp.jar
I think we find the root cause so here is an answer of my own question.
the Java system property "java.ext.dirs" in Mac OS X 10.5 is:
/Library/Java/Extensions:/System/Library/Java/Extensions:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/ext. The sunjce_provider.jar should be in /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/ext but also be found in /Library/Java/Extensions/ in the problem mac.
the sunjce_provider.jar in /Library/Java/Extensions/ belongs to Java Cryptography Extension(JCE) 1.2.2, which has been installed in the mac. JCE 1.2.2 is an optional package of J2SE 1.3.1 and may not includes enough libraries for J2SE 1.4 and later.
the Java applcation works normally after all JCE 1.2.2 related jar files have been removed from /Library/Java/Extensions/.
It happened to me while launching the tomcat server from eclipse. I solved it by changing the configuration in Windows -> Preferences -> Java -> Installed JREs -> Edit. I had to update all the JRE system libraries with the corresponding jars from the folders in:
%JAVA_HOME%/jre/lib/ext
%JAVA_HOME%/jre/lib/
It seems that after the last update I have changed the JRE_Home but forgot those libraries.
I also had this issue, noticed that the problem was in my Eclipse configuration.
Window > Preferences > Java > Installed JREs > jdk8_64bit > Edit...
The path of my sunjce_provider.jar was pointing to jdk8_64bit\lib\ext\sunjce.provider.jar. It should point to the JRE's equivalent in jdk8_64bit\jre\lib\ext\sunjce.provider.jar.
Had to spend almost a day on this while trying to use JavaMail in Eclipse Luna.
Tried all approaches suggested in various forums, but no luck.
Digged into the complete flow and found the exception arising due to Class is on BootClassPath
from KeyAgreement.getInstance()->JceSecurity.canUseProvider()->JceSecurity.getVerificationResult()->JarVerifier.verify()
void verify()
throws JarException, IOException
{
if (jarURL == null) {
throw new JarException("Class is on the bootclasspath");
}.......
I removed sunjce_provider jar from \ext\ folder and can send mail now.
This might not be right but atleast a quick workaround.
Refer Eclipse bug.
I know, I am joining late here. But for me, this error came suddenly as soon as I changed the Preference -> Java -> Installed JREs -> Execution Environments as JavaSE-1.8 to jdk1.8 path. But it should be jre1.8 path.
I don't know why is it happening now. But It sorted the problem.
Probable solution: Check if jdk path is set till C:\Program Files\Java\jdk1.8.0_171 but not including bin
In my case, I got above same issue, after reading above solutions, I changed JRE Definition and Restore Default. It is working fine now.