[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Messages posted by: ngromov  XML
Profile for ngromov -> Messages posted by ngromov [4]
Author Message
HotSwapAgent jdk17 + Tomcat9064 - Refrain from loading libraries redundantly/unnecessarily.

in case of bypassing the conflict between redundant loading of libraries, such as Hibernate, where startup produces an error similar to:

Code:
 Caused by: java.lang.ClassFormatError: Duplicate method name "_buildSessionFactory" with signature "(Lorg.hibernate.service.ServiceRegistry;)Lorg.hibernate.SessionFactory;" in class file org/hibernate/cfg/Configuration
 



you should probably set the argument -XX:HotswapAgent to ``core`` instead of ``fatjar``.

The properly way is just to use the variable ``disabledPlugins`` and extend it by ``Hibernate`` to exclude one (more here .). It should be like ``disabledPlugins=Hibernate``

Both ways worked for me good.
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]
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.
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
 
Profile for ngromov -> Messages posted by ngromov [4]
Go to:   
Powered by JForum 2.1.6 © JForum Team