我尝试将以下配置设置传递给 rhpam 7.9 Standalone.jar(https://developers.redhat.com/download-manager/file/rhpam-7.9.0-business-central-standalone.jar)
并启动并运行 Kie Server Spring Boot 启动器。但是,当我启动 Business Central 并登录时,我看不到 Kie 服务器。日志中也没有显示任何错误,但 Business Central 和 Kie Server(7.44 版本)之间的连接似乎没有建立。
必要的角色呈现为kieserver=admin,kie-server,rest-all,user,process-admin
以下是环境的代码和配置文件。在 Kie Server Spring Boot Starter App(https://github.com/kiegroup/droolsjbpm-integration/tree/master/kie-spring-boot/kie-spring-boot-samples/kie-server-spring-boot-sample)
上,以下分别是 Web Security Config 和 application.properties
@Configuration("kieServerSecurity")
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.cors().and()
.csrf().disable()
.authorizeRequests()
.antMatchers("/rest/*").authenticated()
.and()
.httpBasic();
//.and()
//.headers().frameOptions().disable();
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
PasswordEncoder encoder = PasswordEncoderFactories.createDelegatingPasswordEncoder();
auth.inMemoryAuthentication()
.withUser("kieserver").password(encoder.encode("kieserver1!")).roles("admin","kie-server","rest-all","user","process-admin")
.and()
.withUser("john").password(encoder.encode("john@pwd1")).roles("kie-server", "PM", "HR");
}
@Bean
CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
configuration.setAllowedOrigins(Arrays.asList("*"));
configuration.setAllowCredentials(true);
configuration.setAllowedHeaders(Arrays.asList("Access-Control-Allow-Headers","Access-Control-Allow-Origin","Access-Control-Request-Method", "Access-Control-Request-Headers","Origin","Cache-Control", "Content-Type", "Authorization"));
configuration.setAllowedMethods(Arrays.asList("DELETE", "GET", "POST", "PATCH", "PUT"));
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", configuration);
return source;
}
# https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#common-application-properties
#
#server configuration
server.address=localhost
server.port=8090
cxf.path=/rest
#jbpm configuration
jbpm.executor.enabled=false
#jbpm.executor.retries=5
#jbpm.executor.interval=0
#jbpm.executor.threadPoolSize=1
#jbpm.executor.timeUnit=SECONDS
kieserver.swagger.enabled=false
kieserver.location=http://localhost:8090/rest/server
#kieserver.controllers=http://localhost:8080/rest/controller
logging.level.root=DEBUG
kieserver.drools.enabled=true
kieserver.dmn.enabled=true
kieserver.jbpm.enabled=true
kieserver.jbpmui.enabled=true
kieserver.casemgmt.enabled=false
kieserver.optaplanner.enabled=false
kieserver.scenariosimulation.enabled=false
# only required for jBPM
#data source configuration
spring.datasource.username=sa
spring.datasource.password=sa
spring.datasource.url=jdbc:h2:./target/spring-boot-jbpm
spring.datasource.driver-class-name=org.h2.Driver
narayana.dbcp.enabled=true
narayana.dbcp.maxTotal=20
#hibernate configuration
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
spring.jpa.properties.hibernate.show_sql=false
spring.jpa.properties.hibernate.hbm2ddl.auto=update
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
#transaction manager configuration
spring.jta.narayana.transaction-manager-id=1
通过 sample-standalone-config.yml 为 Business Central 设置的配置参数是 -
# Sample Swarm config for KIE Drools Workbench
swarm:
management:
blocking:
timeout: 2400 # This might need to be higher if the jar has timeout issues on startup
security-realms:
ApplicationRealm: # almost the same as default config in WildFly 10.1.0.Final
local-authentication:
default-user: local
allowed-users: local
skip-group-loading: true
properties-authentication:
path: application-users.properties
plain-text: true
properties-authorization:
path: application-roles.properties
# Optional logging
logging:
console-handlers:
CONSOLE:
level: ALL
named-formatter: COLOR_PATTERN
pattern-formatters:
PATTERN:
pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"
COLOR_PATTERN:
pattern: "%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"
periodic-rotating-file-handlers:
FILE:
file:
path: server.log
suffix: .yyyy-MM-dd
named-formatter: PATTERN
root-logger:
level: ALL
handlers:
- CONSOLE
- FILE
security:
security-domains:
other:
classic-authentication:
login-modules:
kieLoginModule:
code: org.kie.security.jaas.KieLoginModule
flag: optional
module: deployment.business-central-webapp.war
undertow:
filter-configuration:
response-headers:
access-control-allow-origin:
header-name: Access-Control-Allow-Origin
header-value: "*"
access-control-allow-methods:
header-name: Access-Control-Allow-Methods
header-value: GET, POST, PUT, DELETE, OPTIONS
access-control-max-age:
header-name: Access-Control-Max-Age
header-value: -1
access-control-allow-headers:
header-name: Access-Control-Allow-Headers
header-value: Origin, X-Requested-With, Content-Type, Accept
servers:
default-server:
hosts:
default-host:
filter-refs:
access-control-allow-origin:
priority: 1
access-control-allow-methods:
priority: 1
access-control-max-age:
priority: 1
access-control-allow-headers:
priority: 1
datasource:
management:
wildfly:
admin: admin
# This configuration is required to make the users system work.
org:
uberfire:
ext:
security:
management:
wildfly:
cli:
user: admin
# Sample connection to KIE Server. The values here are the defaults.
kie:
server:
id: SpringBoot
user: kieserver
pwd: kieserver1!
location: http://localhost:8090/rest/server
mode: development
bypass.auth.user: true
controller: http://localhost:8080/rest/controller
controller.user: kieserver
controller.pwd: kieserver1!
# CORS
执行 Rhpam 的 cmd 是
java -jar rhpam-7.9.0-business-central-standalone.jar -s sample-standalone-config.yml
如果我安装 EAP 7.3 并部署 Business Central.war 和 Kie Server.war,同样的工作
但是,在我们的案例中,我们需要使用 Standalone.jar。
如果由于这部分代码(https://github.com/kiegroup/droolsjbpm-integration/blob/605985d6578e07fde49a28880af4be1a4f7386f9/kie-server-parent/kie-server-services/kie-server-services-common/src/main/java/org/kie/server/services/impl/controller/DefaultRestControllerImpl.java#L223)
,我尝试通过在 application.properties 中提供控制器 url 来连接到 Business Central,则 kie url 会根据代码附加相应的路径并出现 405 错误。所以我宁愿通过传递上面配置文件中提到的配置参数来尝试从 Business Central 本身建立连接。
下面的屏幕截图显示 Kie 服务器似乎运行正常,所以问题似乎只是没有发生的连接建立。
不确定是否localhost:9990/management
显示任何问题,因为我看到很多空值,下面附上截图
请让我知道我需要进行哪些配置更改才能使连接正常工作...