jackrabbit - There is an error in invoking javac. A full JDK (not just JRE) is required - jcr

I'm learning Jackrabbit and following the documentation to run a standalone server. When I run the command java -jar jackrabbit-standalone-2.16.2.jar and access localhost:8080 on my browser, I get a 500 error saying:
org.apache.jasper.JasperException: PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required
What am I doing wrong?
Note: I have set my jdk/bin path in my environment variables.Also, my javac command is working properly. I've jdk version 1.8.0_74 and Jackrabbit version 2.16.2
Edit: According to this answer, I tried setting my jdk to my installed jres in eclipse but that didn't solve my problem.

Running the latest jackarabit standalone jar(2.17.3) in my machine(windows 10 and java home pointing in java8 jdk) produced the same errors.
I then executed the rar with java -Djava.home="%JAVA_HOME%" -jar jackrabbit-standalone-2.17.3.jar. Although I got the same error in browser I was able to see errors in the console where I invoked the running command.
One of these error was
can't open C:\Progra~1\Java\jdk1.8.0_144\lib\tzmappings.
Searching my java installation I found that the missing files, are located under jre's installation folder.
So I eventually made the standalone jar to work with:
java -Djava.home="%JAVA_HOME%\jre" -jar jackrabbit-standalone-2.17.3.jar
The initial error is a bit misleading as it refers to javac and not to the missing files.
The whole thing seems to be a bug for me. Please give a try to my workaround and if it works for you consider filing a bug in Jackrabbit's issue tracker platform.

jackrabbit-standalone uses JSP. JSP needs compilation. Compilation needs JDK.
Before running java -jar jackrabbit-standalone-2.16.2.jar do you check your JAVA_HOME, and make sure it refers to a fully-fledged JDK? In short, the bin directory should have javac.

I found that there was another variable in the Path environment System variable preceding my %JAVA_HOME%\bin variable.
You don't have to delete the other variable, but move it down (or move %JAVA_HOME\bin up) to correct the load order.

Related

Payara does not start from Intellij

The Payara with GlassFish 5.192.0 does not start using the Intellij Idea.
If I run payara\bin\asadmin start-domain is works just fine, and the server starts and runs.
These are the final lines from the console output with the --verbose property set on true.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Unrecognized option: --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED
Command start-domain failed.
The DAS was stopped.
The root case of the issue is logged here.
Windows launcher prepends PATH with JetBrains Runtime bin directory in order to load certain DLLs without issues. It turned out to be not the best solution and we are working to address it in a different way.
asadmin.bat uses the first java.exe from PATH. It doesn't try to detect it via JAVA_HOME.
The workaround for now is to switch IntelliJ IDEA boot JDK to JBR8 per this document or start IntelliJ IDEA using idea.bat instead of idea64.exe.
The issue is fixed in 2019.2.1 RC.

Installation of Pentaho-Data integration

After extracting the Pentaho zip file I downloaded. I set my class path to JDK 1.7.0. But, upon running the Spoon.bat file I keep getting the statement: "Unable to launch your Java Virtual Machine (JVM)." How do I resolve this problem ?
NB: I have configured JAVA_HOME, JRE_HOME as stated by similar previously answered questions.
Note that Pentaho7 requires java 8.
In any case, Set the PENTAHO_JAVA_HOME=dir, where dir is the directory that contains the /bin/java.exe executable.
Alternative:
The spoon.bat [resp spoon.sh] runs first the set-pentaho-env.bat to find a suitable java. Edit this file to know in which order it searches for it. So do like me, when nobody looks at you, edit this file manually, and set _PENTAHO_JAVA_HOME and _PENTAHO_JAVA manually.
To check: In a command line shell, cd to your PDI install directory and type spoon.bat. It writes something like start "Spoon" "**some\directory**\javaw.exe" more stuff. Check that you can type **some\directory**\javaw.exe -version in your shell.
If not: in the same directory, type set-pentaho-env.bat. It writes down the PENTAHO_JAVA and PENATHO_JAVA_HOME thAt spoon will use. Edit that file until %PENTAHO_JAVA%\java.exe -version and %PENTAHO_JAVA_HOME%\java.exe -version answers the appropriate version.
In my case (for PDI 9.2.x), installing an Oracle JDK 8 solved the issue (no need to set the Java home folder explicitly)

commandline tool Glassfish appclient doesn't see deployed EJB

I'm working my way through a book about "Java EE 7 for Glassfish", with the server installed on Fedora Linux.
I have a simple stateless session bean SimpleSessionBean deployed on the server and I am trying to approach that SimpleSessionBean via SessionBeanClient and the Glassfish command line tool appclient, running a client jar. Everything from the book, so it should work. The client however can't find SimpleSessionBean. Apparently a class path issue. In the server logs nothing happened.
I can't find any pointers how Glassfish should be properly installed. Everything works within the server. I can approach installed war files from facelets running in a browser.
It is probably a matter of setting $PATH right or something or some other environment variable. Any pointers to relevant literature?
Thanks in advance for any suggestions!
UPDATE1: error message
From the bash terminal window where I run appclient:
[fedora#localhost bin]$ ./appclient -client /home/fedora/Downloads/6886EN_04_Code/ch04_src/simplesessionbeanclient/target/simplesessionbeanclient.jar
Jul 06, 2017 12:52:57 PM org.glassfish.apf.impl.DefaultErrorHandler error
SEVERE: Class [ Lnet/ensode/glassfishbook/SimpleSession; ] not found.
Error while loading [ class net.ensode.glassfishbook.SessionBeanClient ]
Exception in thread "main" java.lang.NoClassDefFoundError: net/ensode/glassfishbook/SimpleSession
at net.ensode.glassfishbook.SessionBeanClient.invokeSessionBeanMethods(SessionBeanClient.java:12)
at net.ensode.glassfishbook.SessionBeanClient.main(SessionBeanClient.java:19)
Caused by: java.lang.ClassNotFoundException: net.ensode.glassfishbook.SimpleSession
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at org.glassfish.appclient.client.acc.ACCClassLoader.findClass(ACCClassLoader.java:237)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
UPDATE2: From the Glassfish book:
We are using Maven to build our code. For this example, we used
the Maven Assembly plugin (http://maven.apache.org/plugins/maven-assembly-plugin/) to build a client JAR file
that includes all dependencies; this frees us from having to specify
all the dependent JAR files in the -classpath command-line option
of the appclient utility. To build this JAR file, simply invoke mvn
assembly:assembly from the command line.
SOLUTION: the missing link was producing a client jar with additional jar's "on board" so to speak. Proceed as follows (at least in Eclipse): select pom.xml > right-click > Run As > Maven build... > enter in Goals field: assembly:assembly> Apply/Run.
The result will be that you will find TWO jars under your target folder: xxxclient.jar and xxxclient-jar-with-dependencies.jar.
From the command line in bash execute from the folder with latter jar:
/path_to/appclient -client xxxclient-jar-with-dependencies.jar
After a very long wait (on my $200 mini Linux box) the HelloWorld-ish server EJB gets finally properly called.
Your assumption is right.
You are missing net.ensode.glassfishbook.SimpleSession in your classpath.
From an older book online:
...executed through the appclient utility. This utility can be found at
[glassfish installation directory]/glassfish/bin/. Assuming this path
is in the PATH environment variable, and assuming we placed our client
code in a JAR file called simplesessionbeanclient.jar, we would
execute the above client code by typing the following command in the
command line:
appclient -client simplesessionbeanclient.jar
It seems that you've started from
.../bin/./appclient -client
/home/fedora/Downloads/6886EN_04_Code/ch04_src/simplesessionbeanclient/target/simplesessionbeanclient.jar
You need SimpleSession.class in your CLASSPATH (or in a jar in that classpath).
Usually java checks the current directory first (which is your bin folder). If the class is not found (its not, since its in your simplesessionbeanclient folder), it searches for that class in the classpath (where you did not add the simplesessionbeanclient folder).
Try
appclient -client simplesessionbeanclient.jar
from the folder where simplesessionbeanclient.jar is located.
If you don't want to add the appclient folder to your path start with
/your/path/to/appclient -client simplesessionbeanclient.jar
(again from the folder where simplesessionbeanclient.jar is located)
Update:
If you still get a ClassNotFoundException have a look if it is missing in your jar file (jars are Zip-File, you could use your Zip-Tools):
jar tf simplesessionbeanclient.jar
if there is a SimpleSession.class
I did the following to fix my problem:
Use appclient -classpath (instead of appclient -client)
Use the regular project JARs (instead of the one generated by mvn assembly:assembly)
Deploy the EJB to Glassfish (simplesessionbean.jar)
The example code from a more recent book "Java EE 8 Application Development" by David R. Heffelfinger (the same author of "Java EE 7 for Glassfish") is almost exactly the same (the only minor difference is classes are packaged in "net.ensode.javaee8book" instead of "net.ensode.glassfishbook").
When running appclient.bat -client simplesessionbeanclient-jar-with-dependencies.jar I kept getting:
java.lang.ClassNotFoundException: <mainclass>
errors. This was because the POM was assembling a manifest with <mainClass> value of "net.ensode.glassfishbook.SessionBeanClient" (instead of "net.ensode.javaee8book.SessionBeanClient"). So I decided to avoid using the -client option for appclient.bat and switched to -classpath which allowed me to specify the main class on the command line (which is easier than updating the POM or refactoring the packages to suit the manifest).
But then when running the appclient command:
PS C:\home\programs\java_ee_sdk-8u1\glassfish5\glassfish\bin> .\appclient.bat -classpath "C:\home\code\Java-EE-8-Application-Development-Code-Samples-master\ch04_src\simplesessionbean\target\simplesessionbean.jar;C:\home\code\Java-EE-8-Application-Development-Code-Samples-master\ch04_src\simplesessionbeanclient\target\simplesessionbeanclient.jar" net.ensode.javaee8book.SessionBeanClient
I kept getting:
Root exception is javax.naming.NameNotFoundException: net.ensode.javaee8book.SimpleSession#net.ensode.javaee8book.SimpleSession not found]]
errors. This was solved by deploying the EJB (simplesessionbean.jar) to Glassfish via the Admin Console (this missing step was not mentioned in the book). Running the appclient.bat command then worked.
Screenshot of appclient.bat (takes about 15 seconds to load):
Screenshot of EJB deployment:
Alternatively
You can manually compile the client to include all the dependencies by copying SimpleSession.java and SimpleSessionBean.java from the "simplesessionbean" project to the "simplesessionbeanclient" project (remember to refactor the package statements). This will generate simplesessionbeanclient.jar with the EJBs included (Nb: you still have to deploy the EJBs to the GlassFish server). Also make sure that the <mainClass> element in the POM points to the correct package.
You can now use the -client option:

Glassfish 3.1.2.2 in IDEA 11.1.4: "PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required"

I am trying to get our Mavenized web application up and running in a freshly installed IDEA 11.1.4 Ultimate (Windows 7) under a freshly unzipped Glassfish 3.1.2.2. I have done this many times in Eclipse, but am not familiar with IDEA.
I can build and deploy it just fine, but when I try to access pages with JSP-content I get:
PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required
The Glassfish Application Servers entry adds the javax.ejb.jar, javax.servlet-api.jar and javax.servlet.jsp-api.jar as libraries.
I have set the project SDK to point to a full JDK resulting in:
(which does not seem to include a jar with javac)
The IntelliJ tutorials I've found so far, does not mention this problem. My guess would be that the "please start using this JDK" information is not passed on to Glassfish, so it just picks up the system JRE.
What configuration step have I missed? I do not want to edit configuration files - I expect the IntelliJ plugin to do this if I know how to tell it to.
I got the same notification and just changed in admin port -> Configurations -> server-config -> JVM Settings -> Java Home as "C:\Program Files\Java\jdk1.8.0_72", and it started working.
PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required.
I was getting same error after restarting my glassfish 4 server.When I am trying to access my deployed application it was saying to mention full JDK.
login to Glassfish admin console.(http://localhost:4848).
Go to Configuration---->server-config--->JVM Settings
Set the java home with your correct jdk home (ex:C:\Program Files (x86)\Java\jdk1.8.0_121).
Restart the server.
It will work fine.
Next solution helped me
source: http://alvinalexander.com/blog/post/java/fixing-glassfish-jdk-path-problem-solved
Find your asenv.bat file. C:\Program Files\glassfish-4.0\glassfish\config\asenv.bat
Open it in text editor and find strings like "set AS_ = blahblah"
Add this string there "set AS_JAVA=C:\Program Files\Java\jdk1.7.0_60" (print your own JDK path here). If string "set AS_JAVA= blahblah" already exists then just fix the path.
Add JDK_HOME\lib\tools.jar file to the JDK configuration Classpath.
However, the problem in your case may be different as Glassfish JDK is not taken from IntelliJ IDEA settings, this question may help:
How do I specify the jdk for a glassfish domain?

Jdeveloper - Unrecognized option: -jrockit

Every time I try to run a weblogic webcenter application on Jdev I get the following error and I cant find any reference on how to fix this anywhere on the web.
starting weblogic with Java version: Could not create the Java virtual
machine. Unrecognized option: -jrockit
Try modifying the startWebLogic.cmd file (WIN7)
c:\users\{user}\AppData\Roaming\JDeveloper\system{version}\DefaultDomain\bin\startWebLogic.cmd
to contain
set JAVA_VM=-server
set MEM_ARGS=-Xms512m -Xmx1024m -XX:MaxPermSize=512m
Jdeveloper 11g do not support jdk 1.7
https://forums.oracle.com/thread/2482850
I fixed it by add to top of c:\users{user}\AppData\Roaming\JDeveloper\system{version}\DefaultDomain\bin\setDomainEnv.cmd:
set SUN_JAVA_HOME=E:\Oracle\Java\jdk1.6.0_37
set JAVA_VENDOR=Sun
In OSX, look for the this folder /Users/{USERNAME}/.jdeveloper/system{VERSION}/DefaultDomain/bin
Edit the file setDomainEnv.sh and look for SUN_JAVA_HOME and make sure the value is the same value as your JAVA_HOME, i.e. /Library/Java/JavaVirtualMachines/jdk${JDK_VERSION}.jdk/Contents/Home, by default it seems it is set to an empty string "".
Edit the file startWebLogic.sh and add the following before setDomainEnv.sh is called.
JAVA_VENDOR=Sun
You can test it out by running sh ./startWebLogic.sh, if it runs with -jrockit error, then all is good :)
I've also tested with Java JDK 1.7 and it seems to work.
The reason is, that older Weblogic Versions use the Java VM "JRockit"
http://www.oracle.com/technetwork/middleware/jrockit/overview/index.html
The JRockit VM is no longer supported in Java 7 or higher.
All of the other solutions here seem to be hacks and none of them helped me.
I had the same Problem with a Weblogic 10.3.5 and I found out, the installation was incorrect.
The Problem is, that there is no java version check in the installer, so if you don't know that you can't use Java 7 or higher you are screwed.
These steps fixed it for me:
You need to make sure you have Java 6 or lower installed.
Reinstall the Weblogic and make sure to specify the correct JDK