How to do Class Loading in Tomcat - apache

How to do Class Loading in Tomcat
In my web app folder I have deployed a war and in that war there are some libraries which are clashing with my tomcat lib folder. Also, I don't want to remove any of my libraries.

If you are not ready to remove your libraries you can go on with removing those package with Tomcat AS.But could you be more accurate in your description.What are libraries that leads to conflicts? What are you packging in your war file?

Related

Tomcat axis2 multiple versions of a library that use for different web apps

I would like to ask about whether Tomcat able to have multiple versions of a library in WEB-INF/lib directory or not?
Because I read from Tomcat documentation.
WebappX — A class loader is created for each web application that is deployed in a single Tomcat instance. All unpacked classes and resources in the /WEB-INF/classes directory of your web application, plus classes and resources in JAR files under the /WEB-INF/lib directory of your web application, are made visible to this web application, but not to other ones.
Eg. That multiple versions of a library called a-1.0.jar and a-2.0.jar that will be stored in WEB-INF/lib.
In WEB-INF/services, have myApp.arr and otherApp.arr.
myApp.arr will use a-1.0.jar only
otherApp.arr will use a-2.0.jar only
I had tried to put those libraries in WEB-INF/lib but it prompt errors NoSuchClassFound.

idea cannot hot deploy files under src/main/resources

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:

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.

java.lang.NoClassDefFoundError in struts project

Exception : java.lang.NoClassDefFoundError
I am trying to run a small struts projects.
It's working fine when all the required jars are placed in lib folder.
Following apporaches are not working.
Add Jars
Add External Jars
User Library
Web App Libraries of other project (That project is having jars at lib folder)
There are no compilation errors but NoClassDefFoundError at run time.
Someone please let me know the issue. I would like to use User Library instead of having jars in lib folders for every new project.
All required jars must be deployed with the application; that's just how web apps work.
In some circumstances, libraries can be put in the app container's library. I would not recommend this for the Struts libraries. In general I wouldn't recommend it at all.
Simply its the cause of using a class not found in jars library and i dont advice too to use this protocol as says before

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.