Does JSP in Google AppEngine support JDK1.8 - java

I have an app engine project in Eclipse. I have kept a JSP file in WAR folder. I have given the path in the installed jre as JDK1.8. Now when I run the project in local the JSP file successfully loads after clicking on a hyperlink. The same project after deployed to Google App Engine fails to load. It shows server error.
What I thought as the possible cause: I read some where that Google AppEngine now supports JAVA 7. So when I compile the JSP file in JDK1.8 in local it worked fine. But the problem occurred when I deployed the project in cloud. I think, it could not compile JSP files.
Please suggest me what you think ? Is it because of same cause ?

As per the documentation available, "App Engine runs your Java web application using a Java 7 JVM in a safe "sandboxed" environment.". So that is as far as the runtime is concerned. It does have a backward compatibility for Java 6 applications for now.
However, keep in mind that the App Engine SDK now supports only Java 7. And ideally I would not go with JDK 8, where things are still in the works.
Behind the scenes, when you upload your application to App Engine, they know which Java runtime to use based on the SDK JAR that you have linked. So ideally, that is taken care of for you.
So, I still believe that though you have provided JDK 1.8 locally, the App Engine version JAR will be enough for Google to deploy your application in an appropriate Java 7 JVM and things should have worked if it is just a simple JSP that you are trying to link up.
Since you have not given details on what the JSP does, it would be good to know that since that could give some pointers. Additionally, I suggest that you allow for DEBUG logs and visit the Admin Console logs to understand what is going wrong. That will give you more details.

I had exactly this problem; including even one JSP file, even with no Java code or any content at all, would prevent my appengine instance from starting.
The solution was to make sure you start Eclipse using the 1.7 VM, even if you're developing against the 1.8 JDK. Because my Eclipse instance was running in the 1.8 VM, the generated JSP files were incompatible with AppEngine.
You change the host VM in the eclipse.ini as shown here: Google App Engine JSP can't deploy: java.lang.RuntimeException: Cannot get the System Java Compiler. Please use a JDK, not a JRE

Related

Java Class files in tomcat not linking/updating when using eclipse

I am working on an old jsp project. I have to modify it so that I can use it to meet my needs. I was facing issue while using any newer version of tomcat or java sdk. Therefore, I am using Tomcat 5.5.7 and java SDK 1.5. I have updated java class files of this project using eclipse helios (2012). But the implementation don't show up in my project. Like when I change the database name and run the project it still wants to use the old database name. I have tried to upgrade the whole project to a new version of tomcat and java sdk but it doesn't work. Can anyone help me with this?
Steps you need to take -
Import the project into eclipse - Create a new project, import using existing source files.
You need to setup the Java Facet of "Dynamic Web Application" along with some other Facets to make this application run successfully on the tomcat container inside of eclipse.
You need to install the server tools in eclipse. Using the Java EE perspective is very helpful.
When making changes to the JDK or the server runtime, as you mentioned, you will need to update the projects build path. Right click on the root of your project and go to the build path. Change the SDK version, change the runtime version of tomcat that is included with it. You will need to create a new Java Server runtime for any other versions of Tomcat you want to add to the project.
This is a complicated issue, and there is no specific answer, as your question is very broad. I would recommend watching some tutorials on "How to setup Web application projects in Eclipse." Maybe add Java 5 or 6 to the search to get older results.

Cannot configure Apache Tomcat 9 with JDK 10.0.1 in Eclipse Oxygen

This is my first problem here, I look forward to have a great interaction.
Please help me I have to show this working to my mentor tomorrow.
I was making a Dynamic web project file in eclipse oxygen that needed tomcat server to launch. I have JDK 10.0.1 as my Java version. also it was showing JAVA SE 10 at some places. So when I tried to add Tomcat 8 and 9 either of them, there was an error
-Djava.endorsed.dirs=C:...apache-tomcat-9.0.14\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.
I searched it on stackoverflow and got this link
How do you replace endorsed directory in Java 9?. but somehow I do not know how to do it.
One solution I thought of downloading lower version of JDK and then trying to make it possible.
Please help me community if there is a way to do so.
Thanks.

Java 8 + JavaFX on macOS: "ERROR: JavaFX runtime components are missing, and are required to run this application."

My JavaFX application works perfectly on Windows, where I have Java 1.8.0_221. The application is a fat jar with jfxrt.jar included in the jar, so all JavaFX libraries should be inside there.
However, when I try to run the same jar on macOS (still Java 8), it's not able to launch, and I'm greeted with the following error message: Error: JavaFX runtime components are missing, and are required to run this application.
What can I do to fix this? Why is it behaving differently between the operating systems? Thank you so much for your help!
Note: I realize that other users have asked about this error message in the past, but the error I have is on Java 8 and is not connected to Java 11/OpenJFX 11 - hence, I believe that the causes are different and this shouldn't be marked as a duplicate.
I don't know how you back your assumption but I'd say most user nowadays do not have Java installed at all anymore. The modern trend is to bundle Java with the application so that you can distribute it like any other application and then it does not make any sense anymore to stick with an outdated version of Java. See here https://github.com/dlemmermann/JPackageScriptFX how that can be done.

java.lang.NoClassDefFoundError: javax/activation/DataContentHandler

I'am developing a webapp using google app engine and maven in intelliJ IDEA.
So far so good until I tried to send an email using javax.mail and I get this error:
java.lang.NoClassDefFoundError: javax/activation/DataContentHandler
I have already put the dependencies needed (javax.activation & javax.mail) in the pom.xml and still this error occurs.
One way to fix it locally is to add "--add-modules java.activation" in vm options and when i run it locally its working fine and sending the email, but when I'am deploying the app its not working.
And my question is,
is there any way to pass the vm argument to maven or anywhere else so it will run without the error when I'll deploy the app.
Or is there any other way to do this (with javax.mail or not) ?
My java version is: openjdk 10.0.2
Just include the java.activation module in your application.
You can use either the older Oracle version, or the newer Eclipse version, which is essentially the same.
(And you should consider upgrading to JDK 11.)
You could do that with docker containers.
How to properly set the JVM options in a flexible GAE application
Cause with maven you can not set the VM options for run time. Trying via docker could be key.

does sysdeo tomcat plugin for eclipse add value to helios?

am developing a simple web app using jsps and servlets for tomcat 5.5.
Currently using the Eclipse Helios and Dynamic Web Application Project.
For some reason it is a nightmare. We spent 4 hours today trying to deploy a servlet to tomcat. We kept getting errors like
"java.lang.UnsupportedClassVersionError: Bad version number in .class file"
we played around with everything trying to set the build compatibility to what tomcat had but couldn't make the stupid thing work. (Yes it is possible we're incompetent. any suggestions on what we can try looking at are apprecieated)
My friend recalls from long time ago that he used this plugin
eclipsetotale_tomcatPlugin
in order to create a "tomcat project". My question is, does sysdeo tomcat plugin add any features that aren't already available in helios?
thanks
Not sure about sysdeo, but your error seems similar to bug 116713:
If your default JRE is set to 1.4.2 and you have a Web project targetting
Tomcat 5.5 (dynamic Web module version 2.4 and Java 5.0), when you tried to run
a main program, you'll get the error (you mention).
What is your default JRE set for your project?
This scenario happens when the JVM running the code is older than the one the compiler generated code for.
Have you considered simply running Tomcat under Java 6? If that is not an option, please edit your question to include this and any other restrictions on this project.
We used to get that error often when we had Java version issues. Eclipse environment and Windows environment (java_home and path variables typically) are easy to overlook.
Also, you can use javap -v Foo in same directory as Foo.class to find out its version.
Just use the Eclipse IDE for Java EE Developers, 206 MB edition of Eclipse. It has Tomcat and other webserver support built-in by default. Works like a charm!
Sysdeo is an old, as far as I know obsolete, plugin.

Categories