cancel
Showing results for 
Search instead for 
Did you mean: 

FirstJCRClient and SimpleExample

leviter
Champ in-the-making
Champ in-the-making
Hi,

I ran the FirstJCRClient from the SDK with success and can see the content node created in the Company Home using the Alfresco web client.

Now when I run the SimpleExample it lists all spaces inside the Company Home, but not the content created by the FirstJCRClient.

What is the reason for this and how can I retrieve the content?
5 REPLIES 5

davidc
Star Contributor
Star Contributor
Unless re-configured, each sample executes with its own repository data store.

If you modify custom-repository.properties so that dir.root points to the same directory for all samples, you'll see the content created in FirstJCRClient within SimpleExample.

leviter
Champ in-the-making
Champ in-the-making
Thanks for your reply, but that is what I've done…

The custom-repository.properties of the FirstJCRClient looks as follows:

dir.root=c:/alfresco/alf_data


db.username=alfresco
db.password=alfresco

#
# MySQL connection (This is default and requires mysql-connector-java-3.1.12-bin.jar, which ships with the Alfresco server)
#
db.driver=org.gjt.mm.mysql.Driver
db.url=jdbc:mysql://localhost/alfresco

And the custom-repository.properties of the JCRSamples (of which the SimpleExample is part of) looks like this:

dir.root=c:/alfresco/alf_data


db.username=alfresco
db.password=alfresco

#
# MySQL connection (This is default and requires mysql-connector-java-3.1.12-bin.jar, which ships with the Alfresco server)
#
db.driver=org.gjt.mm.mysql.Driver
db.url=jdbc:mysql://localhost/alfresco

They both point to the same location (which is the location which is used by the 'complete' install of Alfresco). And still I don't see the content created with the FirstJCRClient in the SimpleExample.

Another space I created (Users) in the Company Home using the web client interface is returned in the SimpleExample.

Here is the output I get from it….

app:dictionary
app:icon = space-icon-default
cm:description = User managed definitions
sys:node-uuid = 8060abf5-b6b0-11db-85e7-a174addc44a8
sys:node-dbid = 13
cm:title = Data Dictionary
cm:created = 2007-02-07T14:38:32.313+01:00
cm:modifier = System
cm:modified = 2007-02-07T14:39:18.017+01:00
cm:creator = System
sys:store-protocol = workspace
cm:name = Data Dictionary
sys:store-identifier = SpacesStore
jcr:uuid = 8060abf5-b6b0-11db-85e7-a174addc44a8
jcr:primaryType = cm:folder
app:guest_home
app:icon = space-icon-default
cm:description = The guest root space
sys:node-uuid = 81811035-b6b0-11db-85e7-a174addc44a8
sys:node-dbid = 21
cm:title = Guest Home
cm:created = 2007-02-07T14:38:34.266+01:00
cm:modifier = System
cm:modified = 2007-02-07T14:39:18.033+01:00
cm:creator = System
sys:store-protocol = workspace
cm:name = Guest Home
sys:store-identifier = SpacesStore
jcr:uuid = 81811035-b6b0-11db-85e7-a174addc44a8
jcr:primaryType = cm:folder
app:user_homes
app:icon = space-icon-default
cm:description = User Homes
sys:node-uuid = 81a9a6d9-b6b0-11db-85e7-a174addc44a8
sys:node-dbid = 22
cm:title = User Homes
cm:created = 2007-02-07T14:38:34.438+01:00
cm:modifier = System
cm:modified = 2007-02-07T14:39:18.033+01:00
cm:creator = System
sys:store-protocol = workspace
cm:name = User Homes
sys:store-identifier = SpacesStore
jcr:uuid = 81a9a6d9-b6b0-11db-85e7-a174addc44a8
jcr:primaryType = cm:folder
app:wcm
app:icon = space-icon-default
cm:description = Web Content Management Spaces
sys:node-uuid = 81bcb9ad-b6b0-11db-85e7-a174addc44a8
sys:node-dbid = 23
cm:title = Web Projects
cm:created = 2007-02-07T14:38:34.547+01:00
cm:modifier = admin
cm:modified = 2007-02-08T10:52:39.112+01:00
cm:creator = System
sys:store-protocol = workspace
cm:name = Web Projects
sys:store-identifier = SpacesStore
jcr:uuid = 81bcb9ad-b6b0-11db-85e7-a174addc44a8
jcr:primaryType = cm:folder
cm:Users
app:icon = space-icon-default
cm:description = Contains all users
sys:node-uuid = 6337a823-b6b1-11db-85e7-a174addc44a8
sys:node-dbid = 398
cm:title =
cm:created = 2007-02-07T14:44:52.794+01:00
cm:modifier = marcel
cm:modified = 2007-02-07T14:51:31.822+01:00
cm:creator = admin
sys:store-protocol = workspace
cm:name = Users
sys:store-identifier = SpacesStore
jcr:uuid = 6337a823-b6b1-11db-85e7-a174addc44a8
jcr:primaryType = cm:folder

As can be seen the 'Users' is returned, but the content item created with the FirstJCRClient isn't… and neither is the content item created with the FirstFoundationClient which I also executed.

leviter
Champ in-the-making
Champ in-the-making
I am one step further in solving the problem…

It seems that an exception is thrown!

org.alfresco.service.namespace.NamespaceException: A namespace prefix is not registered for uri cm
   at org.alfresco.service.namespace.QName.toPrefixString(QName.java:376)
   at org.alfresco.jcr.item.NodeImpl.getName(NodeImpl.java:1095)
   at sun.reflect.GeneratedMethodAccessor121.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.alfresco.jcr.util.JCRProxyFactory$SessionContextInvocationHandler.invoke(JCRProxyFactory.java:131)
   at $Proxy82.getName(Unknown Source)
   at org.alfresco.sample.jcr.SimpleExample.main(SimpleExample.java:67)

How can I solve this problem with the SimpleExample?

davidc
Star Contributor
Star Contributor
I've just tried your use case with the latest 2.0 sdk (from SVN).

SimpleExample is displaying the content created in the FirstJCRClient.

I notice from your exception that a namespace prefix is not registered for the uri 'cm'.  Well, 'cm' is not a pre-defined uri, so unless you have defined it yourself, it seems that an item in your repo has an invalid uri.

leviter
Champ in-the-making
Champ in-the-making
It still is a bit strange, but I found this topic also about the error I got.

Next thing I did was removing all (self created) nodes and try the examples again…. and now it worked! Guess something was already broken…
Getting started

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.