我想在JBPM 中更改数据库(h2到SQL(
来自
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<xa-datasource jndi-name="java:jboss/datasources/jBPMDS" pool-name="jBPMXADS" enabled="true">
<xa-datasource-property name="URL"> jdbc:h2:file:${jboss.server.data.dir}/jbpm-db;MVCC=TRUE </xa-datasource-property>
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</xa-datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
到
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:mysql://localhost:3306/jbpm5<connection-url>
<!--<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>-->
<driver>mysql</driver>
<security>
<user-name>root</user-name>
<password>password</password>
</security>
</datasource>
<xa-datasource jndi-name="java:jboss/datasources/jBPMDS" pool-name="jBPMXADS" enabled="true">
<xa-datasource-property name="URL">jdbc:mysql://localhost:3306/jbpm5</xa-datasource-property>
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
<driver>mysql</driver>
<security>
<user-name>root</user-name>
<password>password</password>
</security>
</xa-datasource>
<drivers>
<driver name="mysql" module="com.mysql">
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
</drivers>
an错误为:
16:38:46711错误[org.jboss.as.server](控制器引导线程(WFLYSRV0055:在引导过程中捕获到异常:org.jsos.as.Controller.persistence.ConfigurationPersistenceException:WFLYCTL0085:无法解析配置在org.jboss.as.controller@11.1.1.Final//org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersistr.java:143(在org.jboss.as.server@11.1.1.Final//org.jboss.as.server.ServerService.boot(ServerService.java:392(在org.jboss.as.controller@11.1.1.Final//org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:416(位于java.base/java.lang.Thread.run(线程.java:829(引起原因:javax.xml.stream.XMLStreamException:org.codehaus.tax2.typed.TypedXMLStreamException:[行,列]处的ParseError:[169,70]消息:使用类型化访问方法时,元素内容不能包含子START_Element在org.jboss.as.connector@19.1.0.Final//org.jboss.as.connecter.subsystems.datasources.DataSourcesExtension$DataSourceSubsystemParser.readElement(DataSourcesExtension.java:650(在org.jboss.as.connector@19.1.0.Final//org.jboss.as.connecter.subsystems.datasources.DataSourcesExtension$DataSourceSubsystemParser.readElement(DataSourcesExtension.java:204(在org.jboss.staxmapper@1.3.0.Final//org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:122(在org.jboss.staxmapper@1.3.0.Final//org.jboss.staxmapper.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedSreamReaderimpl.java:69(在org.jboss.as.server@11.1.1.Final//org.jboss.as.server.sparsing.StandaloneXml_8.parseServerProfile(StandaloneXml_8.java:589(在org.jboss.as.server@11.1.1.Final//org.jboss.as.server.sparsing.StandaloneXml_8.readServerElement(StandaloneXml_8.java:224(在org.jboss.as.server@11.1.1.Final//org.jboss.as.server.sparsing.StandaloneXml_8.readElement(StandaloneXml_8.java:121(在org.jboss.as.server@11.1.1.Final//org.jboss.as.server.sparsing.StandaloneXml.readElement(StandaloneXml.java:120(在org.jboss.as.server@11.1.1.Final//org.jboss.as.server.sparsing.StandaloneXml.readElement(StandaloneXml.java:52(在org.jboss.staxmapper@1.3.0.Final//org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:122(在org.jboss.staxmapper@1.3.0.Final//org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:76(在org.jboss.as.controller@11.1.1.Final//org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersistr.java:126(…还有3个由:org.codehaus.tax2.typed.TypedXMLStreamException引起:[行,列]处的ParseError:[169,70]消息:使用类型化访问方法时,元素内容不能包含子START_Element网址:org.codehaus.woodstox/com.ctc.wstx.sr.BasicStreamReader._constructTypeException(BasicStreamLeader.java:5624(网址:org.codehaus.woodstox/com.ctc.wstx.sr.BasicStreamReader._constructUnexpectedInTyped(BasicStreamLeader.java:5618(网址:org.codehaus.woodstox/com.ctc.wstx.sr.BasicStreamReader.getElementText(BasicStreamLeader.java:737(在org.jboss.staxmapper@1.3.0.Final//org.jboss.staxmapper.XMLExtendedStreamReaderImpl.getElementText(XMLExtendedSreamReaderimpl.java:144(在org.jboss.as.connector@19.1.0.Final//org.jboss.as.connector.util.AbstractParser.rawElementText(AbstractParser.java:61(在org.jboss.as.connector@19.1.0.Final//org.jboss.as.connecter.subsystems.datasources.DsParser.parseDataSource_4_0(DsParser.java:1960(在org.jboss.as.connector@19.1.0.Final//org.jboss.as.connecter.subsystems.datasources.DsParser.parseDataSources(DsParser.java:229(在org.jboss.as.connector@19.1.0.Final//org.jboss.as.connecter.subsystems.datasources.DsParser.parse(DsParser.java:189(在org.jboss.as.connector@19.1.0.Final//org.jboss.as.connecter.subsystems.datasources.DataSourcesExtension$DataSourceSubsystemParser.readElement(DataSourcesExtension.java:643(
我认为直接操作独立的配置文件不是一个好主意,而且很容易出错。
有一些脚本可以做到这一点,与jbpm一起提供:
To switch to MySQL use the following command when the server is stopped
<JBOSS_HOME>/bin/jboss-cli.sh --file=jbpm-mysql-config.cli (Unix / Linux)
<JBOSS_HOME>binjboss-cli.bat --file=jbpm-mysql-config.cli (Windows)
参考在这里