Improve company productivity with a Business Account.Sign Up

x
?
Solved

Changes to the jivelive.jsp are not being reflected on Fastpath webchat service.

Posted on 2013-10-24
7
Medium Priority
?
1,004 Views
Last Modified: 2013-11-18
Hi,

I am attempting to modify my jivelive.jsp file in my OpenFire webchat directory so I can use a text link instead of an image for my webchat service on our website. However, no matter what changes I make to the file, it is not reflected on the server when I go to load the JSP file in a web browser. If I restart OpenFire, the file is replaced with an original copy. I had read a few things stating that the webchat.war file needs to be recompiled with these changes to the .jsp but I'm not sure if that's even possible. I have already attempted to extract the .war file, change the .jsp, and recreate the .war file which seems to load just fine in OpenFire, but the jivelive.jsp still shows as the original when I browse to it in a browser. Any help is appreciated.

Thank you
0
Comment
Question by:OAC Technology
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 36

Expert Comment

by:mccarl
ID: 39599673
I don't have experience with OpenFire (only with Tomcat) but I am guessing that it too would have some sort of "temp" or "work" directory like Tomcat. You may need to clear out any files in there too, as OpenFire might be caching the compiled version of your JSP and not updating that cache when you change the JSP. It is a bit of a guess going on the llimited info.
0
 
LVL 2

Author Comment

by:OAC Technology
ID: 39600450
Apparently the new version of OpenFire uses Jetty. This was working perfectly fine under Tomcat before the update
0
 
LVL 27

Expert Comment

by:mrcoffee365
ID: 39601434
It is likely that your tomcat instance automatically recompiled jsp files on any change to the file, and your jetty instance does not.

The most likely reason you're not seeing the changes is that the .java/.class files generated from the .jsp file are not being regenerated and reloaded by jetty.  You also could be editing the wrong .jsp file, but let's assume that you have found the right .jsp file to edit.

So -- you can go into the working directory of the jetty instance and remove the .class and .java files for your changed .jsp, and that should force jetty to recompile and reload.

If jetty does not automatically reload changed class files (we don't know what your settings are), then you might have to stop and start jetty after you force the regenerate and recompile of the .java and .class files.

There is probably a flag in the jetty configuration which you can set so that it will do this automatically on file change, just the way tomcat does.  You could look for that.

Warning:  since the .jsp file is in a war, the next time you update the war (or re-expand it from the original .war file) your jsp changes will go away.

In order for the war to have your changes, you have to replace the .jsp/.java/.class files in the war itself.

If you are getting a 3rd party war, then you'll need to make this change every time you get a new version of the 3rd party war.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 21

Expert Comment

by:Amitkumar P
ID: 39604046
agree with mrcoffee365.

Rebuild entire war file again and redeploy it.
0
 
LVL 2

Author Comment

by:OAC Technology
ID: 39617178
Hi,

I've tried to rebuild the entire war file and redeploy it with the changed files and I'm not finding any .class or .java files in the WAR file or in the directory. When I browse to the open fire plugins /webchat directory, the jivelive.jsp file has the modifications I have made to the jivelive.jsp in the .war file, but even when I reboot the server I am not seeing the changes reflected when I browse to that file in a web browser. I've done a system-wide search and that is the only jivelive.jsp file on the system and there are no .class or .java files. Any other ideas on this? Not sure what's going on.
0
 
LVL 27

Accepted Solution

by:
mrcoffee365 earned 1000 total points
ID: 39617274
The way servlet engines work is that the .jsp files are converted to .java files and compiled.  The produced .class file is loaded by the classloader into memory.  This can be done without writing anything to disk, which is possibly what jetty is doing.  You might find it educational to check tomcat's \work\Catalina\yourdomainhere\_\org\apache\jsp directory to see the .java and .class files.  That is what has to be produced, and then loaded by the classloader, for changes in the .jsp file to have any effect.

Unfortunately, amit_n_panchal was completely wrong that your solution was to rebuild and redeploy the .war file.  The solution can be incorporated into rebuilding and redeploying the war file, but until you solve the problem, rebuilding and redeploying will not change anything.

You need to look for the jetty configuration (I've mentioned this above) to see what this configuration is doing.  Set the flag that saves .java and .class files to disk -- that will help you debug the problem.

You will probably need to read the jetty documentation for all of this.  But you can start by looking for the webdefault.xml for your app.  Plus the webdefault.xml for your war, which you'll need to overwrite or make sure that it is not used.  Since the war is not your code, that might be difficult.

I need to warn you again that you are choosing to edit a 3rd party war file, which means that every time you deploy it or get an update to it, you'll have to modify it, make sure that the changes are recompiled, and deploy it.  Most people don't do this because of the maintenance headaches.  And of course the configuration headaches you're seeing here.

Jetty's jsp compiler changed in version 2.2 to use the jvm's compiler, which does not write out the classes unless you explicitly set the init-param "saveBytecode" for the jsp servlet.

Make sure when you're adding that init-param to the jsp servlet that if you edit $JETTY_HOME/etc/webdefault.xml you need to ensure that file is applied to your webapp (by default it is not - the webdefault.xml inside the jetty-webapp jar is used instead) by calling setDefaultsDescriptor() on your context.

By the way -- are you fully stopping and starting the jetty instance?  The classloader might hold your changed jsp's class in memory even if you have changed the jsp file and regenerated the class file.  Redeploy can be done such that only a single webapp is reloaded, which might not be enough to get the old compiled jsp out of your web server's stack.  It should be, but jetty is its own little world, so they might have decided to handle the behavior differently.
0
 
LVL 21

Assisted Solution

by:Amitkumar P
Amitkumar P earned 1000 total points
ID: 39617442
I found a good link to that will help you to figure the temp directory out.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
This article explains how to use the rsync command to create backups and sync data across hosts. Rsync is a very useful command that is often used to copy data, make backups, migrate hosts, and bridge the gap between site staging and production envi…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This video teaches viewers about errors in exception handling.

579 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question