Migrating MobileFirst 7.0 to 8.0 - server classes - java

I executing migration from a mobilefirst 7.0 project to mobilefirst 8.0
In 7.0 project there are some java files that does not belong to Adapters, but to server (utils and constant classes, for example).
Checking official documentation for migration purposes, I have not beenable to find anything about how to manage these kind of files.
Anyone could provide me some information about how to migrate this logic?

With MFP 8.0, the concept of packaging custom Java classes within the runtime war file does not exist.
However, you can still use the custom Java classes:
For the custom Java classes that would become your CustomLoginModule/Authenticator:
With MFP 8.0, customLoginModules and authenticators are replaced by SecurityCheck adapters. These are maven projects. The validation and code that was in your custom classes can be in your SecurityCheck adapter project.
Details here.
For custom Java classes that are invoked from Javascript adapters:
Javascript adapters are also maven projects. And the custom classes can be a part of the JS adapter project.
Details here.
Any other common / utility classes/jar files:
Add any JAR files that are not in the Maven repository:
Add the JAR files to a local repository, as described in Guide to installing third-party JARs, then add them to dependencies element.
Add the JAR files to the dependencies element by using the systemPath element. For more information, see Introduction to the Dependency Mechanism.
More reading about migrating adapters from earlier versions to MFP 8.0.

We had similar issue but we tackled it by moving the code to Javascript adapters(incase of static values). But in case of Pure Java code you have to use Java adapter because in MFP 8 we cannot put java files in the servers as the concept of WAR deployment is not there.

Related

Migrating App Engine Backend services from java 7 runtime to java 8 runtime

I have a project that uses both frontend and backend instances, in java 7 runtime environment, using app engine (https://cloud.google.com/appengine/docs/standard/java/modules/converting)
We now want to migrate to java 8 runtime, however I can't find a way to migrate the backend module/services in this environment.
Because the EAR based structure is not supported in java 8 as mentioned in the first paragraph on the following link https://cloud.google.com/appengine/docs/standard/java/configuration-files
Please help me with finding a way to achieve backend services/module in app engine java 8 runtime.
Any reference material or samples which can guide me to the right direction?
The Cloud SDK-based plugin supports multiple services without requiring EAR packaging, and it is part of the process to migrate from Java7 to Java8, you will have to make some changes for Maven and the Gradle for Java8
For Maven, you will first need to add the new plugin on your pom.xml, and second, update your application.xml if you were using an EAR based multi service configuration
For Gradle, you will add the new plugin to your classpath under dependencies in your build.gradle file, and you will also have to update your run.services file so that you can point to your default, secondary services.

File upload handling with Jersey, Glassfish 4 and Netbeans for non Maven project

I'm having trouble in implementing file upload handling with Jersey, Glassfish 4 and Netbeans. I know there are a lot of tutorials out there but all of them use maven projects.
Like we know that in Netbeans web application project, after we choose Glassfish as the server, we can use all of the JEE API cause automatically Netbeans add JEE API from Glassfish to our library (like in the picture below). I think its only for compiling and not included in the deployed war.
We can even make a new non web Java application and use JEE API by adding Java EE 7 API to our library, its just API for compiling, in the runtime all of the classes are provided by the server (like in the second picture ).
Now, I want to use the Jersey Multipart API for handling file upload. Glassfish already has the required jars in its modules folder, like jersey-media-multipart. (3rd picture), I know that they are provided in the runtime but I need them to compile my project. Simply adding the jars to the project library is not a proper way cause it gives me a lot of weird errors and we know we shouldn't cause Glassfish already provides them.
I need something like Jersey Multipart API to compile the project so that in the runtime the project uses all of the classes that Glassfish already provides. Just like the Java EE 7 API Library that Netbeans provides and work well.
Well, here's the solution...
If you only add the jersey-media-multipart, you'll get error HttpReader not found so you need to aadd all of the jersey jars in the glassfish modules.
Next, right click on the libraries folder in the netbeans project and in the compile tab, uncheck all of the jersey jars in the package column to make them get excluded when we build/ run the project .
Hope this helps anyone who have similar issue.

What is grails wrapper directory for?

I created an app using create-app with Grails 2.3.7, I noticed there is a wrapper directory with jars inside.
Isn't the dependecies are handled by maven(.m2) or ivy?
What is it for? Why is it located inside the grails application and should I include it under version control?
Grails Wrapper
The Grails Wrapper allows a Grails application to build without having to install Grails and configure a GRAILS_HOME environment variable. The wrapper includes a small shell script and a couple of small bootstrap jar files that typically would be checked in to source code control along with the rest of the project.
The first time the wrapper is executed it will download and configure a Grails installation. This wrapper makes it more simple to setup a development environment, configure CI and manage upgrades to future versions of Grails. When the application is upgraded to the next version of Grails, the wrapper is updated and checked in to the source code control system and the next time developers update their workspace and run the wrapper, they will automatically be using the correct version of Grails.Taken from
See the Wrapper Documentation for more details.
And see this link
But on Grails 2.3.7 there is no shell script for wrapper is described above , but the jar that need to run GRAILS without installing are insalled by default
asm-3.2.jar
asm-tree-3.2.jar
grails-wrapper-runtime-2.3.7.jar
grails-wrapper.properties
springloaded-1.1.5.RELEASE.jar

Google Apps Marketplace JAR and GAE

When you use the Google-Eclipse plugin to create a new Web Application Project, and you select the option to "Add support for listing on Google Apps Marketplace", the plugin automatically adds an apps-marketplace.jar file on your classpath.
Does this - at any point in time, for any reason - ever need to be bundled with your WAR? I ask because it contains a bundled version of SLF4J that is causing JAR hell issues with other dependencies that use a different version of SLF4J.
I bundled it into my WAR because I thought it was necessary, but if its something that is just used by the plugin, or is perhaps available as some service to GAE apps when they're running in production, then I don't need it and would like to remove it as a dependency. Thanks in advance.
This jar is not needed. You can remove it from your build path and your WAR directory. We need to fix the plugin so that it gets rid of this jar.
I have a feeling it was first added in to make it easy to access certain Google APIs from your Marketplace app. It included a bunch of classes for handling OAuth. However, I think that all of the classes in here are basically deprecated, and there are better ways to make these Api calls now.

How to list provided libraries and their versions in Glassfish 3?

I'm failing to list Java libraries that Glassfish 3.1.2.2 provides for applications run in domain. What I want is listing of libraries and their versions, so that I can configure provided scope for those libraries (that I use) in Maven POM.
I've tried:
Checking the libraries through filesystem under GLASSFISH_HOME/modules but the filenames don't have version numbers
asadmin list-libraries command, but it only lists libraries that are bundled inside domain
pkg tool, but it doesn't provide comprehensive enough listing (it abstracts libraries' details behind alternative names and versions).
Adding Glassfish as "Server" for the project in Eclipse, but it doesn't tell library versions either, and the selection of libraries it offers might not actually reflect reality. This is mostly gut feeling.
Checking the READMEs as in http://www.oracle.com/technetwork/middleware/glassfish/downloads/glassfish-312-3rdparty-readme-1521433.html but it contains also non-Java libraries and I don't think the file is meant for what I'm doing.
How can I list names and versions of those libraries that are provided by Glassfish for the (web) applications deployed in a Glassfish domain?
There is no point in adding your libraries that Glassfish uses in your Maven dependencies; so long as you have the API to them Glassfish comes with the implementation when your application is deployed.
However you can use the whole Glassfish server as a library in your application without the need of installing Glassfish and deploying your application. You can see more details about Embedded Glassfish here.

Categories

Resources