I'm hitting NullPointerException when I try to open hibernate.cfg.xml in JBoss Developer Studio

Solution Verified - Updated -

Environment

  • JBoss Developer Studio

Issue

When try to open the hibernate xml file in JBoss Developer Studio 1.1, hit the following error:

java.lang.NullPointerException
 at org.jboss.tools.common.editor.TreeFormPage.initialize(TreeFormPage.java:142)
 at org.jboss.tools.hibernate.ui.xml.editor.HibConfig3CompoundEditor.doCreatePages(HibConfig3CompoundEditor.java:33)
 at org.jboss.tools.common.editor.ObjectMultiPageEditor.createPages(ObjectMultiPageEditor.java:234)
 at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:310)
 at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:661)

Resolution

Use hibernate 3 dtd

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
    PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

Root Cause

The configuration files are hibernate 2.0 and jboss developer studio offers a Hibernate 3+ xml editor. See https://jira.jboss.org/jira/browse/JBIDE-5084

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments