I have a java application which is packed into an executable jar file and it uses it's own conf directory to store some configuration options.
Now I want to distribute it as a Java Web Start application. I know that I could pack the configuration files in the distributed jar but it should cause some significant changes in application logic.
So is there a standard way or a simple workaround for the configuration directory distribution?
Configuration options for a rich client deployed using JWS are probably best stored in the PersistenceService.
Related
I am using Websphere application server 9. I have some external files that are not supposed to be packaged as part of war file, but those files should be available for Websphere application server in its classpath. i.e the external files should be available in the classpath.
Can anyone tell which directory of Websphere will be available in classpath by default so that I can keep all those files there?
If the above option is not available, I will keep my external files in some location of Websphere server, but how to tell the server that "hey! you should look for specific directory and make it available in your classpath"?
There are several directories which are on the classpath by default like %WAS_ROOT%/lib/ext or %PROFILE_ROOT%/properties however it is not recommended to use them for application specific files.
The recommended approach would be to create Shared Library where you could define directory where you want to store files that would be accessible and then associate it with the application.
Check these links:
how-create-shared-library-and-associate-it-application-server-or-enterprise-application
managing shared libraries
I have a JNLP application that is executed from Java Web start applications. The application uses eParaksts digital signature. All the required jars are loaded and signed. They work properly. However, the jnlp requires certain eParaksts licenses to be configured in the class path as they are read by the third party libraries.
When the JNLP is executed as standalone, it is able to read classpath files mentioned in the config folder but unable to read when executed using web start. How can I make my JNLP read this files?
What do you mean when you say
When the JNLP is executed as standalone ...
You meant, when the application is run as a standalone Java application?
Java Web Start application cannot work with configuration folder/files the way a regular Java app does (see section resources Element). If these eParaksts licenses are files, put them in a jar and deploy it as a JNLP resource. They should be then in the classpath of the application.
I am new to TorqueBox. I have created one RESTEasy app which is currently running on tomcat. Now I want to deploy it in TorqueBox.
For that I have created on yml file in apps folder of torquebox. The content of file is
---
application:
root: C:/torqueApp/java/RESTEasyTorque
env: development
web:
context: /hellojava
My problem is when i start server it doesn't deploy my app. What should i do?
Bob answered this on the mailing list, but I'll paste it here as well:
You can deploy pure Java applications on TorqueBox, but you don't use
a torquebox.yml (or *-knob.yml).
To deploy a Java application in TorqueBox, just drop your .war file
into the apps/ directory directly (I'm assuming TorqueBox 1.x)
fwiw, if deploying a Ruby application, you can put a torquebox.yml
inside your application, but the files in app/ would be a *-knob.yml
file, or an archived version of your application with the extension of
.knob.
When we refer to "knobs", we mean either the *-knob.yml, or the *.knob
archives, which are used in the apps/ folder. torquebox.yml is
primarily used within your application's own directory tree.
For Java applications, ignore everything TorqueBox-related, and you
can pretend that our distribution is just like JBoss AS6 (for
TorqueBox 1.x) or just like JBoss AS7 (for TorqueBox 2.x). Our
changes are purely additive, building on top of the JavaEE container
from JBoss.
from: http://markmail.org/message/zhjwhbgxarjsvdz7
For torquebox-2.3.x and above, you need to have jboss-clent.jar is available in your java app's library folder is automatically searches for running JBOSS instance and get deployed to it. However if you need to use Torquebox queues you to bind JBOSS to an IP using runtime JVM options e.g.
JAVA_OPTS="$JAVA_OPTS -Djboss.bind.address=192.168.100.101 -Djboss.bind.address.management=192.168.100.101 -Djboss.bind.address.unsecure=192.168.100.101
Then using JMS API you can use Torquebox queues
We currently have an Java application that can be deployed on clients or run as a shortcut from the server. We have intermittently received ClassNotFound exceptions when running the JAR from the server which looks like Windows dropping the network connection with only part of the classes from the JAR loaded (user opens a different screen then the problem is apparent).
I am currently looking at the Web Start technology to allow us to run a single shortcut.
However the application has several folders it requires to be in the same folder the JAR is launched (for configuration, logs, etc.). These folders will require full access for all users to allow them to write log files. There are lots of configuration files under the configuration folder hierarchy.
The application also requires access to environment user settings (such as getting their user folder). It also requires certain command line parameters (including which folder to use for configuration, log file location, java memory usage, etc.)
Edit
The application also contains a reference to 2 signed JARs. These are:
jh.jar
mail.jar
It looks like these are signed by SUN Microsystems. jh is used for help integration in our application whilst mail is used for email integration.
I have now downloaded the latest versions of these files from java2s.com which do not have the signed equivalents.
end edit
The application is developed in Netbeans which compiles a single JAR file and copies the dependant JARs to the dist/lib folder. I enabled the Web Start functionality in Netbeans for the application and it generates the JNLP file.
Bearing everything in mind is Web Start the way to go for an application like this?
Can you include folders in a Web Start deployment? I could not find anything to do this in the XML structure for a JNLP file.
Cheers,
Andez
Yes, you could use WebStart for this.
Permission:
If you need permission to the file system, you have to sign your jars and put the all-permissions tag in your jnlp.
Arguments:
Arguments can be provided by using the arguments elements in application_desc.
Folders:
I'm don't think you can include folders in the WebStart application, but you could put the config files in a jar and read them from there, or extract them on startup.
ClassNotFoundError:
We have intermittently received
ClassNotFound exceptions when running
the JAR from the server which looks
like Windows dropping the network
connection with only part of the
classes from the JAR loaded
Does not sound plausible to me. per default, all jars will be downloaded before the application starts. If you set "download" to "lazy", the jar will be downloaded when first needed, but I would guess it will be downloaded completly then.
You can provide read-only resources for Java WebStart. Getting the log back is harder. I would suggest looking into a centralized logging solution, using one of the standard appenders in the log framework you use.
For a Java Web Start application it is always advised not to create files or folders in the class path. Recommend user's home directory to store your settings or database files.
I earlier got to create a simple RESTful webservice on my localhost using Eclipse IDE, Tomcat, and JAX-RS libraries.
I am now trying to move the same on to a different unix server which has Tomcat installed. I am not knowing how to get started as in what is equivalent to creating a "Dynamic Web Project" that I do in Eclipse. Do I need to just create a directory myself with all the sub-directories as created by Eclipse? Should this directory be placed in webapps folder in Tomcat container. Should META-INF and WEB-INF also be created by myself?
Where should I put my Java classes?
Can somebody please clarify this or direct me to any documentation about the same.
You need to package your application in a WAR file.
The Sun Java EE 6 Tutorial has a chapter deciated to packaging.
It's pretty easy to export a web application as a war in Eclipse.
Dynamic Web Project (right click) => Export => Web =>war file =>war export dialog
Creation of web application archive - WAR is the solution for your problem,
but take care about all libraries that you need there.
You can easily extract (unzip) WAR file content
and check your project structure and libraries needed
and they will be in WAR's WEB-INF/lib.
Make sure that both Tomcats are set same way,
make sure your code is all OS friendly (users, file paths, permissions)
Always write some test simple code that will run up on app start,
and check all dependencies and libs, system clock, outside world network communication, so you can trace it in web app console or logger easily.
regards