- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试加载包含一些自定义节点类型定义的 CND 文件。文件看起来像这样
<ca = 'http://www.stuff.com/training'>
[ca:article]
- ca:headline (string)
mandatory
- ca:body (string)
mandatory
这是加载节点类型的类
public class JcrRegisterNodeTypes {
public static void RegisterCustomNodeTypes(Session session, String cndFileName){
NodeType[] nodeTypes;
try {
File file = new File(cndFileName);
FileReader fr = new FileReader(file);
nodeTypes = CndImporter.registerNodeTypes(fr, session);
for (NodeType nt : nodeTypes) {
System.out.println("Registered: " + nt.getName());
}
} catch (InvalidNodeTypeDefinitionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NodeTypeExistsException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnsupportedRepositoryOperationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RepositoryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
然后引发“解析异常”,并显示此消息
10:37:23,052 ERROR [stderr] (default task-48) org.apache.jackrabbit.commons.cnd.ParseException: javax.jcr.UnsupportedRepositoryOperationException: TODO: JCR-3206 (cnd input stream, line 2)
该方法似乎没有为 RMI 实现。是否有替代方法来生成/node types/custom_node_types.xml?
<小时/>我已经在 WildFly 14 上部署了 jackrabbit-webapp-2.18.4.war 并且我可以上传/下载文件,所以我认为安装运行正常。
项目中包含的 jar 是最后一个稳定版本
jackrabbit-api-2.18.4.jarjackrabbit-core-2.18.4.jarjackrabbit-jcr-commons-2.18.4.jarjackrabbit-jcr-rmi-2.18.4.jarjcr-2.0.jar
最佳答案
因此,我遵循 Julian 的建议并尝试直接在服务器上修改 NodeTypes。
方法CndImporter.registerNodeTypes(fr, session)将CND文件转换为custom_nodetypes.xml文件。该 XML 文件在加载时由存储库管理器读取。 CND 和 XML 的语法不同,但很容易弄清楚如何从一种语法转换到另一种语法。
我已经基于
手动创建了一个 xml我更改了 xml 的命名空间标记 ( xmlns:ocm="http://jackrabbit.apache.org/ocm") 并将其手动添加到 namespaces/ns_reg.properties
之后,我启动了服务器并解决了一些拼写错误,它终于启动了。我已经编写了这个小方法来检查它,似乎没问题。
public void showNodeTypes(){
NodeTypeManager manager;
try {
manager = (NodeTypeManager)jcrSession.getWorkspace().getNodeTypeManager();
NodeTypeIterator nodeTypeIterator = manager.getAllNodeTypes();
NodeType actual;
while (nodeTypeIterator.hasNext()){
System.out.println("----------------");
actual= (NodeType)nodeTypeIterator.next();
System.out.println(actual.getName());
for(PropertyDefinition propertyDef:actual.getPropertyDefinitions()) {
System.out.println(propertyDef.getName() +" --> Mandatory: " + propertyDef.isMandatory());
}
}
} catch (RepositoryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
这是我使用的custom_nodetypes.xml
<?xml version="1.0" encoding="UTF-8"?>
<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
xmlns:spi="http://www.example.ad/spi">
<nodeType name="spi:cmsobjectimpl" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
<supertypes>
<supertype>nt:base</supertype>
</supertypes>
<propertyDefinition name="spi:name" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
</nodeType>
<nodeType name="spi:contentimpl" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
<supertypes>
<supertype>spi:cmsobjectimpl</supertype>
</supertypes>
</nodeType>
<nodeType name="spi:documentstream" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
<supertypes>
<supertype>mix:versionable</supertype>
<supertype>nt:base</supertype>
</supertypes>
<propertyDefinition name="spi:encoding" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
<propertyDefinition name="spi:binarycontent" requiredType="Binary" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
</nodeType>
<nodeType name="spi:Expedient" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
<supertypes>
<supertype>spi:contentimpl</supertype>
</supertypes>
<propertyDefinition name="spi:contenttype" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
<propertyDefinition name="spi:size" requiredType="Long" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
<propertyDefinition name="spi:numExpedient" requiredType="Long" autocreated="true" mandatory="true" onParentVersion="COPY" protected="false" multiple="false"/>
<childNodeDefinition name="*" defaultPrimaryType="spi:documentstream" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false">
<requiredPrimaryTypes>
<requiredPrimaryType>spi:documentstream</requiredPrimaryType>
</requiredPrimaryTypes>
</childNodeDefinition>
</nodeType>
</nodeTypes>
关于java - 无法通过 RMI 在 JackRabbit 中加载 Nodetypes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59173828/
我在 Swift 中处理这个问题有一段时间了,尝试了类型删除和各种东西,但都无济于事;这个问题似乎是常识(至少对我而言)。如何在 Swift 中模拟抽象类?换句话说,如何使这项工作: import F
我试图找到一种方法来检测超链接是否是 的第一个节点. 例如,如果我有: hyperlink Text text text text... Text text text text h
我开始探索如何使用 Javascript 操作 DOM。我从非常基础的开始,但我立即陷入困境。 所以从W3我发现HTML中有3种类型的节点: 元素 属性 文字 以此片段为例My paragraph我想
我使用 jQUery UI Position 插件:http://jqueryui.com/position/将我的图标放置在网页上。选择器从数据库中获取,并使用 PHP 在 $myselector
function prev( node ){ do { elem = elem.previousSibling; } while( elem && elem.nodeTy
我正在尝试使用 jquery 查找页面上的所有文本节点。但无论我选择什么元素,nodeType 始终为 1: $.each($('*'), function(index, el) { console.
尝试安装集群时,我收到此错误: Cluster manifest validation failed with exception System.ArgumentException: NodeType
我有一个 XML 文件,我需要从中读取一些文本值。我在使用 reader.NodeType = XMLNodeType.Text 时遇到问题,无法理解什么构成了 NodeType.Text 的节点。
本文整理了Java中xdi2.core.features.nodetypes.XdiCommonRoot类的一些代码示例,展示了XdiCommonRoot类的具体用法。这些代码示例主要来源于Githu
本文整理了Java中xdi2.core.features.nodetypes.XdiEntity类的一些代码示例,展示了XdiEntity类的具体用法。这些代码示例主要来源于Github/Stacko
我在 IE (6,7,8) 中的网站上遇到此问题: ‘nodeType’ is null or not an object 错误涉及“f.nodeType”属性。基本上 f 是未定义的,所以问题是之前
基于 this ,看起来每次我想获取节点元素名称、文本值或其他任何内容时,我都需要使用 switch-case。 那么我是否必须使用这样的东西: while (reader.Read()) {
我想获取nodeType,然后将其与文本节点或元素节点的位置进行比较。 $(function(){ var mm= $('.jj') alert(mm.nodeValue)
nodeName 属性含有某个节点的名称。 元素节点的 nodeName 是标签名称 属性节点的 nodeName 是属性名称 文本节点的 nodeName 永远是 #text 文档节点的
我有这个小注册表 Please Register Your Account
我有一个带有文本的输入框。我想在用户按 Enter 时启动一个功能。该函数如下: si = $("#maincopy_search_input").val(); $("#search_input").
在 jquery 中有一个名为 'isArrayLike' 的函数,它被许多函数使用,例如 $.each function isArraylike( obj ) { var length = obj.
我可以得到 nodeType来自 这样的节点或 在 Chrome devtools 中,但我无法获得 nodeType的一个属性。我试过这样: document.getElementByTagNam
我正在尝试为学校做一个 knockout.js 项目,我需要将一个可观察数组绑定(bind)到一个选择下拉列表。以下代码不起作用,并在 applyBindings 行上给出此错误: Uncaught
本文整理了Java中xdi2.core.features.nodetypes.XdiCommonRoot.getSelfPeerRoot()方法的一些代码示例,展示了XdiCommonRoot.get
我是一名优秀的程序员,十分优秀!