How to deploy war in wild fly server? - java

we are using one java application in wildfly server which uses java 1.8.0_202, now we want to migrate the java from oracle jdk to adoptopenjdk. I changed the path of new openjdk in management console of wildfly server.
Now the question is do we need again rebuild the application using adoptopenjdk or can i use the old war which is deployed.
Thanks in advance!..

As I cannot comment because of lack of reputation as an answer:
Normally you can run a Java Application without knowledge of the Java it was built with if the versions match. Second: Why don't you just try it? If you have these strong concerns you should try it in a test environment.

You should not need to do anything to migrate from an Oracle JDK to OpenJDK. Just change the path to the JAVA_HOME and that's it. The only possible issues would be if you use Oracle specific API's which one should not be doing anyway :)

Related

Running spring boot application in a different jdk version

I have an application running on jdk7 and jboss and i would like to extract all the batch code from it to make it cleaner.
I want to create executable spring boot 2 jars and run them separately or at least upgrade to spring boot and the jdk version to 8.
Is it possible to run a spring boot 2 application that requires jdk 8 on a machine that also runs a jboss application on jdk 7 ? how can I specify the jdk version at runtime for an executable jar or war ?
I would like to use a container to solve this but our production team doesn't want that right now. I know there is "setenv" in a tomcat or weblogic servers but i would like to know if there is a spring boot solution for that (I didn't find any)
Thank you in advance.
You can have as many JVMs as you like on your machine. you just need to have the settings for the java version you need to be loaded.
ie if your java 8 is in c:\programs\java\jdk8\bin and your java 7 is in c:\programs\java\jdk7\bin, then you need to specify the java.exe absolutely as in c:\programs\java\jdk8\bin\java.exe you also need to set the environment variables for that session, like set JAVA_HOME=c:\programs\java\jdk8\bin\.
My example is using a windows machine as a base. You will need a startup script, or similar for the environment that you are using.
Note that if you just use java.exe in your startup script, then the JVM will be started with the first JVM found in your %PATH%, so you may want to remove Java from the path to be sure that you are getting the exact version you require.

Compile without IBM WAS 7 installed

We are using IBM WAS 7 as the server for our application. But the organization's rules do not allow us to have servers installed in workstations. I have this J2EE web project that uses WAS 7 as the target server runtime.
At first, I installed WebSphere® Application Server V7.0 tools for Eclipse. I thought it will provide the runtime along with it as well. Now I can see the option of WAS 7 in server runtime, but on selecting it I have to provide the path where WAS 7 is installed. And I don't have that.
Can I use any other server runtime and expect that it will work within WAS 7? If not, is there any way to just get the runtime without installing the server?
If you are using fully standard Java EE APIs (and no special WebSphere classes), you can simply add the Java EE API jars to your project classpath.
Since WebSphere 7 is Java EE 5 compliant, you could go to maven and download the Java EE 5 API jar and add it to your classpath. This will allow you to compile your code in eclipse.
If you need some WebSphere specific APIs, then you need to tell your development organization that you need to have access to the Jars somehow so that you can compile your code against them. Have your legal team investigate if you can distribute the WebSphere jars to developers for compiling purposes.
Another option is downloading WebSphere Liberty (which is free for development useage) and using Liberty to compile and run your code locally. Note that you will have to install a really old version of Liberty to have it match up with the Java EE 5 WebSphere version 7 (currently Liberty is EE 7 compliant).
Disclaimer: I am a developer for both WebSphere Traditional and WebSphere Liberty. The reason I am suggesting Liberty instead of other app servers is because the askers org is ultimately using WebSphere Traditional, and Liberty will have the closest match in behavior.
It depends a little on the meaning "But the organization's rules do not allow us to have servers installed in workstations".
Often this is due to licencing constraints, in which case you can install an open-source J2EE server like Tomcat or JBOSS. So long as your apps do not call IBM-specific libraries, the same binary should run on any of these environments.

Jetty IllegalArgumentException when using 1.9.30 GAE

I've been on a very old version of GAE for a long time. Every time I try to update to the latest version I get this error when deploying it to GCP:
java.lang.IllegalArgumentException: Class file is Java 8 but max supported is
Java 7: org/eclipse/jetty/http/BadMessageException.class in C:\Users\XXXXXXXXXXX\
backendservlet\build\exploded-app\WEB-
INF\lib\jetty-http-9.3.2.v20150730.jar
I think jetty comes with GAE so how do I fix this? When I deploy it locally it runs without errors. It also builds without error. This only happens when deploying to GCP.
My appengine instance is on JAVA 7 runtime so maybe that's the issue? How do I change that? I tried deplying with a different version and name and it still didn't work.
Please help.
Looks like jetty (or at least the version you're using) needs Java 8, which is not supported on GAE: Does Google App Engine support Java 8?.
GAE does not yet support Java 8. If jetty is a dependency of your project, you need to use a version that has source 1.7. Otherwise delete C:\Users\XXXXXXXXXXX\
backendservlet\build\exploded-app\WEB-
INF\lib\jetty-http-9.3.2.v20150730.jar

change the tomcat version 5.5.26 to 6.0.29?

Currently my server is running of the Tomcat 5.5.26 and JDK 1.5.15.
Now I want to change to tomcat 6.0.29 and JDK 1.6.29.
There was many application running of the current environment so if I can change to new environment the required to compile all the application again and upload on the new environment or existing war file is working with new environment?
The applications should just work. However, you should do thorough testing of each one before inflicting them on your users, just to make sure. Your apps may be unintentionally relying on Tomcat 5-specific behaviour.
Furthermore, there should be no need to recompile under java 6 to make them work. However, you should check that the apps do still compile under Java 6. Again, they should, but it's worth checking.
Incidentally, why Tomcat 6? Tomcat 7 is current stable version of Tomcat; if you're going to migrate, you should migrate to that.

Missing javax.servlet.http.Cookie class

I haven't been using Java extensively hence forget a lot fundamental things. Basically, I am working with a web-dynamic project (using Eclipse IDE with jdk 1.6), and during the build, I get errors that Cookie class and other web related classes cannot be found. What am I missing?
What Jars files do I need to add (and how)?
thanks
Think you need servlet-api.jar
Try here for any jar files you need http://www.java2s.com/Code/Jar/CatalogJar.htm
Sounds like you are missing servlet-api.jar
You can download it from the Maven repository.
Servlets are only part of the Enterprise Edition, not of the Standard Edition of Java. So you need the Java Enterprise Edition, AKA Java EE.
http://java.sun.com/javaee/
As others have said, you're missing the server api jar.
Having said that, downloading just the servlet api jar and not the server that goes with it means that you can't actually test your code.
In Eclipse, once you're installed a servlet container, such as Sun's Glassfish, Apache Tomcat, or Jetty, you can create a server instance of it so that Eclipse will compile against your server's servlet implementation. Creating a server instance also means that Eclipse's Run on Server command works.
IBM has a slightly outdated guide on Developing Web applications with Tomcat and Eclipse. The entire "Install the Web tools" section can be skipped if you have the Eclipse EE version, as Web Tools are already installed.

Categories

Resources