[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
CC with Spring Boot  XML
Forum Index -> Deployment Go to Page: 1, 2 Next 
Author Message
tfrech



Joined: 18/03/2017 14:58:58
Messages: 3
Offline

Hi there!
As Björn suggested, I want to share our current work in progress concerning Spring Boot with the community. My hope is, that it will be improved by all Spring Boot users and the improvements are shared here again.

CaptainCasaConfig does the initial CC-Configuration. Not all contents from the usual web.xml have been transfered into this format since this is work in progress and we are only using the RISC approach.

A_JSFConfig initializes JSF. Right now it is still important that the Class name is ordered before the CaptainCasaConfig. I know, this is ugly and needs improbement.

faces-config.xml is an example config. In our case a special Dispatcher is configured, that includes the Spring beans. There may be other ways (with Spring Boot config) that still need some exploration. I just wanted to share what works for us ATM.

Cheers,
Tobias
 Filename CaptainCasaConfig.java [Disk] Download
 Description initial CC-Configuration
 Filesize 3 Kbytes
 Downloaded:  16365 time(s)

 Filename faces-config.xml [Disk] Download
 Description /PROJECT/src/main/webapp/WEB-INF/faces-config.xml
 Filesize 464 bytes
 Downloaded:  16525 time(s)

 Filename A_JSFConfig.java [Disk] Download
 Description JSF initialisation
 Filesize 1 Kbytes
 Downloaded:  16528 time(s)

CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5518
Offline

Thanks a lot for this information!
Björn

Björn Müller, CaptainCasa GmbH
mreich

Power User
[Avatar]

Joined: 30/01/2009 08:34:23
Messages: 744
Offline

Hi,

I'm very interested in your approach with Spring Boot are there any news on this, how are doing?

regards
Markus
[WWW]
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5518
Offline

Hi Markus,

in the meanttime (since 6 weeks) we provide a Maven project archetype for SpringBoot.

Please follow the steps in http://www.captaincasa.com/pdf/eclnt_risc_maven.pdf but select the SpringBoot project archetype - not the default Maven one.

Regards, Björn

Björn Müller, CaptainCasa GmbH
mreich

Power User
[Avatar]

Joined: 30/01/2009 08:34:23
Messages: 744
Offline

Wow!!! Very nice ...
[WWW]
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5518
Offline

...just remember that I recorded a movie on this, but I never published it...

https://youtu.be/JdcKiV3_UTQ

Regards, Björn

Björn Müller, CaptainCasa GmbH
mreich

Power User
[Avatar]

Joined: 30/01/2009 08:34:23
Messages: 744
Offline

FYI

there's a resource missing, as it is just RISC it's not necessary, but the error is annoying at server startup.

java.lang.ClassNotFoundException: jnlp.sample.servlet.JnlpDownloadServlet
[WWW]
afikri


[Avatar]

Joined: 23/03/2020 07:28:27
Messages: 2
Location: stuttgart
Offline

Hi,
does spring boot still work with the new cc version?
The archetype eclntwebapparchetypespringboot is commented out in the file
https://www.captaincasademo.com/mavenrepository/archetypecatalog.xml

Regards
Ahmed
[WWW]
afikri


[Avatar]

Joined: 23/03/2020 07:28:27
Messages: 2
Location: stuttgart
Offline

Hi,
It would be very nice if I can use CC with Spring Boot. I saw the captain's video, but with version 20200323 I get the following error message:

java.lang.NoClassDefFoundError: org/owasp/esapi/ESAPI
at org.eclnt.util.log.CLogLogger.log(CLogLogger.java:47) ~[eclntjsfserver-20200323.jar!/:na]
at org.eclnt.jsfserver.util.InitEclntJsfServer.initLogging(InitEclntJsfServer.java:336) ~[eclntjsfserver-20200323.jar!/:na]
at org.eclnt.jsfserver.util.CCInitialize.initializeCCEnvironment(CCInitialize.java:34) ~[eclntjsfserver-20200323.jar!/:na]
at org.eclnt.jsfserver.util.CCFilterBase.init(CCFilterBase.java:12) ~[eclntjsfserver-20200323.jar!/:na]
at org.eclnt.jsfserver.util.ThreadingFilter.init(ThreadingFilter.java:80) ~[eclntjsfserver-20200323.jar!/:na]
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285) ~[tomcat-embed-core-8.5.28.jar!/:8.5.28]
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:112) ~[tomcat-embed-core-8.5.28.jar!/:8.5.28]
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4599) [tomcat-embed-core-8.5.28.jar!/:8.5.28]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5241) [tomcat-embed-core-8.5.28.jar!/:8.5.28]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.5.28.jar!/:8.5.28]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) [tomcat-embed-core-8.5.28.jar!/:8.5.28]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) [tomcat-embed-core-8.5.28.jar!/:8.5.28]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_211]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_211]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_211]
at java.lang.Thread.run(Thread.java:74 [na:1.8.0_211]

2020-03-30 12:08:10.032 ERROR 14884 --- [ost-startStop-1] o.apache.catalina.core.StandardContext : One or more Filters failed to start. Full details will be found in the appropriate container log file
2020-03-30 12:08:10.039 ERROR 14884 --- [ost-startStop-1] o.apache.catalina.core.StandardContext : Context [] startup failed due to previous errors

Does anyone have any idea what the problem may be here?

Regards
Ahmed
[WWW]
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5518
Offline

From 20200928 on there is a Spring Boot project archetype. Please check http://www.captaincasa.com/docu/techdoc_springboot/

Björn

Björn Müller, CaptainCasa GmbH
ngromov


[Avatar]

Joined: 02/10/2020 12:54:23
Messages: 4
Offline

Hello dear Björn,

is there any manual how to convert the "non-SpringBoot CaptainCasa Project (e.g. v.20200928 or earlier) to the "SpringBoot CaptainCasa v.20200928" ?
The DIY you have submitted (SB) works perfect, but only with a new installation.

I'm thinking about how to extend the old pom.xml with Code:
org.springframework.boot
dependencies to force the old non-SB project to consume all benefits of Spring Boot framework, but that is not the only step I should perform to integrate SB into the old project.
The SBApplication class should be also implemented into the new package Code:
/springbootstratup
as well, as I see.

Maybe there is a way how to extend already created project with the Code:
eclntwebapparchetype_springboot
or something like this?

Regards.
Nikita
[ICQ]
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5518
Offline

Hi Nikita,

this is the "nice" thing with the Maven-project-archetypes. They contain the knowledge how to set up a project - but it's difficult to find what has changed between different versions...

My proposal: could we do a screen share session (we use Zoom, if you propose something different: also fine) and then we convert your project.

And if we succeed (what I strongly assume...) we write the results into this post! ;-)

Please contact me directly by mail for arranging the session.

Regards, Björn


Björn Müller, CaptainCasa GmbH
ngromov


[Avatar]

Joined: 02/10/2020 12:54:23
Messages: 4
Offline

Hi Björn,

thank you for your suggestion. We will discuss this approach on Wed. this week, because we would like to be present as a whole team)). Today I will try to realize the integration by myself.
If that is done successfully I will write down the documentation otherwise we have to solve this problem with your support.

Regards. Nikita.
[ICQ]
ngromov


[Avatar]

Joined: 02/10/2020 12:54:23
Messages: 4
Offline

Could integrate the old project under 20200831 into the 20200928 with Spring Boot without creating a new archetype (as a new project) and no additonal effort. It took some time to understand what is happening between SBApplication.class and who calls the Dispatcher.class but now it's ok. Here is my DIY. Maybe can be helpful for other people.

Step1.
pom.xml

Code:
 <parent>
 		<groupId>org.springframework.boot</groupId>
 		<artifactId>spring-boot-starter-parent</artifactId>
 		<version>2.3.4.RELEASE</version>
 		<relativePath/> <!-- lookup parent from repository -->
 	</parent>
 	<groupId>de.xx.xyz</groupId>
 	<artifactId>xyz</artifactId>
 	<version>1.0.1-SNAPSHOT</version>
 	<name>xyz Webapp</name>
 


and this one :

Code:
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-web</artifactId>
 		</dependency>
 
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-tomcat</artifactId>
 			<scope>provided</scope>
 		</dependency>
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-test</artifactId>
 			<scope>test</scope>
 			<exclusions>
 				<exclusion>
 					<groupId>org.junit.vintage</groupId>
 					<artifactId>junit-vintage-engine</artifactId>
 				</exclusion>
 			</exclusions>
 		</dependency>
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-actuator</artifactId>
 		</dependency>
 
 		<!-- ... -->
 
 		<dependency>
 			<groupId>javax.servlet.jsp</groupId>
 			<artifactId>javax.servlet.jsp-api</artifactId>
 			<version>2.3.3</version>
 		</dependency>
 
 		<dependency>
 			<groupId>org.eclnt</groupId>
 			<artifactId>eclntjsfserver</artifactId>
 			<version>${cc.version}</version>
 		</dependency>
 		<dependency>
 			<groupId>org.eclnt</groupId>
 			<artifactId>eclntjsfserver_jsfimpl</artifactId>
 			<version>${cc.version}</version>
 		</dependency>
 


Step 2.
xyz/src/main/webapp/WEB-INF/web.xml

Code:
   <!--listener>
     <listener-class>org.eclnt.jsfserver.util.HttpSessionListenerDelegator</listener-class>
   </listener-->
   <!-- ********** LISTENERS ************************************************ -->
   <listener>
     <listener-class>org.eclnt.jsfserver.util.CCServletContextListener</listener-class>
   </listener>
 


Step 3.
of course the new new SBApplication should be created under Code:
xyz\src\main\java\springbootstartup\SBApplication.java
with Content:

Code:
 package springbootstartup;
 
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 
 import org.eclnt.jsfserver.util.CCInitialize;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.web.servlet.ServletContextInitializer;
 import org.springframework.context.annotation.Bean;
 
 @SpringBootApplication
 public class SBApplication
 {
     public static void main(String[] args)
     {
         SpringApplication.run(SBApplication.class, args);
     }
 
     @Bean
     public ServletContextInitializer initializer()
     {
         return new ServletContextInitializer()
         {
             @Override
             public void onStartup(ServletContext servletContext) throws ServletException
             {
                 CCInitialize.initializeCCEnvironment(servletContext);
             }
         };
     }
 }
 


Actually original from new archetype.

Step 4.

The Dispatcher as well. Actually original from new archetype:

Code:
 package managedbeans;
 
 import org.eclnt.workplace.WorkpageDispatcher;
 import org.eclnt.workplace.IWorkpageContainer;
 import org.eclnt.workplace.WorkpageDispatcher;
 
 /*
  * The dispatcher is referenced in faces-config.xml. When changing the package
  * of the dispatcher, then also update the faces-config.xml link!
  */
 public class Dispatcher extends WorkpageDispatcher
 {
     /**
      * This method needs to be implemented if you want to extend the page bean browser tool.
      */
     public static DispatcherInfo getStaticDispatcherInfo() { return new DispatcherInfo(Dispatcher.class); }
 
     /**
      * Returns the expression under which the dispatcher can be reached.
      */
     protected String getRootExpression() { return "#{d}"; }
 
     // ------------------------------------------------------------------------
     // constructors
     // ------------------------------------------------------------------------
 
     /**
      * Dispatcher that is used for the root object, e.g. "#{d}".
      */
     public Dispatcher()
     {
         // add any implementation...
     }
 
     /**
      * Dispatcher that is used for the sub dispatcher objects, e.g. "#{d.d_1}".
      */
     public Dispatcher(IWorkpageContainer workpageContainer)
     {
         super(workpageContainer);
         // add any implementation...
     }
 
 
 }
 


Step 5.
Extend file [code]src/main/resources/application.properties[code]

[code]
management.endpoints.web.exposure.include=*
management.endpoint.shutdown.enabled=true
endpoints.shutdown.enabled=true

app.name=XYZ
app.description=${app.name} is a Spring Boot application

server.port=9003
[code]

Step 6.
Start project (.war) from terminal automatically with given ports. Type in terminal:
[code]java -jar xyz.war[code]

Step 7.

Shutdown XYZ project and terminate the PID. Type in terminal:

[code]curl -X POST localhost:9003/actuator/shutdown[code]
[ICQ]
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5518
Offline

...wow! THANKS a lot for this contribution! - Björn

Björn Müller, CaptainCasa GmbH
 
Forum Index -> Deployment Go to Page: 1, 2 Next 
Go to:   
Powered by JForum 2.1.6 © JForum Team