JBoss not detecting application deployment - deployment

I have a java webapp deployed on jboss 4.2.3 which used to use the Struts 2.0 library. I recently upgraded it to Struts 2.3.4 and updated all of the code to use the new version.
On my local workstation, I started getting errors referring to code that I removed which depended on the old version of Struts. These errors disappeared when I cleared the contents of the JBoss precompiled JSP folder located at:
jboss\server\<name_of_my_instance>\work\jboss.web\localhost\_\org\apache\jsp
Today, I deployed the new version to our production webserver. I cleared the contents of the JSP precompile directory (listed above) and restarted the webserver.
Whenever a user goes to a page which I modified to remove the Struts 2.0 tags (and replaced them with Struts 2.3.4), they get a server error about Struts being unable to find the Struts 2.0 files. I cannot reproduce these errors on my local instance.
Does anyone have any ideas about what might be configured differently between my local and production webservers? How can I force the production server to read the new webapp that I deployed?
Note - I am using an exploded deployment (not a WAR) and the problematic pages use include files. Here is an example:
myInclude.inc
<s:if test="%{userIsAdmin}">
<%-- Show some toolbar --%>
</s:if>
myFile.jsp
<%# include file="myInclude.inc"%>
Accessing myFile.jsp produces a stack trace since JBoss does not seem to detect that the myInclude.inc file has changed. The old version of myInclude.inc depends on the old Struts 2.0 and the new version does not.

I actually figured it out. My deployment process was broken and the include file wasn't actually making it out to the webserver.

Related

Deployment descriptor in web.xml file is failing to load

I have a web-application that I'm developing using JSP. I'm running the application on Tomcat Server (version 8). In the project explorer view of Eclipse IDE, I'm getting an error saying that the source code could (a JSP file) not be run on server.
I have written my web.xml from scratch. It includes some server options or parameters which are defined by certain xml tags (display names). These display names were missing so I had to modify the web-app tag so that these tags are available. So far so good. The application is fine, but I get a pop-up message from the IDE giving a null pointer exception. I found that it is related to the Project View of Eclipse IDE, and when I switched to package explorer the error is gone but this time when I pick a server page to run on server (the server is running fine) i get another error which says the selection (the jsp file) could not be run on server. I believe this is still a dev environment problem. How can I fix it?

JavaEE Servlet won't hot deploying

I started working with javaEE and currently doing some basic servlet stuff. So I'm using Eclipse neon and GlassFish server. Created a dynamic web project and everything works fine.
The problem are servlet file changes. If there is a change in the java file nothing happens - no hot deploying/ republish. I have to complete remove the application from server and re add it to see the changes.
Changing .html files works (doesn't effect servlets changes)
Rebuild does nothing
Server "clean" does nothing
Server restart does nothing
"Automatically publish when resources change" is of course on, hence the html changes
The problem might be, that it does not observe the correct files for triggering the redeployment.
I haven't tried it for GlassFish, but could see the same behavior for WildFly as you described with the default server settings.
Try to add \.class$ to section Application Reload Behavior in server settings. (This will be the case for exploded deployment.)
Credits to varantes answer in this question

PWC6188: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application

I am working on a dynamic web project in Eclipse Kepler. I am trying to write a simple JSP using JSTL <c:forEach>. For that I have included the required JAR jstl-1.2.jar under libraries and added the following statement to JSP:
<%# taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
However, when I run it using Run as --> Run on Server, it shows the following error.
org.apache.jasper.JasperException: /test.jsp(4,61) PWC6188: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
I have already consulted a lot of links, but I don't understand how this is caused and how I can solve it.
For that I have included the required JAR jstl-1.2.jar under libraries
This makes it only available during compile time, not run time.
You need to undo everything which you did in project's Build Path and Deployment Assembly properties. If you're not sure anymore what changes you've all done over there, then throw away the current project and recreate the project from scratch and remember to never touch the project's Build Path and Deployment Assembly properties until you really really understand what it is doing under the covers (in other words, when you're able to create, build and deploy a WAR from top of head in command prompt without using any IDE).
The proper procedure is:
Open the project's WebContent/WEB-INF/lib folder.
Drop the jstl-1.2.jar file in there.
That's it. Nothing more needs to be done. No need to fiddle anywhere in project's properties. Eclipse will automatically do the necessary magic there.
See also:
Our JSTL wiki page
Update: as per the comments,
web.xml is declared to version 2.4 and I am using Basic Server: J2EE Preview at localhost
There's the cause of your problem. JSTL 1.2 requires a minimum of Servlet 2.5 and "J2EE Preview" is completely outdated. Grab Tomcat 7 (pick the core ZIP file), extract it, integrate it in Eclipse, add the project to Tomcat, fix your web.xml to be Servlet 3.0 compatible, then start Tomcat and enter the desired URL in your favourite webbrowser.
Make sure that jstl-1.2.jar is included in your WEB-INF/lib directory and the deployment assembly.
Right Click Project > Project Properties
Deployment Assembly
Click Add, then Folder
Select the WEB-INF/lib folder.
Just had this problem and nothing straght forward about it online.
SOLUTION:
Add JSTL library to the project libraries

Getting Eclipse to automatically reload the JSP pages in my Java web application

I was given a template of a Struts project to work on, and I noticed that when I run the web project on integrated Tomcat in Eclipse and make changes to the .jsp viewpages, they don't automatically reload after a few seconds - which does happen in other projects I made myself.
So I figured this was a configuration issue and I did some research, I had a look at my Tomcat server settings:
(x) Automatically publish when resources change (1 second interval)
But because my own projects reload and I use the same server for them, I figured it must be an application specific issue.
So I looked at context.xml to see if there was anything to change here
<Context
...
reloadable="true"
...
>
Which I can only assume tells the server to indeed reload the application on changes.
So I really can't figure it out. It seems to me like everything is in order here. What am I missing?
From Apache Tomcat documentation about the Context attributes:
reloadable
Set to true if you want Catalina to monitor classes in
/WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically
reload the web application if a change is detected. This feature is
very useful during application development, but it requires
significant runtime overhead and is not recommended for use on
deployed production applications. That's why the default setting for
this attribute is false. You can use the Manager web application,
however, to trigger reloads of deployed applications on demand.
Also maybe this will be interesting for you: Using Tomcat Reload Features To Speed Up Development
I ran into the same problem, with a Java/Spring project that I imported via its Maven .pom files into Eclipse.
I found that I had to run the project with "Debug" instead of "Run" - only then, changes to my .jsp files were noticed, so that a reload of the web page would show the changes almost instantly.

JBOSS Eclipse Integration

I am working with Eclipse and JBOSS. I was wondering if there is a way to do hot in-place deployment for a web project, by integrating the JBOSS server with Eclipse.
By hot in-place deployment, I mean, I should be able to view the change made to a jsp , by refreshing the page on the browser, not required to go through the routine , build-deploy-test cycle.
Take a look at JBoss Tools. That has everything you need.
JBoss Tools seems to do auto-redeploy by default when you create a web application with their wizard: http://docs.jboss.org/tools/3.1.0.CR1/en/GettingStartedGuide/html/jsp_application.html#AutoRedeploy
AFAIK every time you save a JSP they copy it to the application deploy directory in JBoss, but if your source layout matches the WAR layout they might run the application directly from your project directory (I know some versions of WTP did this with Tomcat, but with JBoss it's probably harder).
You are after "Exploded Hot Deployment" - deploys a directory of your files rather than an archive and then any subsequent "explode" will only deploy changes rather than the whole project (depending on how you have Ant configured).
Frameworks like Seam do this for you. Maybe worth grabbing a build.xml file from them and modifying it for your use?
Have you tried using JSP-Weaver?
Here is the Wikipedia description:
JSP Weaver is a JavaServer Pages
interpreter. Unlike JSP compilers it
evaluates the JSP files directly,
without generating or compiling
intermediate Java source files for the
JSP Java servlet.
Although this sacrifices some
performance on page rendering (10%-20%
overhead depending on the compiler in
question) it enables a much faster
reloading of changes made to the
source of the JSP file (10-20 times
decrease in time depending on the page
and the compiler in question).
Unlike simpler attempts at
interpreting JSP-like syntax (e.g.
Facelets) it supports embedded Java
statements called Scriptlets (a
standard JSP feature). This allows
full compatibility with the JSP
specification versions 1.0 to 2.1.
I also agree with Sietse in you should check out JBoss Tools. It is a great free alternative to the JBoss Developer Studio