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

Posted on 2013-10-24
Last Modified: 2013-11-18

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
Question by:OAC Technology
  • 2
  • 2
  • 2
  • +1
LVL 35

Expert Comment

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.

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
LVL 27

Expert Comment

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.
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

LVL 21

Expert Comment

by:Amitkumar Panchal
ID: 39604046
agree with mrcoffee365.

Rebuild entire war file again and redeploy it.

Author Comment

by:OAC Technology
ID: 39617178

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.
LVL 27

Accepted Solution

mrcoffee365 earned 250 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.
LVL 21

Assisted Solution

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

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
stackato and cloud 4 74
eclipse shortcuts 9 45
nagios alerts 3 33
how to add new optional parameter to JSP 1 29
Article by: Ahmedn1
Introduction Some developers today tend to use Skypekit in their applications to make it more interactive with the user. Skype API is very awesome indeed but the problem is it is only available in C++, Java and Python. I can't understand why Micr…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

867 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now