I read in a forum that Weblogic comes with a version of Spring inside it, but I have been searching how to use that and I didn't find a way.
Is it true?
Is there a way to deploy a Spring application in Weblogic without put the jars related to Spring inside the application or in Weblogic's lib directory?
Thanks.
Related
I have a web app built with Java, Spring MVC, and JDBC. The result is a WAR file.
To run it, the user has to install Java 8 JDK and Tomcat, and deploy the WAR file to the Tomcat server.
It would be great if they could just download the one file run it as a standalone application.
That is, run "the WAR file" and just browse to http://localhost:8080/myapp
Also, on Windows it would be great it was setup as a Server (like Tomcat is when installed with the installer).
Is there any way to do this? Maybe with Spring Boot or something new like that?
Yep, Spring boot is the way to go.
It allows you to build an executable Jar with all dependencies and a Tomcat (by default, can be changed) embedded.
But users will still need to download a JRE to execute the Jar, and a database if it's required, but you can use en embedded database like H2, HSQLDB..., depends what is your needs.
Yes . you can use spring boot to achieve your results. Kindly refer the below link for sample code
https://mkyong.com/spring-boot/spring-boot-hello-world-example-jsp/
You can use embedded jetty server using maven but that would require you to setup few things your app and may have align your existing app, please check this article for more information.
Jetty is similar to tomcat server in terms of running spring application, there are not much difference in terms of development. Tomcat is just more famous.
Other option as others said, is to migrate your app to spring boot which would be easy if you already have app written in spring (But that depends how much code you have and how much time you have)
It maybe a trivial question for experienced web application developers, but for me as a new developer, I cannot understand that why do we need an application container(like Tomcat or Wildfly) when deploying a Spring Boot web application to Openshift, Heroku, or Google App Engine, etc? My understanding is that Spring Boot already contains an embedded container (Tomcat). Can someone explain this to me? Thanks
SpringBoot is Java API that relies on an embedded Java Servlet engine to support the API calls. These dependencies are typically pulled in by Maven as dependencies. So for the end user, it just looks like a FAR JAR with a bunch dependencies included (where one of those dependencies is Embed Tomcat, Jetty or Undertow for example)
More information can be found on the main SpringBoot project page.
I have decided to use Liferay for my next project and I'm trying to somehow get an old non-Liferay web application deployed on tomcat 8 that was bundled with Liferay. The application uses servlets.
After some googling I got the impression that it should be possible to simply deploy the application on tomcat which I did. Liferay does pick it up from the /deploy folder but there is an error while deploying it saying web.xml needs to be upgraded to 2.4. My web.xml is almost empty because I use #WebServlet annotatations for servlet mapping.
So my question is, is it possible to deploy a non-Liferay application to tomcat that comes with Liferay without making any changes to it?
You should only place Portlet-WARs into LIFERAY/deploy, as Liferay will try to convert such WARs into a Liferay specific Portlet-WAR, before deploying them in Tomcat.
If you need to deploy a legacy WAR you should place that into LIFERAY\tomcat...\webapps\ and Tomcat will start it without any modification.
I have a Spring Roo app that is deploying to Tomcat with no issues. I'm trying to deploy it to JBoss 6, but I'm finding it impossible to do so.
I've exhausted all resources from Google and I simply receive errors everywhere. Unfortunately, they do not seem specific enough to start narrowing them down to list here.
What can information could I provide to help resolve this situation?
Essentially, I need to know what I need to change from a standard Spring Roo app, using Hibernate and Mysql to work with JBoss 6.
EDIT:
This is the error that I am getting
[ClassLoaderManager] Unexpected error during load of:org.apache.commons.collections.DoubleOrderedMap$1$1: java.lang.IllegalAccessError: class org.apache.commons.collections.DoubleOrderedMap$1$1 cannot access its superclass org.apache.commons.collections.DoubleOrderedMap$DoubleOrderedMapIterator
Impossible to tell, since you posted no errors.
I'm guessing that it's a problem with the configuration difference between JBOSS and Tomcat.
You set up JDBC data source connection pools differently. Tomcat has the context.xml in the server /conf folder. JBOSS has other XML config files in its server/default/deploy folder. Did you create those correctly?
I assume that you're using JNDI names for injected data sources.
Your JDBC driver JAR for MySQL goes in the Tomcat /lib folder and the JBOSS server/default/deploy/lib folder, not the wAR WEB-INF/lib.
But you should be able to take a WAR with all the Spring Roo stuff, put it into an EAR with jboss-web.xml configuration, and start it up.
For a pet project I would like to have an embedded Jetty run a Spring Web MVC app. I've used Spring in web containers (where it's easy to tell "where to start") and I've used embedded Jetty without Spring.
It feels a bit like the chicken or the egg problem if I want both to work together. What is the best way to organize the project? In other words, what shall I put in main()? Should it be a Spring app that happens to have Jetty as a bean (what about contexts then?)? Or should I start Jetty alone and plug Spring in via servlet listener? What are the caveats?
Jetty in a Spring container is used to start webapp, springified or not. The webapp and your webapp don't have the same Spring context without tricks.
So, you have to create a Jetty server in your main, add your webapp and start the server. The best way is using a web.xml like a common Java EE server, and add this descriptor to your Jetty server.
I think it is more reasonable to start Jetty alone and plug Spring in via servlet listener in web.xml. Let Spring manager all the app specific beans and let jetty focus on running your app, and maybe some day you can deploy you app to antoher servlet container without changing anything.
This is one way to embed Jetty in Spring
http://www.springbyexample.org/examples/embedded-spring-web-services.html