redeploy on fly war in EAR with multiples war (wildfly) - war

It is possible to have several war in one EAR.
But is it possible to replace only one war in the EAR while deploying on admin console for example ?
example :
EAR
WAR1
WAR2
then i have to redeploy only WAR1 not entirely EAR

No, you'd need to redeploy the entire EAR. If it's just an EAR with several WAR's then you could just deploy each WAR separately.
However you may be able to use a deployment overlay.

Related

Building alfresco.war and share.war using alfresco All-in-one (wars)

I have went through the Alfresco All-In-One sdk steps and I am able to generate the share.war but not able to generate alfresco.war. It shows only the folder structure as shown in above site.
How can I generate alfresco.war?
Whats repo.war?
How to test that the share.war and alfresco.war are properly build?
"Repo" means "repository" and Alfresco is a repository. The WAR that gets created by default matches the directory that project is sitting in, which is called "repo" which is why the WAR is called "repo.war". So "repo.war" can be deployed to your Tomcat server and renamed to "alfresco.war" as they are the same.
You can add your own unit tests to your Alfresco SDK project if you'd like. But there are no standard unit tests that ship with the SDK.
Opinions differ about this, but I would not deploy the WAR files produced by the All-in-One project. Instead, move your AMPs to the server, then use the MMT to install them. That way, you are just testing your local AMPs and you know those work and you have less to move.

Is moving jar files from WEB-INF/lib and WEB-INF/lib-provided to <TOMCAT>/lib a good idea?

I have a Spring Boot MVC Application which I intend to deploy as WAR file in Tomcat8. I noticed, the WAR contains all dependencies on WEB-INF/lib and WEB-INF/lib-provided folders. I verified that moving all contents of these dependencies folders to <TOMCATDIR>/lib removes the necessity of having those jars in the WEB-INF/lib* folders, so I moved them all. The application is working as expected.
Suppose, I have many WARs that need to be deployed on the same server and most of them have similar dependencies. Having all the JARs in individual applications' library folders seems like a waste of space to me.
My question is, is it a good idea to move all the JARs from individual applications' library to the Tomcat's library? Will it cause me any problems in future? If it will, what sorts of problem am I likely to come across?

How to share jar within multiple portlets?

I'm using several jars in my portlets, for instance c3p0. Now I want to avoid to put the jars in every of my portlets lib folders. How can I share one jar file within multiple portlets? And how should I integrate them in the Eclipse IDE? Add an external jar or put them in one dedicated project and include them from there?
Another solution would be to put them under ../liferay-portal-<version>/tomcat-<version>/webapps/ROOT/WEB-INF/lib
If you place them here you can add the JAR as a dependency for your portlet in the portlets liferay-plugin-package.properties (if you're using Liferay Developer Studio or Liferay IDE then there's a nice GUI for this).
Then on deployment Liferay will copy the required JARS from ROOT/WEB-INF/lib to your portlets WEB-INF/lib
This I believe is the Liferay support mechanism for doing it, and doesn't require a restart because the JARs are copied to the portlets classpath on deployment.
One way I can think off is to put all of them in the global path.
For e.g. in Tomcat you could place them at ../liferay-portal-<version>/tomcat-<version>/lib/ext and then when you configure the server-runtime library in eclipse you will have these jars in your build-path.
This link may also help you decide, but it speaks for *-service.jar but I am not sure it would work other jars in any one portlet.

How to *correctly* upload a WAR and its dependencies to Tomcat7 in Ubuntu

I would like to know how to upload a WAR file separated from its dependencies.
For example, you upload al the dependecies and leave them in the classpath
then you upload your WAR file without the dependencies packed in it.
When you are testing you servlet this is very useful as you don´t have to upload
a big WAR file with small changes everytime you need to correct something.
The problem is that sometimes it works and some other times it doesn´t.
So is there an official correct way of doing this?
Of course just packing everything into the WAR file does the job.
If your WAR file has dependencies that are outside of it, then you will need to restart Tomcat whenever you update those dependencies: there is no such thing as a CLASSPATH for a WAR file other than what the container builds for you (which will include the stuff in the webapp's WEB-INF/classes and WEB-INF/lib/*.jar, plus all the libraries guaranteed to be available by the container like servlet.jar, etc.).
Tomcat allows you to use a shared lib directory but that doesn't auto-reload when libraries are updated, which is likely to be causing the "inconsistent" behavior that you are observing.
The official correct way of doing this is to upload the whole WAR file: that's what they are for.

How to deploy maven generated war file to STS's tc server?

I've created a maven project from a spring-ws example and imported into STS (by using mvn eclipse:eclipse and importing it). It comes with a war file, which I'd like to deploy to the server, from STS or otherwise. Any idea how to do this?
My suggestion would be as follows:
remove your project from STS
run mvn eclipse:clean on the command line
import the mavan project into STS as a maven project and use m2eclipse
Open the servers view
Drag and drop the project onto the server
This should be sufficient for deploying onto tcServer. You may be able to skip steps 1-3, but I am not sure if your maven generated .project file will be sufficient for WTP to know that the project can be run on tcServer. Worth a try, but I think you'll have to do the full 5 steps.

Resources