Unable to start tomcat based app with java 9 because of default "java.endorsed.dirs" option in catalina.sh.
-Djava.endorsed.dirs=/usr/local/share/tomcat/endorsed is not supported. Endorsed standards and standalone APIs in modular form will be supported via the concept of upgradeable modules.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Is there a work around for this?
You'll have to hack the script bin/catalina.sh to get this to work.
There are a bunch of lines like this in bin/catalina.sh:
exec "$_RUNJDB" "$LOGGING_CONFIG" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \
-Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
...
Just remove the second of those lines (the one with -Djava.endorsed.dirs) in each case and you should be back in business.
I'm looking at improving those scripts so that -Djava.endorsed.dirs is not provided to the JVM when the value is empty (which should be the case if you are using Java 9).
UPDATE 2017-11-06
Looks like r1810284 should fix the endorsed.dirs problem. Expect this fix to be included in Tomcat 7.0.83 (or whatever the next 7.0.x version passes voting).
UPDATE 2018-03-07
The first official release of Apache tomcat 7.0.x that includes this fix is Apache Tomcat 7.0.84, voted stable on 2018-01-24.
The above issue was fixed with the later releases of Eclipse but Unfortunately, it appeared again with the release of Java 10. Here is my research :
Initially, I installed Java 10 and Eclipse Oxygen 3 which gave me the same error you mentioned in your question. But, at the moment I installed Java 9 and pointed my Apache tomcat runtime server to it, the error was gone.
In my case, what I did to answer the problem of Tomcat not running was to set Tomcat (version 7) with a lower Java version (e.g. Java 8).
Then, in startup.sh, shutdown.sh and catalina.sh I added the following:
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`;
This symptom can come about if you have a Tomcat Runtime using a JRE earlier than Java 9 and create and run a server with that runtime. Then edit the Tomcat Runtime to use Java 9 and try to start the server. What happens is that a "-Djava.endorsed.dirs" argument gets added to the launch configuration when the server was run with the earlier JRE. When running the server after the switch to Java 9, the "-Djava.endorsed.dirs" argument is seen as a user added VM argument and kept, resulting in the error.
The simplest way to fix is to recreate the server. You can also right click on the server in the servers view and select Open. In the window that opens, click the "Open launch configuration" link at the bottom of the General section. In the dialog that opens, switch to the Arguments tab and in the "VM arguments" section, edit out the "-Djava.endorsed.dirs" argument and click OK. You should be able to start the server now.
To fix this bug, you need to install/update the Eclipse Web Tools Platform (WTP) to version 3.9.4 or later.
Select Help > Install new Software...
Select or add following URL: http://download.eclipse.org/webtools/repository/oxygen
Check Web Tools Platform (WTP) 3.9.4
Select "Next" and follow instructions
Reconfigure the tomcat in eclipse.
In Run configurations -> Arguments -> VM arguments
try removing
-Djava.endorsed.dirs="C:\Program Files\Apache Software Foundation\Tomcat 8.5\endorsed"
You have to remove -
"-Djava.endorsed.dirs="/home/ttlaptop/Downloads/apache-tomcat-7.0.105/endorsed"
from run configurations, and then tomcat will start
I can't be sure but ..
Step 1 -- >
it worked for me, I just remove servers from eclipse
Step 2 -->
restarted and add server again (tomcat 7)
Tomcat v7.0 Server at localhost
Related
Before, my IntelliJ ran well. But I used java 6 , so my project could not run with gradle.
I switched java to version 8 with the command sudo update-alternatives --config java .
I checked java -version was 1.8.0_312. It's OK, but in IntelliJ, the Java still had version 6. Then, I changed java version in IntelliJ with:
From the main menu, select Help | Find Action or press Ctrl+Shift+A.
Find and select the Choose Boot Java Runtime for the IDE action.
Select the desired runtime and click OK.
And restarted IntelliJ, which could not be opened again. I tried to remove and install it again as well as removing java and installing it again too, but neither did work.
When I run ./idea.sh, I get the following error:
OpenJDK 64-Bit Server VM warning: Archived non-system classes are disabled because the java.system.class.loader property is specified (value = "com.intellij.util.lang.PathClassLoader"). To use archived non-system classes, this property must not be set
Error: LinkageError occurred while loading main class com.intellij.idea.Main
java.lang.ExceptionInInitializerError: null
Now, I'm not even able to "change JRE in intelliJ" as suggested in the comments any more.
I've had the same issue working on windows.
When you check IntelliJ's log (idea.log file) you can find a entry for the change you've made with its 'reset' option.
For me it was: (emphasis is mine)
2022-08-08 09:47:47,906 [ 594730] WARN -
Downloader.RuntimeChooserPaths - Set custom boot runtime to:
C:\Data\Java\jdk-17.0.3.1 in the
C:\Users\username\AppData\Roaming\JetBrains\IntelliJIdea2021.3\idea64.exe.jdk.
On errors, please remove the .jdk file
You find the log files are stored at:
Linux: ~/.cache/JetBrains/IntelliJIdea2020.3/log
Windows: %LOCALAPPDATA%\JetBrains\IntelliJIdea2020.3\log
macOS: ~/Library/Logs/JetBrains/IntelliJIdea2020.3
Converting the comment by the author from May 2 at 4:22 to an answer.
The issue was resolved by changing the JRE path in this file: /.config/JetBrains/IntelliJIdea2022.1/idea.jdk
I've jdk1.8.0_171 installed on my windows 10, 64bit OS , yesterday I've downloaded Payara Micro Community 5.2020.4 and added the server on Netbeans 8.2 , but when I try to start the sever NetBeans Payara server log shows following error
Error: Could not find or load main class [9|]--add-opens=java.logging.java.util.logging=ALL-UNNAMED
Need clues to resolve this error
Thanks in advance
This is due to a change in Payara Server configuration that's not compatible with how the older version of the Netbeans Payara (GlassFish) plugin launches Payara Server. The plugin uses a hacky mechanism that reads the domain configuration and launches the Java process of Payara Server directly instead of using the asadmin launcher.
You can easily fix this by editing the domain.xml file in glassfish/domains/domain1/config/domain.xml. Just remove all jvm-option elements where you find [ and ] brackets. These define the Java version for which the JVM option is applicable. Usually this is for running on JDK 9+, so it's safe to remove those options if you run on Java 8.
So, remove this option and all similar options:
<jvm-option>[9|]--add-opens=java.logging.java.util.logging=ALL-UNNAMED</jvm-option>
Upgrading Netbeans to the latest version 12.1 also fixes this problem as Netbeans has been updated to understand this change in the configuration.
I have got a similar problem with jdk1.8.0_311 , payara-5.2021.10 on netbeans 8.2 . payara start successfully in a terminal with command :
glassfish/bin/asadmin start-domain
, but when I start the server inside netbeans, i have some errors :
Unrecognized VM option 'UseOpenJSSE'
Unrecognized VM option 'HotswapAgent=core'
Unrecognized option: -Xlog:redefine+class*=info
The solution by OndroMih works fine.
I have removed this lines in domain.xml. "glassfish/domains/domain1/config/domain.xml"
<jvm-options>[Azul-1.8.0u222|1.8.0u260]-XX:+UseOpenJSSE</jvm-options>
<jvm-options>[Dynamic Code Evolution-11.0.10|]-XX:HotswapAgent=core</jvm-options>
<jvm-options>[Dynamic Code Evolution-11.0.10|]-Xlog:redefine+class*=info</jvm-options>
now its ok
Solution to Payara 5.184 / Netbeans 8.2 / Java 8 Not launching Payara:
in file:
\payara5\glassfish\domains\domain1\config\domain.xml
Search for the unrecognized option UseOpenJSSE and comment that tag.
Repeat for each occurrence.
Repeat as well for subsequent errors might appear.
Good Luck!
I am new to Intellij ide and i'm having issues running Glassfish 5 or any previous version on Intellij 2017 2.4.
After selecting New Project > Java Enterprise > Web Application i had to specify the application server, to which i selected the folder of glassfish 5, jdk is set to 1.8 and java ee to 7. So far so good, no errors and the project gets created. Then i have a greyed "play" icon next to GlassFish 5.0.0 in the upper right of the corner that says that i have to configure it, i click Edit Configurations and the Run/Debug Configurations opens up
Everything seems fine and when i click the "play" green button to start the server and run the project i have projectName:war exploded under Deployment and
[2017-09-26 08:47:57,836] Artifact testfornew:war exploded: Waiting for server connection to start artifact deployment...
Detected server admin port: 4848
Detected server http port: 8080
Exception in thread "main" java.lang.NullPointerException
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.initializeServiceLocator(AbstractModulesRegistryImpl.java:152)
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.newServiceLocator(AbstractModulesRegistryImpl.java:144)
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.createServiceLocator(AbstractModulesRegistryImpl.java:218)
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.createServiceLocator(AbstractModulesRegistryImpl.java:224)
at com.sun.enterprise.module.single.StaticModulesRegistry.createServiceLocator(StaticModulesRegistry.java:88)
at com.sun.enterprise.admin.cli.CLIContainer.getServiceLocator(CLIContainer.java:217)
at com.sun.enterprise.admin.cli.CLIContainer.getLocalCommand(CLIContainer.java:255)
at com.sun.enterprise.admin.cli.CLICommand.getCommand(CLICommand.java:231)
at com.sun.enterprise.admin.cli.AdminMain.executeCommand(AdminMain.java:371)
at com.sun.enterprise.admin.cli.AdminMain.doMain(AdminMain.java:306)
at org.glassfish.admin.cli.AsadminMain.main(AsadminMain.java:57)
Under output. Coming from Netbeans setting glassfish up was pretty straightforward, i've checked a couple of solutions online including this but they don't seem to work for me.
I was having the same problem and I found that it is caused by an issue with the JDK software. So the NullPointerException thrown at AsadminMain.java:57 can be solved by checking your system variables (PATH, JAVA_HOME). Be sure that they reference to an acceptable JDK supported by your GlassFish version. GlassFish 5.0 is certified to work with java sdk 8u144 as mentioned HERE: https://javaee.github.io/glassfish/doc/5.0/release-notes.pdf.
Be aware, the path may also contain a reference to an old SDK directory.
If you need more help, please post the results of calling echo %PATH% on your cmd.
In my case JDK 1.8.0_152 must be installed, path and java_home variables have to be configured AND JDK 9.X must be uninstalled. Without uninstall, the error persist.
Uninstall Java 9, stay with the version 8 update 162 and the jdk8. When you unistall the Java 9 your system variables (PATH, JAVA_HOME=C:\ProgramData\Oracle\Java\javapath) will update the 3 jar (java, javaw, javaws) in this path to Java version 8.
war exploded: Waiting for server connection to start artifact deployment...
Detected server admin port: 4848
Detected server http port: 8080
....
Assuming that you are certain that JDK has set well in your environment variables and you are using jdk 8 or lower-Well I read somewhere that java9 has issues with such configurations, maybe the issue has been solve but for my case I chose to avoid for now.
Download and extract GlassFish of your version. For my case I'm
using GlassFish 5.181.O on Intellij 2018.1 ultimate version
Start Intellij, and before opening any project, or rather close all projects that are open.
Click on configure, then settings. A new window will appear as shown below. I have marked the steps you need to follow in the image. I will also add some explanation here.
Under Application Servers, click on the + shown as step 2 on the image, here you need to specify you glassfish server, the folder where you extracted to.
Next, click on + shown in step 3 on the image to add the server modules.
Assuming all is a success upto this point, select all choices of as shown in step 4 on the image, apply changes and Ok.
I will explain about creating a new project because I'm not sure how you would handle an existing project but I guess you can use concepts here to figure out what you need to tweak.Create your new java ee or whatever application you are working on,
As shown on figure 2, assuming you are creating a Java EE app, Click on Java Enterprise, then check/tick Web Application and JSF
Under libraries, use library from Glassfish ... Installation didn't help much because I got null pointer exceptions., so I used Download as shown in figure 2. Click next and finish.
Automatically you will see GlassFish added to the project, run it from the IDE.
Edit
If you had done all of the above and still get some error like Null Pointer Exceptions. Do what #Jailson Evora says: Clear your systems from java 9 and install java 8 and make sure when you issue java -version on command line, the output is java 8
I had to uninstall both jdk9 and jdk10 and set my java_home back to jdk8_181
I seem to have a 32bit vs. 64bit problem here. It should be simple to solve, but I'm hoping you can help me by pointing out the problem. I really want to avoid re-installing OSs, Eclipse, several plugins, JDKs and JREs over and over again to find a working solution. Many thanks in advance!
I build on a 64bit Thinkpad, in 64bit Windows 7.
I have built an Eclipse RCP application in Indigo (3.7.1.), 32-bit version.
The only "Javas" I have on this machine is a 1.6.29 32bit JRE, and a 1.6.29 32bit JDK. I've installed these (perhaps in false assumption) to be able to build for 32bit systems, and not screw things up by building on a 64bit machine.
Seems I was wrong: when I export the application (as Eclipse product) I get the dreaded Java exit code=13:
I am sure this is somehow to do with the combination of 32bit software on a 64bit system (if you can prove me wrong, even better!).
Does one of you know how I can set this up properly and still be able to build for win32?
Again, many thanks!
UPDATE
I have installed 64-bit Eclipse 3.7.1, and JRE 1.6_30 + JDK 1.6_30, both 64-bit versions. However, the error remains! I think this might either be a bug, or I'm doing something else wrong.
First of all, here is the error message:
For this build, I didn't use the Delta Pack but instead added the RCP SDK Software Site to the target definition, choosing the option "include all environments" (or similar).
Also in the target definition, I set the target environment to win32 (OS and WS) and x86_64 (arch). Furthermore, I set the Environment to use the default JRE.
In the product configuration, I set the Execution Environment to JavaSE 1.6, and set the JRE to be packaged.
Also, here's my eclipse.ini:
-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502
Any ideas?
I would recommend you to install everything as 64bit or 32bit system. That's a common problem with eclipse and I haven't found a better solution.
The Eclipse website tells me that
"Exit code 13 is returned from Main when it wants the launcher to display an error message. Generally, the error message will just be "an error has occurred, check your log file". Look for a log file in your configuration directory."
Some of these errors have been caused by not having the correct java version installed (Cannot run Eclipse; JVM terminated. Exit code=13), while others seem to have been caused by a "#" character in their eclipse directory (http://www.eclipsezone.com/eclipse/forums/t105198.html).
Maybe one of these reasons causes the crash.
Seems this had nothing to do with 32-bit vs. 64-bit and everything with my lack of experience. The product configuration simply wasn't set up correctly. I've bypassed this by creating a new one which uses the automatically created plugin run config from when you start the application via the "Launch an Eclipse application" link in Eclipse itself.
For those who come across a similar problem, here is how it can be done.
Launch the application via "Launch an Eclipse application"
Go to Run > Run Configurations... and memorize the name of the run configuration
Create a new Product Configuration, and choose "Use a launch configuration:" in the wizard. From the dropdown list, choose the run configuration you have memorized in step 2.
Give the new product configuration an ID, Version and Name, and add further info (e.g., in the Product Definition section) as needed.
Synchronize and Launch from within Eclipse to see if everything works fine.
Export and be happy.
Install all in 64bit.
Then to run (emulate) your Eclipse in 32bit
Just: insert an argument in:
Run Configurations... -> Arguments (tab) -> Program arguments : Type -d32
Old question but it seems worth answering. I just had this problem with an RCP based on features. It turned out that I was exporting the RCP with the feature projects closed. When I opened them and exported the product again, everything worked fine.
try moving the project to the root of the drive
c:\test\eclipse\
solved:D
1. check the operating system is it 32 bit or 64 bit.. but i think its not problem on my computer because i am using 32 bit jdk and 32 bit eclipse on my windows 7 64 bit.
2. if u still have problem ... try to move eclipse to C:/ its work for my friends.. with problem returned error 13
I installed Tomcat 6.0.18 on a windows server 2003 box and it will not start as a service.
I'm running it with jdk 1.6.0_07.
It runs when I start it with tomcat6.exe.
I got a vague error in the System Event Log on Windows.
The Apache Tomcat 6 service terminated with service-specific error 0 (0x0).
I'll bite it :-)
Tomcat Service on windows is dependent on the MS C Runtime library msvcr71.dll. As long as it is in the path, the service will start just fine.
Just to prevent your other windows to be forced to use this version of the runtime library, you might want to copy the DLL to just the tomcat bin path instead of windows\system32.
From gobaco.wordpress.com
Tomcat 6 couldn’t find a file called msvcr71.dll.
I just copied it over from
c:\windows\microsoft.net\framework\v1.1.4322
to
c:\windows\system32
and was able to start tomcat.
I thought this was very strange, so I wanted to post it on SO in case anyone else runs into this problem. If someone wants to post the same answer I'll accept it.
i follow the above guide but still the same, error 0,
my process monitor log at http://www.sendspace.com/file/t0tahr
I solved the same problem enabling the default java virtual machine in the configuration app.
Assuming you have installed tomcat using:
service install tomcat-6.0.35
execute:
tomcat6w //ES/tomcat-6.0.35
a window pops up, select the java tab and click on "Use default" checkbox.
The service install script (I immagine) selected C:\Program Files(x86)\Java\jre\bin\client\jvm.dll instead.
Environment:
Windows Server standard SP2 64-bin
Java 1.6.0_23-b05 (Java hotspot 64-bit server vm 19.0-b09 mixed mode)
Apache tomcat 6.35 (you guessed this didn't you?)
I copied the msvcr71.dll from the java home directory to the bin directory of the apache-tomcat install, and the service started after that.
Even though it's an older post, I thought I'd share the knowledge about the very same issue I had, but the workaround was different.
The Apache Tomcat 7 service terminated with service-specific error 0 (0x0).
As there was no more information regarding the problem I went back to the Tomcat Control Panel and had a look at the Java path, which was pointed to an earlier installation of Java Virtual Machine:
C:\Program Files\Java\jre6\bin\client\jvm.dll, which no longer existed, so I had to change the JRE version to jre7.
Having done that, the service started up and all running now.
Hope it'll help some of you out there.