Running a standard java app in the JVM Runtime Container in Cloudbees - cloudbees

I want to run a 'normal' java application (with a main method) with the JVM Runtime Container.
1)
Is that possible in the free version? Currently (it seems) that I can only select 'JVM Web Application' (for war files)...
2) If so where or how can i select the JVM Runtime Container?
Thanks!

It's unclear what you mean by a "normal" java application. If you mean that you'd like to launch the app via a Java main() method, the documentation page that you linked to is about running apps launched via a Java main() method, not a WAR file.
The following command from that doc is showing how to run an app packaged as a JAR and specifies its main class name.
bees app:deploy -t java -R class=your.main.Class -R java_version=1.7 PATH_TO_APP_PACKAGE

Not sure if someone is still looking for answer...
Make your java application (not the web application) as a jar file.
Upload the .jar file into cloudbees through "Bees Console" (that comes when you download cloudbees SDK).
Command to upload jar file is bees app:deploy -a <app_name_in_cloudbees> -t Java <jar_file_locaiton_in_your_local_file_system> -Rclass=<fully_qualified_java_class_name_that_contains_method>
ex: bees app:deploy -a helloworld -t Java C:\projects\helloworld.jar -Rclass=Helloworld
This will upload and deploy your jar file to cloudbees.
Go to log tab to see your console output.
Now, in beta version of cloudbees, we can upload jar files hence forth to update our jar file contents.
Reference: http://developer.cloudbees.com/bin/view/RUN/Java+Container

Related

JavaFX application fail to launch with native exe bundle created with intellij ide

I have build a JavaFX application which can be executed by its jar file. However if i try to run it using the native exe bundle i am receiving two popups:
Error Invoking method
Failed to launch JVM
and the application fails to start.
The Javafx application is build with intellij ide.
The project structure looks as follows;
when launching the application following popup shows..
The config file looks as follows:-
The packaged jar file is executing properly...
the problem occurs when starting application with launching exe file.
kindly tell me what could went wrong?
UPDATE:
It seems that the build output runtime/bin directory does not contain java.exe file therefore i think the application does not launches.
the output when try to run the application is as follows:
i have build the application with intellij idea, i think there is a problem with that. Kindly look into this matter.
UPDATED:-
Run it from the command line using the runtime that was bundled for you:
If you made an executable Jar (with a proper manifest specifying the classpath and main class)
cd firecap
runtime\bin\java -jar app\libs\your-main.jar
If you don't have an executable jar use something like
cd firecap
runtime\bin\java -cp app\libs\*.* your.main.class.name
Since java.exe is a console program you should be able to see the full error output to get a better idea of what is going wrong.
You very likely have missed including a needed module in the runtime.
It is also possible you ran into a bug that I discovered recently: https://bugs.openjdk.java.net/browse/JDK-8254920
I created my runtime image with this command:
"C:\Program Files\BellSoft\LibericaJDK-15-Full\bin\jlink.exe" --no-header-files --no-man-page, --compress=1 --add-modules java.management,java.logging,javafx.controls,java.xml,java.desktop --output C:\MyProject\build\image\runtime
But yours may be different depending on what modules you need. Note also that I used a JDK from BellSoft that included the JavaFX modules to make it easier.

IBM MobileFirst war file unable to deploy to MFP server

I had tried deploy both war file without java and jar files and with java and jar files. The war file without java and jar files managed to deploy successfully without any error in the log. The runtime appear in the admin console and everything works.
If I deploy server/java and jar war files, my runtime will disappear from the admin console. Here is my java lib,
I am using the IBM Server Configuration Tool to deploy war.
axis.jar
bcprov-jdk14-143.jar
commons-discovery-0.2.jar
commons=logging.jar
CryptoPasswordTool_14.jar
e2eejslib2048_b1.4_v1.3jar
jaxrpc.jar
jcprov.jar
saaj.jar
wsdl4j.jar
xerces-2.9.1.jar
Here is my Java call
javax.xml.rpc.Service aacmService = javax.xml.rpc.ServiceFactory.newInstance().createService(new java.net.URL(connectionUrl),new javax.xml.namespace.QName(ssoLink, "SSOService"));
These library had been used in my server/java to make some customized server call.Is there any of these jar files that will crash with MFP?
In this environment, I unable to get to copy anything out from the server due to the client policy. But I managed to take a shot on the screen.
Without proper information to review, such as the complete log file to see all errors printed, the recommendation is to open a PMR instead of a question on stack overflow, which anyway is more suitable for programming questions rather than infrastructure questions.
Open a support ticket to IBM: http://www-01.ibm.com/support/docview.wss?uid=swg21507643

How to add Java classes to a Worklight adapter when using CLI

I am trying to add Java classes to my adapter as described in the tutorial Using Java in Adapters. However, I am trying to do that from the CLI.
When I do:
wl create WLProject
cd WLProject
wl add adapter
copy the Java class (Calculator1.java) to server/java/com/worklight/customcode
wl start
The build process fails and no war file is created;
When I do:
wl create WLProject
cd WLProject
wl add adapter
wl start
copy the Java class (Calculator1.java) to server/java/com/worklight/customcode
wl build
wl deploy
wl invoke
The invocation fails. When I inspect the war file, the Calculator1.class has not been deployed.
So the question is: how can I add Java classes to an adapter when using the CLI?
Sounds like a bug to me. It looks like the build process fails when introducing server-side artifacts.
This might be not currently supported in the CLI, but I can't imagine such a limitation...
I've opened a defect to have this looked at.
You can open a PMR (support ticket) to receive a fix if/when available.
If I do the following,
the .war file is being generated.
wl create myTestProject
cd myTestProject/
wl build
But if I do this,
the .war file is not generated which is why everything else then fails:
wl create myTestProject
mkdir -p myTestProject/server/java/com/worklight/customcode
cp Calculator.java myTestProject/server/java/com/worklight/customcode
cd myTestProject/
wl build
There's an invalid classpathref in the build file that's producing the WAR.
You can edit [CLI Install Location]/worklight-cli/node_modules/generator-worklight-server/lib/build.xml to fix this issue with the classpathref.
If you're not planning on using any server runtime libraries:
On line 132, you can remove the attribute classpathref="server-classpath".
If you plan on using server runtime libraries:
You'll need to add the "server-classpath" to be used when compiling your code. Before the build-WAR target in the build.xml file, you can add the following
<path id="server-classpath">
<fileset dir="${worklight.jars.dir}" includes="worklight-jee-library.jar" />
<fileset dir="[your home directory]/.worklight/6.2.0/server/wlp/dev" includes="**/*.jar" />
</path>
Please note that the second fileset, you'll have to change [your home directory] to the appropriate path. Adding both of these filesets includes the worklight runtime and the server runtime when compiling your classes.
When you've made your changes:
Restart the server. At this point, the Calculator1 class should be added to your WAR.

On UnsatisfiedLinkError, clarification needed

When building the project from command line using mvn clean install everything builds without any issues.
When running some tests that use precompiled C libraries from IntelliJ, tests fail with java.lang.UnsatisfiedLinkError
I may be completely off here, but does IntelliJ not see the .so file? Is so, how can it be added please?
Shared library fails to load with UnsatisfiedLinkError if:
it's not in the working directory configured in the test run configuration.
it's not in PATH environment (on Mac Terminal and GUI apps have different environment, see this answer). Run IDEA from the Terminal open -a /Applications/IntelliJ\ IDEA\ 12.app/ to make environment the same.
it's not in the location specified using -Djava.library.path VM option.
.so depends on some other library that is not found for any of the 1-3 reasons (or the dependency of that dependency is not found, etc).

Upload flash after build via IntelliJ IDEA

How to configure automatic upload of the generated flash file after it was built in IntelliJ IDEA via flex?
Before using IntelliJ IDEA I used a simple shell command to compile & upload the file. Now I want a similar process in IntelliJ IDEA.
mxmlc -debug=true -static-link-runtime-shared-libraries=true -output flash.swf flash.as 2>&1 && scp flash.swf user#server:/var/www/
You can configure external tool, for detailed instruction see online help
I'd recommend using maven for many things that surround a Flex project. In this case you could use one of these plugins:
Maven FTP
or
Cargo