Hello everyone
As I want to integrate the XDS tutorial into a Spring Boot project,
I need to transform its startup method. I don't want to start Tomcat directly from Server.groovy. Here, I would like to seek everyone's help. (PS: I'm not familiar with Apache Camel and Groovy)
In order to integrate the XDS tutorial into Spring Boot, I made the following attempts:
First, I tried to start the XDS tutorial in a Spring Boot manner,
so I converted the Beans configured in the context.xml to Java configuration.My Configuration.java is as follows:
import org.apache.camel.spring.SpringCamelContext;
import org.openehealth.ipf.commons.audit.DefaultAuditContext;
import org.openehealth.ipf.commons.audit.queue.RecordingAuditMessageQueue;
import org.openehealth.ipf.commons.ihe.ws.cxf.payload.InPayloadLoggerInterceptor;
import org.openehealth.ipf.commons.ihe.ws.cxf.payload.OutPayloadLoggerInterceptor;
import org.openehealth.ipf.tutorials.xds.DataStore;
import org.openehealth.ipf.tutorials.xds.Iti18RouteBuilder;
import org.openehealth.ipf.tutorials.xds.Iti4142RouteBuilder;
import org.openehealth.ipf.tutorials.xds.Iti43RouteBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
@Configuration
@ImportResource({"classpath:META-INF/cxf/cxf.xml", "classpath:META-INF/cxf/cxf-servlet.xml"})
public class XdsCamelContextConfig {
@Bean
public DefaultAuditContext auditContext(RecordingAuditMessageQueue mockedSender) {
DefaultAuditContext auditContext = new DefaultAuditContext();
auditContext.setAuditEnabled(true);
auditContext.setAuditSourceId("sourceId");
auditContext.setAuditMessageQueue(mockedSender);
return auditContext;
}
@Bean
public RecordingAuditMessageQueue mockedSender() {
return new RecordingAuditMessageQueue();
}
@Bean
public DataStore dataStore() {
return new DataStore();
}
@Bean
public Iti4142RouteBuilder iti4142RouteBuilder() {
return new Iti4142RouteBuilder();
}
@Bean
public Iti43RouteBuilder iti43RouteBuilder() {
return new Iti43RouteBuilder();
}
@Bean
public Iti18RouteBuilder iti18RouteBuilder() {
return new Iti18RouteBuilder();
}
@Bean
public String logFileNamePrefix() {
return "/Users/bovane/Documents/hos-app/logs";
}
@Bean
public InPayloadLoggerInterceptor serverInLogger() {
return new InPayloadLoggerInterceptor("/Users/bovane/Documents/hos-app/logs/server-in.txt");
}
@Bean
public OutPayloadLoggerInterceptor serverOutLogger() {
return new OutPayloadLoggerInterceptor("/Users/bovane/Documents/hos-app/logs/server-out.txt");
}
@Bean
public SpringCamelContext camelContext() {
SpringCamelContext camelContext = new SpringCamelContext();
return camelContext;
}
}
Next, I directly started the XDSApplication,
and its output shows that the routes written in the XDS tutorial have been started. However, when I tested using SOAP UI app, I encountered a 404 error. For example,
when I sent a request to http://localhost:9091/xds-iti41, it returned a 404 error. I am not sure what the reason is. (
However When I directly run Server.groovy, the same request can successfully register documents.) What should I do next to make modifications? The application startup log is as follows
Picked up _JAVA_OPTIONS: -Djavax.xml.accessExternalSchema=all
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.2.RELEASE)
2024-06-12 16:00:21.120 INFO 51020 --- [ main] work.mediway.ihe.XDSApplication : Starting XDSApplication on MacPro with PID 51020 (/Users/bovane/Documents/GitHub/ihe-base/ihe-xds/target/classes started by bovane in /Users/bovane/Documents/GitHub/ihe-base)
2024-06-12 16:00:21.122 INFO 51020 --- [ main] work.mediway.ihe.XDSApplication : No active profile set, falling back to default profiles: default
2024-06-12 16:00:21.382 INFO 51020 --- [ main] o.o.i.c.c.config.ExtensionModuleFactory : Registering new extension module RegRepModelExtension defined in class org.openehealth.ipf.tutorials.xds.RegRepModelExtension
2024-06-12 16:00:21.433 INFO 51020 --- [ main] o.o.i.c.c.config.ExtensionModuleFactory : Registering new extension module MappingExtension defined in class org.openehealth.ipf.commons.map.extend.MappingExtensionModule
2024-06-12 16:00:21.434 INFO 51020 --- [ main] o.o.i.c.c.config.ExtensionModuleFactory : Registering new extension module CoreExtension defined in class org.openehealth.ipf.platform.camel.core.extend.CoreExtensionModule
2024-06-12 16:00:23.069 INFO 51020 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 9091 (http)
2024-06-12 16:00:23.080 INFO 51020 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2024-06-12 16:00:23.080 INFO 51020 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.37]
2024-06-12 16:00:23.187 INFO 51020 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2024-06-12 16:00:23.187 INFO 51020 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1631 ms
2024-06-12 16:00:24.663 INFO 51020 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2024-06-12 16:00:24.767 INFO 51020 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 9091 (http) with context path ''
2024-06-12 16:00:25.467 INFO 51020 --- [ main] o.a.c.w.s.f.ReflectionServiceFactoryBean : Creating Service {urn:ihe:iti:xds-b:2007}DocumentRepository_Service from WSDL: wsdl/iti43.wsdl
2024-06-12 16:00:26.012 INFO 51020 --- [ main] org.apache.cxf.endpoint.ServerImpl : Setting the server's publish address to be /xds-iti43
2024-06-12 16:00:26.045 INFO 51020 --- [ main] o.a.c.w.s.f.ReflectionServiceFactoryBean : Creating Service {urn:ihe:iti:xds-b:2007}DocumentRegistry_Service from WSDL: wsdl/iti18.wsdl
2024-06-12 16:00:26.102 INFO 51020 --- [ main] org.apache.cxf.endpoint.ServerImpl : Setting the server's publish address to be /xds-iti18
2024-06-12 16:00:26.104 INFO 51020 --- [ main] o.a.c.w.s.f.ReflectionServiceFactoryBean : Creating Service {urn:ihe:iti:xds-b:2007}DocumentRepository_Service from WSDL: wsdl/iti41.wsdl
2024-06-12 16:00:26.155 INFO 51020 --- [ main] org.apache.cxf.endpoint.ServerImpl : Setting the server's publish address to be /xds-iti41
2024-06-12 16:00:26.158 INFO 51020 --- [ main] o.a.c.w.s.f.ReflectionServiceFactoryBean : Creating Service {urn:ihe:iti:xds-b:2007}DocumentRegistry_Service from WSDL: wsdl/iti42.wsdl
2024-06-12 16:00:26.174 INFO 51020 --- [ main] org.apache.cxf.endpoint.ServerImpl : Setting the server's publish address to be /xds-iti42
2024-06-12 16:00:26.177 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Apache Camel 3.21.3 (camel-1) is starting
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Routes startup (started:34)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route1 (xds-iti43://xds-iti43)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route2 (xds-iti18://xds-iti18)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route3 (direct://convertToObjRefs)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route4 (direct://findDocs)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route5 (direct://findSets)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route6 (direct://findFolders)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route7 (direct://getDocs)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route8 (direct://getFolders)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route9 (direct://getDocsAndAssocs)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route10 (direct://getFoldersForDoc)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route11 (direct://getRelatedDocs)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route12 (direct://getSets)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route13 (direct://getAssocs)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route14 (direct://getFolderAndContents)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route15 (direct://getSetAndContents)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route16 (xds-iti41://xds-iti41)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route17 (xds-iti42://xds-iti42)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route18 (direct://checkForAssociationToDeprecatedObject)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route19 (direct://checkPatientIds)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route20 (direct://checkHashAndSize)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route21 (direct://checkHash)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route22 (direct://makeDocsReReadable)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route23 (direct://storeDocs)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route24 (direct://updateDocEntriesFromProvide)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route25 (direct://storeDocEntriesFromRegister)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route26 (direct://storeFolders)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route27 (direct://storeSubmissionSet)
2024-06-12 16:00:26.520 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route28 (direct://store)
2024-06-12 16:00:26.521 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route29 (direct://storeAssociations)
2024-06-12 16:00:26.521 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route30 (direct://checkReplace)
2024-06-12 16:00:26.521 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route31 (direct://copyFolderMembership)
2024-06-12 16:00:26.521 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route32 (direct://deprecateTargetDocs)
2024-06-12 16:00:26.521 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route33 (direct://deprecateDocEntry)
2024-06-12 16:00:26.521 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Started route34 (direct://updateTime)
2024-06-12 16:00:26.521 INFO 51020 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Apache Camel 3.21.3 (camel-1) started in 1s403ms (build:21ms init:1s39ms start:343ms)
2024-06-12 16:00:26.522 INFO 51020 --- [ main] o.o.i.commons.core.config.ContextFacade : Re-initializing the registry
2024-06-12 16:00:26.522 INFO 51020 --- [ main] c.s.c.c.SpringConfigurationPostProcessor : Number of extension beans: 1
2024-06-12 16:00:26.539 INFO 51020 --- [ main] work.mediway.ihe.XDSApplication : Started XDSApplication in 5.815 seconds (JVM running for 6.75)
2024-06-12 16:00:26.709 INFO 51020 --- [1)-172.20.6.163] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2024-06-12 16:00:26.709 INFO 51020 --- [1)-172.20.6.163] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2024-06-12 16:00:26.710 INFO 51020 --- [1)-172.20.6.163] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
I don't know if the CXF service is not started,
and I don't know how to view Camel routes. How can I check these services? I don't know how to troubleshoot the issue.
My full pom.xml are as follows (PS: parent pom.xml)
Then, XDS module pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>work.mediway.ihe</groupId>
<artifactId>ihe-base</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>ihe-xds</artifactId>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<ipf.version>4.8-m5</ipf.version>
<camel-version>3.21.3</camel-version>
<groovy.version>3.0.8</groovy.version>
</properties>
<!-- IPF 框架依赖管理 -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.openehealth.ipf</groupId>
<artifactId>ipf-dependencies</artifactId>
<type>pom</type>
<scope>import</scope>
<version>${ipf.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- common -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!-- SpringBoot Web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- IPF -->
<dependency>
<groupId>org.openehealth.ipf.boot</groupId>
<artifactId>ipf-atna-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.openehealth.ipf.boot</groupId>
<artifactId>ipf-xds-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.openehealth.ipf.commons</groupId>
<artifactId>ipf-commons-ihe-xds</artifactId>
<classifier>tests</classifier>
<version>${ipf.version}</version>
</dependency>
<!-- some test-jar for xds -->
<dependency>
<groupId>org.openehealth.ipf.platform-camel</groupId>
<artifactId>ipf-platform-camel-ihe-xds</artifactId>
<version>${ipf.version}</version>
<type>test-jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openehealth.ipf.platform-camel</groupId>
<artifactId>ipf-platform-camel-ihe-ws</artifactId>
<version>${ipf.version}</version>
<type>test-jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openehealth.ipf.commons</groupId>
<artifactId>ipf-commons-ihe-ws</artifactId>
<version>${ipf.version}</version>
<type>test-jar</type>
</dependency>
<!-- Groovy -->
<!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy -->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
<version>${groovy.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-groovy</artifactId>
<version>${camel-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<version>${camel-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-xml</artifactId>
<version>${camel-version}</version>
</dependency>
<!-- Dependencies for test -->
<dependency>
<groupId>org.openehealth.ipf.commons</groupId>
<artifactId>ipf-commons-ihe-xds</artifactId>
<version>${ipf.version}</version>
<type>test-jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openehealth.ipf.commons</groupId>
<artifactId>ipf-commons-ihe-core</artifactId>
<version>${ipf.version}</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
<!--
Add build-info.properties to generated artifact
https://docs.spring.io/spring-boot/docs/2.1.7.RELEASE/reference/html/howto-build.html#howto-build-info
-->
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
My repository code address is
https://github.com/bovane/ihe-base.git. The corresponding branch is dev-boot. If possible, could you please help take a look at the code?
I think the possible issue may be with my configuration file, but I don't know how to correct it. Thank you very much 😊
Best Regards
Bo