JSP changes not reflecting when server is run. (JBoss, Maven, Eclipse) - java

I don't think the issue is isolated solely to my JSPs. However, the current files I'm trying to edit are JSPs.
Whenever I make changes to my JSP, I save the file (in Eclipse), clean/republish my JBoss server, start the server, and access the application (localhost), yet the changes I made are not reflected on the page at all.
I go to the JBoss temp directory to see exactly what version of the file (that I'm editing) the server is currently using. I always see that it's using the original version that I pulled down from the original repo. I have no idea why it's not changing.
I tried re-cloning and re-importing everything just out of desperation, and I'm getting the same results.
In addition, strangely, when I run the command mvn -U clean package -DskipTests=true to do a command-line build using Maven, my file reverts back to the original/unchanged version. (New to Maven, so it's strange to me at least).
So, essentially any changes I am making to files for my project aren't being reflected on my local test server. I'm totally stumped as to why it's behaving like this.

You can put JBoss in development mode. This is a mode in which JSPs are always re-compiled. Thus when you deploy a JSP change, you can immediately see it.
For JBoss 7, edit the file: /jboss/{server_name}/configuration/standalone.xml. Locate the "jsp-configuration" element and set the "development" attribute to true.
<configuration>
<jsp-configuration development="true" x-powered-by="false"/>
</configuration>
Note:
This file is in a different location in different versions of JBoss.
{server_name} in the path above will be specific to your JBoss install. If you have not created a server, then this value is likely "default" for you. You can easily find this value by looking at where your web app is deployed.
It is a good idea to deploy your web application in "exploded" format. That is, rather than deploying it as a WAR file (which takes time to build), explode (i.e. unzip) the contents of the web app right in the JBoss deployment area. That way when you need to make a JSP change, you simply copy the one JSP file.

Related

How do deploy just my static content in Tomcat / Eclipse?

I am doing development of a web app with Java. My current process is to export the project as a WAR to the Tomcat folder, where it picks it up and reloads the WAR. I wait for it to run through its startup process and away it goes.
I would like to make it not need to do an entire reload when it isn't necessary. If I'm making a small change to a single class, perhaps it could reload just that class. If I'm changing static content, perhaps it could just send that HTML file or JS file.
How can I achieve this? My only real dealbreakers is that I need a solution that works with Eclipse. I'd even consider a different container than Tomcat, although it's where I'm familiar.
You can hot reload/deploy your application inside Eclipse , but for seperate Tomcat server , I don't think hot reload is possible .
For Eclipse
For eclipse , you can follow the instructions in this link https://mkyong.com/eclipse/how-to-configure-hot-deploy-in-eclipse/
This will speed up your development , but it has it's limitations
Hot deploy will support the code changes in the method implementation only. If you add a new class or a new method, restart is still required.
For Tomcat
I haven't tried it , but all the class files of war will be loaded/rendered from binary memory of Tomcat . So try changing the class files in that location(Not sure about the path of binary class folder ) .
But if you want to render static HTML,js and css from tomcat server , it can be easily done adding another folder inside "webapps" folder (eg : /webappps/static)

Jenkins deploy plugin deletes app context xml file

I am using Jenkins (v1.4.87) and have the deploy plugin (v1.10) to create a job that deploys a built war file into tomcat 6.
The deployment is running successfully, the war is being deployed ok.
Here is the plugin configuration part of the job:
(I have not included the real server details for obvious reasons)
The problem is that somewhere along the way, the application context file is renamed to appname.xml.bak and left in that state. Therefore the application fails to start because tomcat cannot find the context file it expects for the application any longer.
To remedy this I have to log into the server where the context file is located and rename the backup back to its original file name appname.xml.
It feels like the deploy plugin may be getting to a point where it should handle this. I would expect it to either make a copy of the context file called appname.xml.bak or rename the backup back to the correct file name.
I cannot find any documentation that lists out the phases that the plugin goes through so I cannot confirm if this behavior is expected or not. I am left with the only option to download the plugin code from Github and figure it out myself.
Have I missed something obvious maybe?
UPDATED:
I have since updated to Jenkins v2.32.3 and I have the same issue with the deploy plugin. Any help would be great thanks.

Tomcat reloading exploded war with spring-loaded

There's alot of questions on different forums [1] [2] [3] about this topic but none seem to provide a definitive answer. I've tried different combinations suggested in the various posts but I have yet to succeed.
My goal is to make compiled source code in a standalone tomcat (8) reloadable - just like the embedded tomcat reloads newly complied sources in e.g. spring-boot or Grails. There are a few constraints that I need to comply with:
No Grails or Spring-boot is available
No Maven or Gradle is available
The tomcat should read the exploded war file from an external location
To keep things simple I use a very simple JEE app with Spring MVC as POC for this before I move on to the real deal. The setup is as follows (for now):
Exploded war builds into directory target/exploded
Tomcat is setup with default settings except from Context.xmlwhere the two lines regarding WatchedResource are removed. Context is not set to reloadable="true".
The Tomcat server is run from within IntelliJ Idea (2016.3) like this:
where the "exploded" folder points to the target described above. And the "Server" tab like this:
The server starts up and the app is running fine. I then try to change some code, save it, and build a new exploded war file. I can see the class files change - but nothing is reloaded in tomcat.
Can anybody please elaborate? Is this approach even possible - in contrary to what many posts suggest? How is it possible in the embedded tomcat in e.g. Grails?

Error renaming to MANIFEST.MF

I am curious about following error :
Publishing to JBoss 7.1 runtime server - MyEAP has encountered problem
Error renaming C:\(some path) to (MyEAR proj path)\(my war file)\META-INF\MANIFEST.MF
you can change these settings in server etc...
I have created a simple EAR project along with a dynamic web project with stuts2. I am deploying EAR file and everything is working fine but whenever I make changes to any file and save I get this error message. What is the exact meaning of this message?
Thanks
Maybe the problem to be that it is necessary to configure a scanner for external deployments.
See: 'Publishing to JBoss 7.1 Runtime Server...' has encountered a problem
In previous versions of JBossAS, there was an exposed JMX server with
an option to mark a folder as one that the deployment scanner should
look at. This option still exists in AS7, but, we haven't integrated
with the management ability yet. THis means we can't do it on the fly,
currently, in the current toolset is a bit hurt by this missing
feature.
It is still possible in the raw configuration of the server, howerver.
This means you can mark your server directly to scan some external folder by modifying
your configuration and adding a deployment scanner. The instructions for it are over here:
https://community.jboss.org/wiki/DeployingAnApplicationFromAnExternalDeploymentLocation
To make use of this, double-click your jboss-7 server inside eclipse
to open the server editor. You can then switch over to the second
page, "Deployments", where you can change the deployment method to
"custom" and set any folder that's on the same filesystem as your
eclipse installation. Once this is done, you can add that folder to
your server's deployment scanner lists as per the wiki above.

debug java web application packaged as war file in eclipse

I am new to web applications in java and need a bit of help with this. I have a multi module project set up in eclipse, which also contains WEB-INF/lib directory of the WAR.
In the non-web version i can debug though it fine however when i deploy it to weblogic i am encountering errors which i dont get on my local workspace, so i'm trying to deploy it using tomcat. I installed tomcat and deployed the war file onto it. I see a blank page (which is normal - essentially the application has a listener, i send it a jms message and that kicks off the process afterwards) but i dont know how to put a break point so i can step though the code - line by line - if this is possible?. Would appreciate some references / reading material.

Categories

Resources