Re: Soffit does not run as a WAR within Tomcat

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Soffit does not run as a WAR within Tomcat

Drew Wills

Leigh,

Nice work sorting these details out.

Some of this info is in the documentation:

  - https://jasig.github.io/uPortal/developer/soffits/minimal_soffit.html

I know it covers...

  - Choose Packaging=War (https://start.spring.io/)
  - Include spring-boot-starter-web dependency
  - Include tomcat-embed-jasper dependency

But I don't think it mentions the SpringBootServletInitializer.  (It's probably the case that start.spring.io with Packaging=War generates this part for you.)

It wouldn't hurt to describe the process of converting a jar-based Spring Boot Soffit to war-based.  There are probably a few extra nuances to that path.

drew

On 11/23/18 7:27 AM, [hidden email] wrote:

We recently decided to switch all of our Portlets to Soffit WARs, which would run along side uPortal within the same Tomcat instance. This seemed like a straightforward task but I encountered a nasty issue that didn’t generate any exceptions and took several hours to diagnose and fix. I thought it best to share the solution with the community as I am sure someone will run into this nightmare again.


So to switch a Soffit to a Tomcat WAR you simply add  the following to build.gradle


apply plugin:'war'
compile
('org.springframework.boot:spring-boot-starter-web')
providedRuntime
('org.apache.tomcat.embed:tomcat-embed-jasper')

With this configuration your project will produce an executable war which will work only outside of Tomcat when you run it with  java -jar. If you try and add it to Tomcat it will do absolutely nothing except serve up static assets. It won't generate any exceptions and will cause a great deal of confusion.

Solution


I failed to realize that I needed to extend the class org.springframework.boot.autoconfigure.SpringBootServletInitializer within my App class.

@SoffitApplication @SpringBootApplication public class App extends SpringBootServletInitializer {   public static void main(String[] args) {      SpringApplication.run(App.class, args);   } }

Once added the the Soffit worked within tomcat.
--
You received this message because you are subscribed to the Google Groups "uPortal Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/a/apereo.org/group/uportal-dev/.

--
You received this message because you are subscribed to the Google Groups "uPortal Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/a/apereo.org/group/uportal-dev/.