JBoss Drools业务规则管理系统jbrms需要在JBoss应用服务器下运行,如果需要在Tomcat下需要修改一些配置
drools-jbrms需要JDK1.5或以上版本,本文以drools 4.0.7的drools-jbrms包在Tomcat 6.0下部署为例
第1步
按照JBoss官方提供的文档处理
1. 删除war包中的el-api.jar
2. 删除Tomcat的lib目录下的jsf-api.jar和jsf-impl.jar(本来不存在就不用管了)
3. 从http://download.jboss.org/drools/dependencies/jboss_jsf_libs.zip下载JSF的jar包
4. 将下载后的jboss_jsf_libs.zip解压到C:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/drools-jbrms/WEB-INF/lib目录下
(或者将下载后的jboss_jsf_libs.zip解压到Tomcat的lib目录下)
第2步
启动Tomcat.(注意,这里我是在Tomcat/bin目录下用tomcat.exe启动的,如果不是这种方式repository的位置不同)
drools-jbrms会在TOMCAT_HOME目录下新建repository目录(包括很多子目录),同时会报无法启动的异常。异常信息为Caused by: javax.jcr.RepositoryException: internal error: failed to read custom node type definitions stored in custom_nodetypes.xml: Premature end of file.: Premature end of file
(alternative)启动Tomcat。(注意,这里我是在Tomcat/bin目录下用startup.bat启动的,如果不是这种方式repository的位置不同)
drools-jbrms会在Tomcat的bin目录下新建repository目录(包括很多子目录),同时会报无法启动的异常。异常信息为Caused by: javax.jcr.RepositoryException: internal error: failed to read custom node type definitions stored in custom_nodetypes.xml: Premature end of file.: Premature end of file.
第3步
将本文提供的custom_nodetypes.xml覆盖Tomcat下的bin/repository/repository/nodetypes的同名文件。
第4步
重新启动
原因:drools-jbrms包含的某些功能在Tomcat下有问题,生成custom_nodetypes.xml时没有生成文件内容,所以报错。从网上查询,最迟2007年就有人报这个问题了。看来JBoss的对于非JBoss应用服务器的兼容问题考虑不多。
参考链接:http://blog.csdn.net/zhouxianli/archive/2008/08/21/2805991.aspx
<?xml version="1.0" encoding="UTF-8"?>
<nodeTypes xmlns:drools="http://www.jboss.org/drools-repository/1.0" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:fn_old="http://www.w3.org/2004/10/xpath-functions" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:rep="internal" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xml="http://www.w3.org/XML/1998/namespace">
<nodeType hasOrderableChildNodes="false" isMixin="false" name="drools:categoryNodeType" primaryItemName="">
<supertypes>
<supertype>mix:referenceable</supertype>
<supertype>nt:hierarchyNode</supertype>
</supertypes>
<childNodeDefinition autoCreated="false" defaultPrimaryType="drools:categoryNodeType" mandatory="false" name="*" onParentVersion="COPY" protected="false" sameNameSiblings="false">
<requiredPrimaryTypes>
<requiredPrimaryType>drools:categoryNodeType</requiredPrimaryType>
</requiredPrimaryTypes>
</childNodeDefinition>
</nodeType>
<nodeType hasOrderableChildNodes="false" isMixin="false" name="drools:packageNodeType" primaryItemName="">
<supertypes>
<supertype>drools:versionableNodeType</supertype>
<supertype>nt:folder</supertype>
</supertypes>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="*" onParentVersion="COPY" protected="false" requiredType="undefined"/>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="drools:compiledPackage" onParentVersion="COPY" protected="false" requiredType="Binary"/>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="drools:externalURI" onParentVersion="COPY" protected="false" requiredType="String"/>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="drools:header" onParentVersion="COPY" protected="false" requiredType="String"/>
<propertyDefinition autoCreated="true" mandatory="true" multiple="false" name="drools:archive" onParentVersion="COPY" protected="false" requiredType="Boolean">
<defaultValues>
<defaultValue>false</defaultValue>
</defaultValues>
</propertyDefinition>
<childNodeDefinition autoCreated="false" defaultPrimaryType="" mandatory="false" name="*" onParentVersion="IGNORE" protected="false" sameNameSiblings="false">
<requiredPrimaryTypes>
<requiredPrimaryType>drools:versionableAssetFolder</requiredPrimaryType>
</requiredPrimaryTypes>
</childNodeDefinition>
</nodeType>
<nodeType hasOrderableChildNodes="false" isMixin="false" name="drools:assetNodeType" primaryItemName="">
<supertypes>
<supertype>drools:versionableNodeType</supertype>
</supertypes>
<propertyDefinition autoCreated="false" mandatory="false" multiple="true" name="drools:categoryReference" onParentVersion="COPY" protected="false" requiredType="Reference">
<valueConstraints>
<valueConstraint>drools:categoryNodeType</valueConstraint>
</valueConstraints>
</propertyDefinition>
<propertyDefinition autoCreated="false" mandatory="true" multiple="false" name="drools:packageName" onParentVersion="COPY" protected="false" requiredType="String"/>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="drools:dateExpired" onParentVersion="COPY" protected="false" requiredType="Date"/>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="drools:dateEffective" onParentVersion="COPY" protected="false" requiredType="Date"/>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="*" onParentVersion="COPY" protected="false" requiredType="undefined"/>
<propertyDefinition autoCreated="true" mandatory="true" multiple="false" name="drools:archive" onParentVersion="COPY" protected="false" requiredType="Boolean">
<defaultValues>
<defaultValue>false</defaultValue>
</defaultValues>
</propertyDefinition>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="drools:attachmentFileName" onParentVersion="COPY" protected="false" requiredType="String"/>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="drools:binaryContent" onParentVersion="COPY" protected="false" requiredType="Binary"/>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="drools:content" onParentVersion="COPY" protected="false" requiredType="String"/>
</nodeType>
<nodeType hasOrderableChildNodes="false" isMixin="false" name="drools:versionableAssetFolder" primaryItemName="">
<supertypes><supertype>mix:versionable</supertype><supertype>nt:folder</supertype></supertypes>
<childNodeDefinition autoCreated="false" defaultPrimaryType="" mandatory="false" name="*" onParentVersion="IGNORE" protected="false" sameNameSiblings="false">
<requiredPrimaryTypes>
<requiredPrimaryType>drools:versionableNodeType</requiredPrimaryType>
</requiredPrimaryTypes>
</childNodeDefinition>
</nodeType>
<nodeType hasOrderableChildNodes="false" isMixin="false" name="drools:versionableNodeType" primaryItemName="">
<supertypes>
<supertype>mix:versionable</supertype>
<supertype>nt:hierarchyNode</supertype>
</supertypes>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="drools:stateReference" onParentVersion="COPY" protected="false" requiredType="Reference">
<valueConstraints>
<valueConstraint>drools:stateNodeType</valueConstraint>
</valueConstraints>
</propertyDefinition>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="drools:checkinComment" onParentVersion="COPY" protected="false" requiredType="String"/>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="drools:createdDate" onParentVersion="COPY" protected="false" requiredType="Date"/>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="drools:versionNumber" onParentVersion="COPY" protected="false" requiredType="Long"/>
<propertyDefinition autoCreated="false" mandatory="true" multiple="false" name="drools:title" onParentVersion="COPY" protected="false" requiredType="String"/>
<propertyDefinition autoCreated="false" mandatory="true" multiple="false" name="drools:lastModified" onParentVersion="COPY" protected="false" requiredType="Date"/>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="drools:lastContributor" onParentVersion="COPY" protected="false" requiredType="String">
<defaultValues>
<defaultValue/>
</defaultValues>
</propertyDefinition>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="drools:creator" onParentVersion="COPY" protected="false" requiredType="String"/>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="drools:type" onParentVersion="COPY" protected="false" requiredType="String"/>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="drools:source" onParentVersion="COPY" protected="false" requiredType="String"/>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="drools:subject" onParentVersion="COPY" protected="false" requiredType="String"/>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="drools:relation" onParentVersion="COPY" protected="false" requiredType="String"/>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="drools:rights" onParentVersion="COPY" protected="false" requiredType="String"/>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="drools:coverage" onParentVersion="COPY" protected="false" requiredType="String"/>
<propertyDefinition autoCreated="false" mandatory="false" multiple="false" name="drools:publisher" onParentVersion="COPY" protected="false" requiredType="String"/>
<propertyDefinition autoCreated="false" mandatory="true" multiple="false" name="drools:description" onParentVersion="COPY" protected="false" requiredType="String"/>
<propertyDefinition autoCreated="false" mandatory="true" multiple="false" name="drools:format" onParentVersion="COPY" protected="false" requiredType="String"/>
</nodeType>
<nodeType hasOrderableChildNodes="false" isMixin="false" name="drools:stateNodeType" primaryItemName="">
<supertypes>
<supertype>mix:referenceable</supertype>
<supertype>nt:hierarchyNode</supertype>
</supertypes>
</nodeType>
</nodeTypes>