Why AEM as war file? - jar

Adobe Experience Manager is downloadable in two format: either as a standalone jar File(which has Apache Felix as the OSGi Container, CRX as the repository, Apache Sling for content delivery and it's own Servlet Container which i believe is jetty nowadays).
and also as a war file. apart from the application server part, this war file has all the other elements and war is deployed on say WebSphere or Apache Tomcat.
i don't seem to understand what is advantage of having AEM as a .war file when a standalone jar will do the work.
Thanks

Some users want to use war files as that's what they are used to in their environments, but you are right that the runnable jar does the job just fine, with a simpler environment.

with a war file, we can deploy it to EJB server like Jboss

Related

Can you deploy a message driven bean packaged as a EJB JAR on Weblogic?

Hi I am new to Weblogic and I am trying to figure out how to deploy a MDB properly. I have an EAR project that contains my Beans and config files, am I able to export that as a JAR and deploy that onto the Weblogic server?
EJB's can be deployed as JARs (see oracle docs section "Using Archived Files")
and the jar should contain the deployment descriptor xml / Annotations (e.g. #MessageDriven ) that configures the MDB.

Spring Boot static files deployed via WAR with bad encoding

I am working on a project with spring boot web to serve a rest API (and using react.js on frontend) where embedded tomcat and dev-tools is used in development phase but is deployed to a jboss server via war file.
To keep consistency between dev mode and deployment mode, I am copying my front-end files to the classpath directory classpath:/public. This way of working is being very productive and I liked it.
The problem that is happening is that these front-end files have special characters (Portuguese characters) and only when I serve my application via WAR in jboss these characters are being displayed with problems. When I serve with embedded tomcat everything works fine.
Thanks in advance.
Spring MVC defaults to ISO-8859-1, embedded Tomcat overrides it to UTF-8, see https://github.com/spring-projects/spring-boot/issues/1182
I fixed it with property spring.http.encoding.force=true

example stand alone application using EJB-MDB, eclipse, jetty server?

how to develop one example application using EJB-MDB, eclipse, jetty server?
I have created two java class. and i have .jar file, where I have to deploy .jar file in jetty server? after that what I have to do?
Your requirement for EJB-MDB seems to demand a full blown server like Jboss, Glassfish, TomEE and others. If you need jetty with the equivalent of EJB MDB functionality probably you should look at Spring-Boot. On the other hand if you need EJB/MDB compatibility you should probably choose an Application server and each of these comes with a plethora of examples and quickstarts, but each one comes with it's own Servlet Container respectively Undertow, Tomcat, Grizzly, but not Jetty.

Spring web app deploys on Gradle's embedded Jetty but not in standalone Jetty

I have built a small web app using Gradle. Things seemed to be going well using the embedded Jetty server, but not so well when I tried to copy the WAR file to a standalone server.
I used the gradle war plugin to assemble the war.
Running gradle jettyRunWar works fine.
Copying the war to the Jetty webapps folder and running Jetty fails with this exception:
java.lang.IllegalStateException: No such servlet servlet_name
But this very same servlet is found and used without issue in the embedded Jetty server.
The same issue happens if I manually copy the exploded war to the webapps directory.
The Spring web and Spring mvc libs are copied and present in the WEB-INF/libs directory, so it isn't an issue of not finding Spring (or is it?)
I'm using Jetty 9.1, and my web.xml file is configured for Servlets v3.
I'm also using Spring 3.2. The web app I'm writing is a RESTful service, using the #Controller annotations to route requests.
This should be as simple as copying the war over, but it seems not to be. At a bit of a loss at what to do here, any thoughts?
Thanks!
Sometimes the answer is staring you in the face...after posting I realized that I had my servlet-mapping before my servlet declaration. While this did not present an issue for the Gradle Jetty (not sure why), it made Jetty unhappy. Not sure why I changed the order to begin with...
In short, Jetty seemed to not find the servlet because it had not been declared yet.

Deploying More Jar files (Own) in server

I am new to deployment and development of web applications.
Suppose I create three jar files and deploy them on a Tomcat server. I use maven to install the jar file and to deploy.
How is it possible to call a method in another jar file?
For example:
I developed a simple application in mytwitter.jar.
Then, I create myapp.jar, where one of the classes needs to call a method in mytwitter.jar.
Do I first deploy mytwitter.jar to the server and myapp.jar later?
You package all of the JARs you need (yours and 3rd party alike) into a WAR file which is what gets deployed to the Tomcat server. So in your maven config you likely already have dependencies configured for things like the twitter API and other packages. Just add your own JARs in there as well and then your code has access to it like anything else.

Resources