When I try to debug a WebApp configured to run with Oracle Weblogic Server from NetBeans 10, I always get the following error:
There's not even complicated steps, I just open my project and then right-click / Debug.
java.lang.NoClassDefFoundError: Could not initialize class weblogic.jndi.Environment
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
at java.naming/javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:730)
at java.naming/javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:305)
at java.naming/javax.naming.InitialContext.init(InitialContext.java:236)
at java.naming/javax.naming.InitialContext.<init>(InitialContext.java:208)
at weblogic.management.remote.common.ClientProviderBase.makeConnection(ClientProviderBase.java:178)
at weblogic.management.remote.common.ClientProviderBase.newJMXConnector(ClientProviderBase.java:84)
at java.management/javax.management.remote.JMXConnectorFactory.newJMXConnector(JMXConnectorFactory.java:378)
at org.netbeans.modules.j2ee.weblogic9.WLConnectionSupport$1.call(WLConnectionSupport.java:182)
at org.netbeans.modules.j2ee.weblogic9.WLConnectionSupport.executeAction(WLConnectionSupport.java:112)
at org.netbeans.modules.j2ee.weblogic9.WLConnectionSupport.executeAction(WLConnectionSupport.java:161)
at org.netbeans.modules.j2ee.weblogic9.deploy.WLDeploymentManager.getTargets(WLDeploymentManager.java:632)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.getTargetMap(ServerInstance.java:560)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.getTargets(ServerInstance.java:518)
at org.netbeans.modules.j2ee.deployment.impl.ServerString.getTargets(ServerString.java:117)
at org.netbeans.modules.j2ee.deployment.impl.ServerString.toTargets(ServerString.java:155)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.init(TargetServer.java:146)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.undeploy(TargetServer.java:771)
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.undeploy(Deployment.java:337)
at org.netbeans.modules.j2ee.ant.Undeploy.execute(Undeploy.java:92)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at jdk.internal.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1388)
at org.apache.tools.ant.Project.executeTarget(Project.java:1361)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:261)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:574)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:128)
BUILD FAILED (total time: 0 seconds)
My environment is:
NetBeans 10 running on Java 10.0.2+13
Windows 10
Weblogic Server 10.3.6 running on Java 1.6.0.45
How to fix?
For Eclipse IDE, the solution for me was to switch from JDK11 to JDK8 on the client.
I've decided to post this question because it took me the whole morning to find a solution... especially because the most common reason for java.lang.NoClassDefFoundError: Could not initialize class weblogic.jndi.Environment to occur, is when weblogic.jar and wlfullclient.jar aren't being properly located by any of IDE, WebApp, or WL.
To fix the issue just run your project using NetBeans 8.2, this seems to be a bug at NB10 only.
Also, don't even try running it on NB11, NB12, NB12.1 nor NB12.2. Currently, Java EE plugin for those versions is discontinued so you'll not even be able to add WL to your server list.
The reason it broke in NB10 is that they started removing Java 8 vendor features from it, And the reason it doesn't even is possible to add WL to NB11 > is because Oracle removed JDK8 features for the followed releases of Java... NB integration is not under Apache Licence so they just aren't giving support to it now (is an issue that they refused to fix). However, with a bit of risk, it can be added manually.
Sonarqube 5.4 and java 8 here.
Tried this on both sonarqube 5.1 and with java 7 and I get the same results.
2016.03.29 10:49:23 ERROR web[o.a.c.c.C.[.[.[/]] Exception sending context initialized event to listener instance of class org.sonar.server.platform.PlatformServletContextListener
java.lang.IllegalStateException: Fail to execute ES put mapping request on indices 'rules' on type 'rule' with source '{"dynamic":false,"_id":{"path":"key"},"properties":{"debtRemFnOffset":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"_debtChar":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"_key":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"debtRemFnTypeOverloaded":{"type":"boolean"},"noteLogin":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"lang":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"id":{"type":"double"},"allTags":{"type":"multi_field","fields":{"allTags":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"words":{"type":"string","index":"analyzed","index_analyzer":"index_words","search_analyzer":"search_words"},"grams":{"type":"string","index":"analyzed","index_analyzer":"index_grams","search_analyzer":"search_grams"}}},"debtCharOverloaded":{"type":"boolean"},"ruleKey":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"createdAt":{"type":"date","format":"date_time"},"repo":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"name":{"type":"multi_field","fields":{"sort":{"type":"string","index":"analyzed","analyzer":"sortable"},"words":{"type":"string","index":"analyzed","index_analyzer":"index_words","search_analyzer":"search_words"},"name":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"grams":{"type":"string","index":"analyzed","index_analyzer":"index_grams","search_analyzer":"search_grams"}}},"debtChar":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"htmlDesc":{"type":"multi_field","fields":{"words":{"type":"string","index":"analyzed","index_analyzer":"index_words","search_analyzer":"search_words"},"htmlDesc":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"}}},"effortToFix":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"_debtRemFnOffset":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"debtRemFnType":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"key":{"type":"multi_field","fields":{"sort":{"type":"string","index":"analyzed","analyzer":"sortable"},"key":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"}}},"tags":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"templateKey":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"internalKey":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"debtSubCharOverloaded":{"type":"boolean"},"status":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"noteUpdatedAt":{"type":"date","format":"date_time"},"debtSubChar":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"mdDesc":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"noteCreatedAt":{"type":"date","format":"date_time"},"severity":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"params":{"dynamic":"true","properties":{"description":{"type":"multi_field","fields":{"words":{"type":"string","index":"analyzed","index_analyzer":"index_words","search_analyzer":"search_words"},"description":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"}}},"name":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"defaultValue":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"type":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"}},"type":"nested"},"sysTags":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"_debtRemFnCoefficient":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"_debtSubChar":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"updatedAt":{"type":"date","format":"date_time"},"_debtRemFnType":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"isTemplate":{"type":"boolean"},"markdownNote":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"},"debtRemFnCoefficient":{"index":"analyzed","index_analyzer":"keyword","search_analyzer":"whitespace","type":"string"}},"_all":{"enabled":false}}'
at org.sonar.server.es.request.ProxyPutMappingRequestBuilder.get(ProxyPutMappingRequestBuilder.java:43) ~[sonar-server-5.4.jar:na]
at org.sonar.server.es.request.ProxyPutMappingRequestBuilder.get(ProxyPutMappingRequestBuilder.java:31) ~[sonar-server-5.4.jar:na]
at org.sonar.server.search.BaseIndex.initializeIndex(BaseIndex.java:176) ~[sonar-server-5.4.jar:na]
at org.sonar.server.search.BaseIndex.start(BaseIndex.java:116) ~[sonar-server-5.4.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_99]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_99]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_99]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_99]
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110) ~[picoc
There's obviously a problem here with the embedded elasticsearch but I haven't been able to figure out it out. Any ideas?
I don't know how elastic got corrupted, but wiping the contents of /var/local/sonar/data and restoring mysql fixed it.
For 3 days now, I have been trying to install glassfish 4.1 on eclipse Luna version 4.4.1. I first installed the plugin from eclipse marketplace then added it in my runtime using jdk 8. I also made jdk my default since eclipse default uses jre. I have to point out that I have been been using glassfish on netbeans and tomcat on eclipse but I decided to play around with glassfish on eclipse. Every information I got on the internet didn't fix my issue.
Below is the error I got in the console. Right now, this is driving me nuts so I have decided to come to you for direction.
Thanks
Launching GlassFish on Felix platform
ERROR: Unable to create cache directory: C:\Program Files\glassfish-4.1\glassfish\domains\domain1\osgi-cache\felix
ERROR: Error creating bundle cache. (java.lang.RuntimeException: Unable to create cache directory.)
java.lang.RuntimeException: Unable to create cache directory.
at org.apache.felix.framework.cache.BundleCache.<init>(BundleCache.java:131)
at org.apache.felix.framework.Felix.init(Felix.java:640)
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiFrameworkLauncher$1.run(OSGiFrameworkLauncher.java:88)
Exception in thread "Thread-1" java.lang.RuntimeException: org.osgi.framework.BundleException: Error creating bundle cache.
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiFrameworkLauncher$1.run(OSGiFrameworkLauncher.java:90)
Caused by: org.osgi.framework.BundleException: Error creating bundle cache.
at org.apache.felix.framework.Felix.init(Felix.java:645)
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiFrameworkLauncher$1.run(OSGiFrameworkLauncher.java:88)
Caused by: java.lang.RuntimeException: Unable to create cache directory.
at org.apache.felix.framework.cache.BundleCache.<init>(BundleCache.java:131)
at org.apache.felix.framework.Felix.init(Felix.java:640)
... 1 more
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:97)
at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:54)
Caused by: org.glassfish.embeddable.GlassFishException: java.lang.NullPointerException
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishRuntimeBuilder.build(OSGiGlassFishRuntimeBuilder.java:170)
at org.glassfish.embeddable.GlassFishRuntime._bootstrap(GlassFishRuntime.java:157)
at org.glassfish.embeddable.GlassFishRuntime.bootstrap(GlassFishRuntime.java:110)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:112)
... 6 more
Caused by: java.lang.NullPointerException
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishRuntimeBuilder.newFramework(OSGiGlassFishRuntimeBuilder.java:241)
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishRuntimeBuilder.build(OSGiGlassFishRuntimeBuilder.java:135)
... 9 more
Error stopping framework: java.lang.NullPointerException
java.lang.NullPointerException
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher$1.run(GlassFishMain.java:203)
Java HotSpot(TM) Client VM warning: ignoring option MaxPermSize=192m; support was removed in 8.0
Run Eclipse or any other IDE you use in Administrator mode.
Works for me.
I think your comment deserves to be posted as the main answer but I have been trying to mark your comment as answer but I wash't able to. So I decided to post post your comment here and then back it up with my own experience.
Answer by unwichtich:
I guess this is a similar problem. The cause may be that you have installed Glassfish in c:\Program Files. You can try to move your Glassfish installation to a directory where your normal user account has full access rights but you then have to change the path to the Glassfish installation in Eclipse.
My own experience:
Turns out that all the problems I had with the glassfish server (including exit code 1 error) was because glassfish could not handle folder names with spaces in it. So I moved the glassfish-4.1 folder from C:\Program File\glassfish-4.1.. path to C:\ glassfish-4.1.. It wiped all my tears away. This is really important in eclipse and netbeans IDEs (if you are installing the netbeans that does not come with a glassfish bundled zip).
I had the same problem and fixed it by installing Glassfish under C:\ instead of C:\Program Files. Try that.
use JDk 7 instead of JDK 8 am also faced the same issue i just changed to jdk7 its working now.