B4J Question Tomcat7 and .war files

Zoltan Dinya

Member
Licensed User
Longtime User
The question is how can I transport this (https://www.b4x.com/android/forum/threads/webapp-hello-world-web-app.39808/#content) webapp to a real web-server... On my PC it works fine, but I don´t have VPS to run the .jar file, and it is expensive to have a service-provider contract only for this.
I have a Synology DS415+ NAS with fix IP, and I managed to install and setup TOMCAT 7 on it. But it can accept only .war files (is this correct?). I can produce .war packages, I have tested it, and the question is, what must I pack into the .war from the project folder to upload? There is: FILES and OBJECTS (subfolders: bin, logs, shell, src, www) and a few files.

Can anyobody write a list about the file, which must be packaged? Thank you in advance!
 

Zoltan Dinya

Member
Licensed User
Longtime User
Hi Erel!

Thank you for your answer! My main problem with the compiled .jar is on the screenshot here. Windows7, Java JDK1.8 and Java JRE1.8, B4J 3.61. Helloworld web app. When I compile it with B4J (release, compile to library), creates a .jar file without any error. But when I try to execute this jar file (java -jar helloworld.jar), this error message comes. If I try to run the software direct from the B4J (compile and run), then works fine.
What do you think about this?

Zoltan
 

Attachments

  • hiba.jpg
    hiba.jpg
    20.4 KB · Views: 312
Upvote 0

Zoltan Dinya

Member
Licensed User
Longtime User
Hi Erel!

Thank you for your answer! My main problem with the compiled .jar is on the screenshot here. Windows7, Java JDK1.8 and Java JRE1.8, B4J 3.61. Helloworld web app. When I compile it with B4J (release, compile to library), creates a .jar file without any error. But when I try to execute this jar file (java -jar helloworld.jar), this error message comes. If I try to run the software direct from the B4J (compile and run), then works fine.
What do you think about this?

Zoltan

...and if I check the content of this jar, I find only one file in it: b4j/example/helloworld.class
 
Upvote 0

Zoltan Dinya

Member
Licensed User
Longtime User
hibajar.jpg

If this is true, then this is my problem perhaps, because I see something absolut different in my compiled .jar
There is only one folder and one class file in it: b4j/example/helloworld.class
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Have you tried compiling it by 'compile and run', not the 'compile to library' option (that will only compile the class modules, not the main module as far I understand).
 
Upvote 0

Zoltan Dinya

Member
Licensed User
Longtime User
Daestrum, thanks for your answer, but I tried it as "compile to library" and it produced so a .jar which is incorrect. :(

By the way, what means "build configuration"? But i used its default settings (package: b4j.example)
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Both the Compile to Library and Compile and Run produce jar files, the difference is, the library jar expects to be called from another jar. Like you have library manager and can 'bolt' on modules like for example the Server library. The compile and Run option produces a jar that is standalone and can be run by the OS.

The configuration allows you to specify things like the name of the java package so instead of default b4j.example you could have freds.package if you wanted.
 
Upvote 0

Zoltan Dinya

Member
Licensed User
Longtime User
hiba05.jpg

And interestingly, if I chose (with the same source code!) the simple "Compile and run" option, the info message compared with the previous screenshot is much more detailed now....!
For example "The following libraries should be...." and a few component filename!
The "compile to library" option doesn't compile anything, I don't know why...
 
Upvote 0

Zoltan Dinya

Member
Licensed User
Longtime User
"Compile and run":
----------------------

B4J version: 3.61
Parsing code. (0.00s)
Compiling code. (0.02s)
Compiling layouts code. (0.00s)
Compiling generated Java code. (0.68s)
Building jar file. (0.01s)
Jar file created: C:\Users\Warlimont\Downloads\WebAppHelloWorld - 01\Objects\WebAppHelloWorld.jar
Libraries were not merged into jar file.
The following libraries should be distributed in the libs folder:
jCore.jar jServer.jar jetty_b4j.jar servlet-api-3.1.jar c3p0-0.9.2.1.jar c3p0-oracle-thin-extras-0.9.2.1.jar mchange-commons-java-0.2.3.4.jar json.jar
Running application. (0.00s)
Completed successfully.

(and it works fine so!!)

"Compile to library":
-----------------------
B4J version: 3.61
Parsing code. (0.00s)
Compiling code. (0.01s)
Compiling generated Java code. (0.67s)
Building XML file. (0.00s)
Creating jar file. (0.03s)
Completed successfully.
Library jar: C:\Users\Warlimont\Downloads\WebAppHelloWorld\Objects\jworldy.jar

(corrupt jar...)
 
Upvote 0

Zoltan Dinya

Member
Licensed User
Longtime User
Thank you, one small step for me.... :) I have found the .jar, by the way for a beginner this was not full obvious. But the next error message comes in a msgbox right after I try to run the .jar:

"A JNI error has occured, please check your installation and try again"

What is the correct CLASSPATH entry is Java? Now I have on my 32bit Windows7: .;C:\Program Files\Java\jdk1.8.0_60\lib;



And if I check the logs in B4J, the "compile and run" logs this:

WARN:eek:ejh.MimeTypes:main: java.util.MissingResourceException: Can't find bundle for base name org/eclipse/jetty/http/encoding, locale hu_HU

Is there any connection?
 
Upvote 0
Top