Why JNLP (Java Web Start) does not download jar file? - java

Why Java Web Start does not download Jar files which specified in resources?
I'm using jdk 1.5 to build my application. There is good reasons to use jdk 1.5 so that I can not upgrade it.
Jdk demo and samples used a servlet to specify location of JNLP and security checking. If I use this servlet, jnlp does not work and its jar files does not download while if write address of jnlp directly in codebase attribute by prefixing file:/localhost/ it works!

I think I found the problem! I was in an exploaded artifact environment which was a location other than actual tomcat/webapps/ROOT so that addresses in jnlp don't match to where they should point to. If I package all JWS in a war file and deploy it manually it works fine.

Related

Load third party license in JNLP Web start Application

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.

Microsft Azure installing Java Cryptography Extension (JCE)

I have a Java 8 Wep App on Azure.
I am using the default JRE build in application settings for the webapp. I am running on Tomcat.
I am having trouble installing Java Cryptography Extension to handle some encryption. I dont have access to Java Home to install it, I can only upload the WAR files to web app.
Does anyone know how to install JCE on Azure?
Thanks!
Fab
For people who are still having trouble with this I share my solution by example:
Copy JDK from D:\Program Files (x86)\Java\jdk1.8.0_111 to D:\home\site\jdk1.8.0_111
Download and extract jce policy files from: http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html
copy files local_policy.jar and US_export_policy.jar to D:\home\site\jdk1.8\jre\lib\security (replace existing files)
Set application setting in Azure portal: JRE_HOME = D:/home/site/jdk1.8.0_111/jre
Now the JDK has JCE enabled. The "Java minor version" selected in the Azure portal is no longer used or this App Service.
On Azure Webapp, you only have the operation permission for the path D:\home\, but no permission for the others include %JAVA_HOME% and Apache Tomcat at the path D:\Program Files (x86)\.
Generally for using some packages, you can directly import these jar files into the directory WEB-INF\lib of the project or the war file. This way is only effective for the current project, and it's safe for the others to avoid clash.
For the file structure of the path D:\home, you can refer to the wiki page https://github.com/projectkudu/kudu/wiki/File-structure-on-azure to know.
However, according to the doc README.txt in the JCE, it seems to be not possible for installing on Azure Webapp, so I think you can try to use other cryptography packages instead of JCE for your app, such as apache commons codec.

Where does Eclipse store generated servlet files for Tomcat?

I'm using Eclipse Java EE IDE and launch Tomcat from the Server's tab on Eclipse.
Where does Eclipse store generated servlet .java files for JSP files? I've checked the Tomcat installation directory, but nothing there.
Thanks.
Doubleclick the server entry in Servers view and check the path represented by Server path. Explore in there from inside the workspace directory. The generated classes are there.
If you choose the 2nd option Use Tomcat installation, then it will be available Tomcat's /work folder, there where you expected it to be.
go to your application work space directory(not eclipse installation directory) in windows explorer(not in eclipse IDE explorer).
in my laptop it is d:/applicationdata/j2ee
then follow the path as:
work space directory(in my case j2ee)/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/catalina/localhost
here u will find your application
Eclipse doesn't generate servlet files for JSP files. Validation happens directly on JSP syntax. When a JSP is deployed to an app server like Tomcat, the server may choose to generate servlet files to disk, but that is not required. The generation and compilation can happen in memory or the app server may even compile JSP files directly to bytecode.
I don't know specifically about Tomcat, but if it does generate servlet files to disk, the temporary directory containing these files will be somewhere under your Tomcat install.
/home/waheguru/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/jspnotes/org/apache/jsp
localhost or your website name,
project name is jspnotes, whatever your project.
This path is shown in Linux Mint.
Check META-INF\context.xml file from your work space. There will be path metioned like below
workDir="C:\apache-tomcat-7.0.39\work"
In above path you will find the package structure of your project and in it there will be both *_jsp.java and *_jsp.class

setup of eclipse project : tomcat server , jdk , external libraries and so on

I'm a beginner java developer and i'm not very confident with java world tools.
i'm using eclipse helios, jsdk 1.5, axis2 plugin and tomcat 6.0.29 on windows to port a very old webservice , preaviosuly deployed on a websphere.
I've added a tomcat server to my eclipse project, when i start the server i get the following message : the APR based Apache Tomcat Native library ... etc ... was not found on the java.library.path .
How do i change that variable (or any environment variable in general ) from inside eclipse ?
Then i've another problem i don't know if can be solved with some kind of configuration : i must use some third party .class library grouped togheter into a zip file. I've added the zip to the shared.loader property of the tomcat catalina.properties file and my project can't see them. If i rename the .zip file to .jar everything works fine . How can i use classes inside zip file without renaming it to jar ?
thank you in advance
A Jar is based on the same format as that of Zip. All the third party classes are bundled as Jars (Java Archives) and should be used like that instead of Zip. So if you happen to have a zip housing your classes you should rename it to jar as per java's conventions.
You can check where java.library.path variable is pointing to? using System.getProperty("java.library.path"); and see if the native libs are present in there..you should use the jar instead as its the standard format for archiving java class files
when i start the server i get the following message : the APR based Apache Tomcat Native library ... etc ... was not found on the java.library.path
The exact message is:
INFO: The APR based Apache Tomcat Native library which
allows optimal performance in production environments
was not found on the java.library.path
As you can see, the message is logged as INFO and the easiest thing would be to ignore it, especially in a development environment. But if want to make things more complicated, go to the Apache Portable Runtime (APR) based Native library for Tomcat and follow the install instructions.
(...) I've added the zip to the shared.loader property of the tomcat catalina.properties file and my project can't see them. If i rename the .zip file to .jar everything works fine . How can i use classes inside zip file without renaming it to jar?
In other words, using a (standard) *.jar worked, but a *.zip didn't. I'm tempted to answer: use a .jar extension.

How to deploy Java Communications API

I've been developing a java application with the eclipse RCP which requires the Java Communications API. Now as the javax.comm has to be setup first (install javax.comm.properties, win32comm.dll and comm.jar) my question ist: How should I deploy my application to make sure javax.comm will be setup on the user's machine? Should I provide an installer which does the setup or should I let the application itself export the files in their respective directories?
I have never before done such a thing, so I'd appreciate any help.
Thanks
I'm using RXTX instead of Java Comm, but the problem is the same, i think. The RXTX site has a documentation about it, please see the Wiki. The description is for Eclipse 3.3, but works for 3.5 too.
How would you like to distribute your application? As a JAR, I assume? In this case you need to setup the JAR's manifest.mf file with a Class-Path entry which contains semicolonseparated relative paths to the desired resources (relative from the JAR file itself on). You can distribute your application with the javax.comm stuff included and if necessary write a readme.txt with installation instructions.

Categories

Resources