How to refresh java changes in xpages - java

I am developing an application on xpages, with Domino version 9.0.1 FP8. This is the first application in which I have developed a call to java classes through a one-button SSJS event. But specifically I am consuming a web service using the technique presented in the article. What I noticed is that every time I change something that has a direct relationship with java, such as the java classes created and stored in the java folder of the designer or in the call of the web service method inside the SSJS event, an error is listed below . The only way to solve the problem, at least until now is to restart the Domino server. It's no use clearing the project, rebuilding it, and restarting http.
Does anyone know how to solve this problem? Is there any command on the Domino server that reflects this change? Is there any parameter in the application that I have to configure?
As we can see from the error below, it seems that it does not find the web service client classes that are located in a jar in the application jar folder.
HTTP JVM: java.lang.NullPointerException
HTTP JVM: at com.ibm.domino.xsp.module.nsf.ModuleClassLoader.getResource(ModuleClassLoader.java:206)

To solve your specific issue, issue res task http at the console. There are other workarounds posted in the comments to the main question that may be more practical for your situation though.

As a workaround you can rename the jar file when you make changes to it, import the renamed jar file and delete the old jar file. This way Domino will see the changes in the jar file.
I am using the rename trick whenever I make changes to code assembled in a jar file.

Related

Given a JAR file, allegedly contains web server, how do I deploy it?

I've been handed a JAR file, told it contains a web application, and instructed to deploy it. I'm familiar with java as a language, but I have next to no experience with its web ecosystem. Trying to run it as an executable, I find out it has no main class, so I take a look at the contents, and find that it has a META-INF/web-fragment.xml file, along with a couple of Servlet classes and some config files referenced in the xml. It looks like there is basically everything here for a complete application, but I have no idea how to actually deploy it, and google only yields tutorials on how to build these things from scratch with IDEs and deploy using maven plugins and goals.
Assuming that building from source is out of the question and I only have standard unix and java CLI tools available, based on the information provided (And I can provide more if necessary), what is the simplest way to get this up and running?
A web applicaton should be in a WAR file, not a JAR file, and you should only need to just drop it into the webapp directory of your Tomcat, or follow the instructions for whatever other container you're using.
If it's only a fragment, as appears from the XML, (a) it isn't a webapp, only part of one, and (b) you personally can't deploy it at all. You need the whole thing.
Send the assignment back for clarification.

Adding functionality - Java servlet built with Ant

I have with me a working copy of Apache FOP's Java Servlet source code.
I have compiled the code - which handles a doGet request - and deployed it on Tomcat on my localhost, and it works and its good.
BUT I need to add functionality for a POST method to the file.
I can do that, but I'm not sure how to use the source code. All of my experience in Java has basically been behind an IDE.
The servlet is built by an Ant script, build.xml, that seems to contain references to variable names. Do I need to add to this file at all? Can i just change stuff in my servlet.java, and go straight to building?
Yes, you can do that. If you have the source code and can build the project, then you can start a simple text editor, change the servlet Java file and then build the whole thing again.
But it will be time consuming. It can take a while until compilation problem are reported leading to high turnaround times. And you are unable to debug your code if something went wrong.
For some very small changes this approach might be suitable. But for larger changes it would be better to invest the time to configure your IDE for web application debugging.

JavaWebStart- multiple jars in same jnlp?

I'm trying to convert my java software jar into a Java WebStart application. I've managed to successfully deploy it as a WebStart with a jnlp file that provides details about the software's jar.
However, my software requires certain details to be stored locally in a file on user's machine. These details can be set & the file can be generated by having the user run another java software (a very small java utility software) coded by me. I wonder if it's possible to package in this smaller software's jar as well along with the main software using the tag. As far as I know, we can use the tag to specify additional jars/ libraries that our software jar uses.
Can we package in another java jar created by us in the jnlp and would it then get downloaded alongside the main software jar and other libraries (jars) when the user launches the jnlp ?
Kindly let me know. Thanks.
P.S: I know that all jars downloaded by a WebStart application end up in the deployment cache. Is there no way to specify where they should get downloaded to ? In my case, I would prefer it if the 2nd software's jar gets downloaded in an easier-to-find location.
Yes, it would be downloaded - but it would end up in the deployment-cache with no easy way to find it (names get all mixed up) or start it.
There's no way around webstart keeping the files in the deployment-cache: if you could specify the download-location different versions of jar-files with the same names and different codebase could end up in the same location causing no end of trouble.
I see two ways to get the wanted functionality:
Add the ability to change the local configuration as an additional function in the main application. You probably can use most of the existing code but use a method-call instead of starting it as a separate application
Create a second jnlp-file to start the configuration-program. From what you write it should be pretty small and not too much effort to create.

How to convert EAR as executable file?

I have no idea about converting EAR file into exe(Executable file), Where are i am working with jboss and i developing webservices. I want to give my product as executable file . Can anybody has idea about this.
Thank you
Gobi, you've already posted a question regarding this on 15th March, to which you've got no response. I guess you've just rephrased that same question here.
Might I suggest asking your customer/client how she would like the web service 'ear' delivered? I'm also guessing you might have database scripts, properties/config files etc. I'd put my money on 'a zip containing the ear, database scripts (if any) with related documentation'
There is no way a customer would want to 'double click' your ear and have it installed directly onto a server. If you read your Java EE spec correctly, you'd find a 'deployer' role in there. Its not there for fun. Its a very serious role whose responsibilities include 'configuring' your application.
Think about it.
You mean you want customers/users/whatever to just be able to double-click on your file, and there's a web server up and running? While that would be possible, it's not really the way most people want to run web services. They're very likely to want to run your web service within an existing container, configuring it alongside other services.
An EAR file is already designed to be pretty much droppable within a container, so that's fine. You could also supply a zip file (or an installer) with a sample container setup using any of the free container implementations - either preconfigured with some reasonable default values (e.g. for the port) or running through an installer wizard. I wouldn't spend too much time on it though - I'd assume that most people who want to run a web service will already have some experience of setting up a container, or will have specific requirements you couldn't easily capture in a wizard without a lot of work.
I don't know about making EAR as executable.
There is a editor which converts your project into setup file or installer for windows .
Hope this helps.
I used NSIS editor and recommend it and it only creates installer for windows.
HM NSIS Editor.
you may also have look at izpack

Self-updating Java jar

I want to create a self-updating jar.
I've got the first part down: I download the most up to date version. I'd like to delete the current version, though, and that's where I'm stuck. I do the updating at the very end, and I'd like to delete the current jar.
I've tried the File.delete() and the File.deleteOnExit() methods to no avail. Any advice?
Thanks.
Java web start is a good choice for that. A more original method would be to have a very limited core application that relies on other jars that you can upgrade from the core app.

Categories