Troubleshooting
- JPOX Configuration and Use Details
- Troubleshooting the OR Mapper and Resource Utilities
- Troubleshooting the JPOX Enhancer
- Troubleshooting the Runtime layer
- Cut and Paste does not work in the Editor
- java.lang.NoClassDefFoundError when starting/initializing runtime layer
- Properties are not editable with EMF generated property editor
- Derby database and cascading deletes
- Created new model through new model wizard: diagnostic error
- OR Mapper: java.lang.NoSuchMethodError: org.eclipse.emf.common.util.AbstractEnumerator
- The resource is empty in the generated editor
- Update manager does not find the upgrade of the EMF - JDO plugin
- JoinTable name clash
- Editor does not start, the error log gives a sql error 'Missing column....'
- Editor does not start, ClassNotFoundException on the Editor Plugin, org.jpox.exceptions.ClassNotResolvedException
- Editor does not start, AssertionFailedException
- Teneo does not see my changes in the ecore model
For troubleshooting please also visit the Known Issues page.
JPOX Configuration and Use Details
The following page discusses a number of details related to the configuration and use of the EMF/JPOX layer. This can possibly explain unexpected behavior.
Troubleshooting the OR Mapper and Resource Utilities
If an error popup is shown or no popup box appears after the OR Mapper plugin is finished then an application error has occured within the OR Mapper/Resource utility.
The OR Mapper menu option only works if the ecore file is located in the same Java Project as the generated EPackage sources.
When the console shows this exception: Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/emf/teneo/jpox/mapper/GenerateJDO then you have not added the org.eclipse.emf.teneo.jpox plugin to the dependencies of the model plugin.
The or mapping can also be generated programmatically this can give more insight in the issues, see here.
Troubleshooting the JPOX Enhancer
Problems in the JPOX enhancer are often related to the installation of the JPOX plugin, e.g. an incorrect classpath setting in the preferences or an invalid package.jdo file. The JPOX Enhancer will write debug and log messages to the console in Eclipse. if this does not happen please check the log4j settings.
JPOX Plugin installation
If you do not see a specific JPOX submenu when right clicking on a Java package, then the JPOX plugin is not installed. To check what is wrong look in the workspace/.metadata/.log file, where workspace is your workspace directory.
Classpath error
A classpath error will be made visible like the image below. This particular error can be solved by adding the required jars to the classpath of the JPOX Enhancer (in this case the JPOX Core jar, see installation instructions).
Incorrect package.jdo
The JPOX Enhancer will notify you if there is an error in the package.jdo. The error message shown by the JPOX Enhancer in the console does not look very alarming (no red blinking text). See the image below.
The main symptom of an error condition is that the enhancement ends with the statement Initialising 0 JDO Files. A few lines above that in the console you will see 2 lines with the error message.
If you post a question about an error in the enhancer to the mailing list then please also post the content of the console and the package.jdo file
Troubleshooting the Runtime layer
The runtime layer uses commons-logging for logging. Please set the log level to debug to get the most information.
If you use the runtime layer within a plugin then log messages will not appear in the console. In this case check the error log view (Window > Show View > Error Log) or let the log messages be written to a file.
As an extra debug enabling you can add the following line in the EMF editor plugin:
org.eclipse.osgi.framework.debug.Debug.DEBUG_GENERAL = true;
This will result in much more debugging information in the console.
Cut and Paste does not work in the Editor
Please look here
java.lang.NoClassDefFoundError when starting/initializing runtime layer
When your model is divided over different projects/plugins then org.eclipse.emf.teneo.jpox plugin has to be set (as a dependency) in the project with the 'widest' classpath (the project with a classpath containing the other plugins). For example if you have the following two emf projects:
- Core
- Specific (which uses/imports Core)
Then the dependency should only be in the META-INF of the 'Specific' project. This is required otherwise Jpox will not see the 'Specific' project.
Properties are not editable with EMF generated property editor
If you store the .ejdo file within the plugin and open the EMF editor using different urls there are situations that the editor opens in read-only mode.
If the url is opened as follows: FileLocator.find(Activator.getDefault().getBundle(), new Path("myfile.ejdo"), null). Then the property editor does not allow any modifications.
If however, the editor is opened using a 'file:/' based URL (file://myfile.ejdo), then the EMF property editor works as expected.
The first situation can be solved by creating a class similar to this one:
public class CustomAdapterFactoryEditingDomain extends AdapterFactoryEditingDomain { public CustomAdapterFactoryEditingDomain(AdapterFactory adapterFactory, CommandStack commandStack, Map<Resource, Boolean> resourceToReadOnlyMap) { super(adapterFactory, commandStack, resourceToReadOnlyMap); } @Override protected boolean isReadOnlyURI(URI uri) { boolean defaultReadOnly = super.isReadOnlyURI(uri); if (defaultReadOnly == true && uri.fileExtension().compareTo("ejdo") == 0) { return false; } else { return defaultReadOnly; } } }
And using an instance of this class as the editingDomain in the initializeEditingDomain() method of the EMF generated XXXEditor class:
protected void initializeEditingDomain() { ......... ......... editingDomain = new CustomAdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>()); }
Reported and solution by Florian Hackenberger.
Derby database and cascading deletes
Teneo will specify foreign keys with cascade delete in the mapping file if required by the model (for example with containment). However Derby does not support cascading deletes and will throw an error in the initialisation phase. The only solution is to manually delete the cascade delete foreign key tags in the package.jdo. Teneo does not know at mapping file generation time which database is used and can therefore not know if cascade deletes are supported or not.
Created new model through new model wizard: diagnostic error
The generated EMF model wizard allows invalid documents. When going through the wizard you need to select a type to create as the first document in the resource. The EMF model wizard creates an empty (all members are null) instance of this type and adds it to the JPOX resource. Before the JPOX resource is saved it checks if the content of the resource is valid. When nullable-constraints are violated a StoreValidationException (with Diagnostics) is thrown.
To solve this you should make your model more relaxed (make elements nullable) or add a small amount of code, which sets the non-nullable fields, to the model wizard. An example of this last solution is illustrated in the Library Tutorial.
OR Mapper: java.lang.NoSuchMethodError: org.eclipse.emf.common.util.AbstractEnumerator
When you run the or mapper and no popup box is shown then view the error log. If the error log shows the stacktrace below then you need to upgrade to EMF 2.2
java.lang.NoSuchMethodError: org.eclipse.emf.common.util.AbstractEnumerator.<init>(ILjava/lang/String;Ljava/lang/String;)V at org.elver.store.annotations.pannotation.InheritanceType.<init>(InheritanceType.java:182) at org.elver.store.annotations.pannotation.InheritanceType.<clinit>(InheritanceType.java:85) at org.elver.store.jpox.eclipse.popup.actions.GenerateJDOActionSuperTable.run(GenerateJDOActionSuperTable.java:42) at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:246)
The resource is empty in the generated editor
The JPOX resources will only load EMF objects which have been enhanced. To ensure that the EMF classes are enhanced make sure that 'Enable Auto Enhancement' is checked in the JPOX submenu. The JPOX submenu is displayed when you right click on the EMF model project.
See also the Know Issues.
Update manager does not find the upgrade of the EMF - JDO plugin
Please see the upgrade page for more information.
JoinTable name clash
If you have two EReferences between two EClasses then it is possible that you will get a jointable name clash. To prevent this set the PersistenceOptions.JOIN_TABLE_NAMING_STRATEGY to unique. This is only possible if you programmatically create the jdo mapping file through the JpoxHelper class.
Editor does not start, the error log gives a sql error 'Missing column....'
This can occur if your model has changed or you just upgraded the OR Mapper plugin, see the upgrade page for more information.
Editor does not start, ClassNotFoundException on the Editor Plugin, org.jpox.exceptions.ClassNotResolvedException
This can happen when the JPOX libraries can not find the model classes. You can check if you have set the BuddyPolicy in the Manifest.MF of the plugin containing the JPOX jar files. If not add the following to the Manifest.MF of the plugin containing the JPOX jar files: Eclipse-BuddyPolicy: dependent
Editor does not start, AssertionFailedException
When you start the editor you get the following exteption (stacktrace truncated):
org.eclipse.core.runtime.AssertionFailedException: assertion failed: at org.eclipse.core.runtime.Assert.isTrue(Assert.java:109) at org.eclipse.core.runtime.Assert.isTrue(Assert.java:95) at org.eclipse.ui.part.MultiPageEditorPart.setActivePage(MultiPageEditorPart.java:688) at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:280)
You probably started the editor with an empty database, the editor does not support this. You should have at least one root object in the database (for example a Library object in the Library tutorial).
Teneo does not see my changes in the ecore model
Teneo uses the runtime version of the ecore model. The runtime version is present as java code in the generated EPackage implementation class. This runtime ecore can differ from the ecore file when the model code is not regenerated after a change in the ecore file. So to let Teneo use the changes in the ecore file the model code needs to be regenerated.