05-26-2012 01:48 AM
org.alfresco.service.namespace.NamespaceException: Namespace prefix by is not mapped to a namespace URI
at org.alfresco.service.namespace.QName.createQName(QName.java:99)
at org.alfresco.service.namespace.QName.createQName(QName.java:121)
at org.alfresco.jcr.item.JCRPath$SimpleElement.<init>(JCRPath.java:114)
at org.alfresco.jcr.item.JCRPath.<init>(JCRPath.java:66)
at org.alfresco.jcr.item.NodeImpl.addNode(NodeImpl.java:146)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.alfresco.jcr.util.JCRProxyFactory$SessionContextInvocationHandler.invoke(JCRProxyFactory.java:132)
at $Proxy154.addNode(Unknown Source)
at org.alfresco.sample.FirstJCRClient.main(FirstJCRClient.java:76)
ApplicationContext context = new ClassPathXmlApplicationContext("classpath:alfresco/application-context.xml");
Repository repository = (Repository)context.getBean("JCR.Repository");
Session session = repository.login(new SimpleCredentials("admin", "123".toCharArray()));
try
{
// first, access the company home
Node rootNode = session.getRootNode();
Node companyHome = rootNode.getNode("app:company_home");
// create the content node
String name = "JCR sample (" + System.currentTimeMillis() + ")";
Node content = companyHome.addNode("by:" + name, "by:log");
…
On last line a get an exception.
<model name="by:logmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"></import>
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"></import>
</imports>
<namespaces>
<namespace uri="http://www.blabla.com/model/log/1.1" prefix="by" />
</namespaces>
<types>
<type name="by:log">
<title>Log</title>
<parent>cm:content</parent>
<properties>
<property name="by:id">
<title>id</title>
<type>d:text</type>
<protected>false</protected>
<mandatory>true</mandatory>
<multiple>false</multiple>
</property>
<property name="by:sender">
<title>sender</title>
<type>d:text</type>
<protected>false</protected>
<mandatory>true</mandatory>
<multiple>false</multiple>
</property>
<property name="by:recipient">
<title>recipient</title>
<type>d:text</type>
<protected>false</protected>
<mandatory>true</mandatory>
<multiple>false</multiple>
</property>
<property name="by:senddate">
<title>senddate</title>
<type>d:datetime</type>
<protected>false</protected>
<mandatory>true</mandatory>
<multiple>false</multiple>
</property>
<property name="by:signature">
<title>signature</title>
<type>d:text</type>
<protected>false</protected>
<mandatory>true</mandatory>
<multiple>false</multiple>
</property>
<property name="by:finishdate">
<title>finishdate</title>
<type>d:datetime</type>
<protected>false</protected>
<mandatory>true</mandatory>
<multiple>false</multiple>
</property>
<property name="by:resultprocess">
<title>resultprocess</title>
<type>d:text</type>
<protected>false</protected>
<mandatory>true</mandatory>
<multiple>false</multiple>
</property>
</properties>
<associations>
<association name="by:response">
<title>response</title>
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>cm:content</class>
<mandatory>false</mandatory>
<many>false</many>
</target>
</association>
</associations>
</type>
</types>
</model>
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<bean id="requestModel" parent="dictionaryModelBootstrap" depends-on="JCR.DictionaryBootstrap">
<property name="models">
<list>
<value>alfresco/extension/request.xml</value>
</list>
</property>
</bean>
</beans>
In UI all work fine, I can add, edit documents with this model. But not work, when I try to programmaticly add content.05-28-2012 08:39 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.