Hi,
I reported this error first and Magnus reports having my same problem.
The very first time my repository is started, I register my custom node
types and namespaces. I don't get errors at this time. I can create
non-versionable nodes with no errors. The error happens every time I
create a versionable node. Once I restart the repository the errors
don't happen anymore.
Carlos
Marcel Reutegger wrote:
Hi Magnus,
I tried to reproduce the problem you described. However I was not able
to do so. at least not with the exception you described. What I see is
an error in the log file, when node types are registered on a repository
that was started for the very first time:
26.10.2006 10:36:02 *ERROR* [main] VirtualNodeTypeStateManager: Unable
to index new nodetype: javax.jcr.ItemNotFoundException
(VirtualNodeTypeStateManager.java, line 159)
I've created a jira issue which might be related to the behaviour you
see in your setup:
http://issues.apache.org/jira/browse/JCR-605
btw. what actions do you perform on the repository after you register
the node types? Or does the NullPointerException already occur when you
register the node types?
regards
marcel
Magnus Grimsell wrote:
I have the same problem in my unit tests where I create a new
repository for every test.
I have to restart the repository in order to get the tests to work.
This is my setup code:
File tmpDir = getTmpDir();
InputStream xml = getResource("iipax/generic/jcr/test/repository.xml");
RepositoryConfig repoConf =
RepositoryConfig.create(xml, tmpDir.getAbsolutePath());
mRepository = RepositoryImpl.create(repoConf);
Session session = mRepository.login();
NamespaceRegistry nsReg = session.getWorkspace().getNamespaceRegistry();
nsReg.registerNamespace(JcrFactory.NAMESPACE_PREFIX,
JcrFactory.NAMESPACE);
JackrabbitNodeTypeManager manager =
(JackrabbitNodeTypeManager)session.getWorkspace().getNodeTypeManager();
InputStream nodeTypes = getNodeTypeConfig();
manager.registerNodeTypes(nodeTypes,
JackrabbitNodeTypeManager.TEXT_X_JCR_CND);
session.save();
session.logout();
// this is done to avoid NullPointerException in NodeIndexer
mRepository.shutdown();
mRepository = RepositoryImpl.create(repoConf);