idea cannot hot deploy files under src/main/resources - intellij-idea

i am using idea ultimate 2020.3
i created a maven web project.
when i changed java or jsp files and choose update class and resources, they can be hot deploy.
however, if i changed files under src/main/resources, e.g. mybatis xml file under src/main/resouces/config/mapper, they cannot be hot deploy.
how can i fix it?

Make sure you are deploying an exploded artifact, see Update applications on application servers
Also make sure the module has configured Web resources (has the Web facet with Web Resource Directories and Source Roots configured:

Related

Intellij Hot swap webapp folder not working

I am running a simple Maven web application using spring. My project structure is as following
src-main-java
src-main-webapp
My HTML file in the webapp folder. When I do update class and resource in debug mode it updates my Java classes but not my HTML files.
How to fix this?
There is a known issue. You may need disable cache in your view resolver. then it should work just fine.
e.g. resolver.setCacheable(false); for Spring or ThymeLeaf application.
Use exploded artifact which name ends with .war or .ear.
See more here:
IntelliJ hot swapping classes, but not JSF pages

More then one project with log4j2 on Glassfish

I'm having an EAR project, consisting from 3 modules/projects: WEB, EJB and JPA. In WEB project, i have added log4j2 for logging. Therefore i've putted log4j2.xml file into WebContent/WEB-INF/ direcotry.
Now, i have made two projects out of one: the developer version and the test version. The differs mainly in project name. They also have different file location configured in log4j2.xml file, to which to write logs.
When i deploy only one project (for instance developer version), everything works fine. However, when im deploying both projects, then, both of them are logging to the same file (it is always the file configured in log4j2 from the project that was deployed first).
My Glassfish version is 3.1.2.2 and Log4j2 version is 2.0.2.
Does any one konws how to solve it?
The log4j2 manual has details on configuration for web applications.
Are the log4j2 jar files also in the WebProject1/WEB-INF/lib and WebProject2/WEB-INF/lib folders (and not in some shared location)? That way the log4j2 classes will be loaded by separate webapp class loaders and they can have separate configurations.

Can we deploy web application as a folder instead of war file in JBoss AS 7

I am having two queries
1. Can I deploy web application as a folder instead of war file in JBoss AS 7?
2. If not ,how to update the JSP or html or js files with out building/deploying the war file again?
JBoss supports the ability to deploy an archive file or as an exploded directory. To explode a Java EE archive, unzip the archive to a directory that is named the same as the archive file. As long as the directory name has the correct extension (.war, .ear, etc.) JBoss will deploy the directory normally. So if your war file has name HelloWorld.war, your exploded directory name should be HelloWorld.war too.
Please also note that it is recommended to edit your deployment-scanner in the standalone.xml configuration file and changing auto-deploy-exploded property back to false for exploded deployment. Quote from JBoss 7.1 Documentation:
Manual deploy mode is strongly recommended for exploded content, as
exploded content is inherently vulnerable to the scanner trying to
auto-deploy partially copied content.
Edit:
Please see link https://community.jboss.org/thread/200114. Looks like this is a confirmed bug in JBoss 7.1.1 that JBoss ignores the configuration in jsp-configuration and does not reload modified jsp. It is fixed in 7.1.2. You need to build 7.1.2 nightly build yourself. Or talk to JBoss Support if you have Enterprise support.

Packaging Apache configuration files with WAR

I have built a Spring 3 MVC driven RESTful web service app. I use Maven 2 to manage the application lifecycle including packaging up the WAR for distribution. As part of the end solution, I filter application requests through Apache to handle some of the GET requests for static content. This of course requires that I have several custom configurations in Apache configuration files.
My question is this, I would like to package and version these Apache configurations with ( not inside) the WAR, is there a clean way to do this? (using maven?)
Currently, the configuration changes are just included as installation instructions.
My question is this, I would like to package and version these Apache configurations with (not inside) the WAR, is there a clean way to do this? (using maven?)
I'd put such files in a dedicated module (with a pom packaging) and use the Maven Assembly Plugin to create a .zip archive to be unzipped on the target machine(s) and that would be part of the delivery.
Worked pretty well in the past.

Add items to application (WAR) classpath in WebLogic 10?

My shop has been running Oracle's Application Server for several years. As such, before we knew better, we have developed a norm of having application config files stored outside of the WAR file and the app-specific config directory is added to each application using an Oracle-specific deployment descriptor. This deployment descriptor allows us to add classpath elements at the application layer rather than having to include all dependencies in the WAR.
Now we are faced with upgrading to WebLogic 10.3 and I need to find an alternative for our applications that depend on external configs.
Is there a way in WebLogic to add external jars or directories to the classloader at the application level? I've found ways to add them to the system classloader, but I'd prefer to add them to the application level to avoid having to re-work the applications beyond modifying deployment descriptors.
Is such a thing possible in WebLogic 10?
After further research, we've learned about WebLogic's Generic File Loading Overrides feature.
This feature allows us to use a Deployment Plan for our application and specify a "config-root" for the application. Within the config-root, we can create a directory called "AppFileOverrides" and override any file in the WEB-INF/classes or WEB-INF/lib directories.
This feature works by injecting a classloader just in front of the Web Application classloader, thus any resource loaded from the classpath will be found in this classloader before anything bundled into the web application archive.
Using this feature, we are able to add configuration files (and in theory, classes) that don't exist in the war file at all. Thus, we are able to mimic the functionality of keeping configuration files outside the war.
Moving forward, I'm encouraging our developers to include the configurations inside the war file, but this will work nicely for legacy apps and for situations where we need to change the configuration for a given deployment target (dev vs production)
External jars can be referenced by deployments using the shared libraries.
Roughly, the external jars should be 'deployed' as libraries. Then they can be referenced from your app's weblogic-application.xml using library-ref descriptors.
refer to this doc.
Though, I dont think you can provide external directories/config files other than by using system classpath.
To my knowledge, this is not possible with Weblogic. External configuration files need indeed to be added to the system classpath. You can tweak a bit the classloader (see filtering and loading order) but there is nothing allowing to add dependencies at the "application level" a la OAS. For this, you'll have to run separated domains if the scenario mentioned above is not an option.