Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Exception in thread "main" java.lang.ExceptionInInitializerError([SDO Tuscany XSD])
Exception in thread "main" java.lang.ExceptionInInitializerError [message #1052612] Tue, 30 April 2013 09:52 Go to next message
Ayoub El Barji is currently offline Ayoub El BarjiFriend
Messages: 15
Registered: April 2013
Junior Member
Hello,

I try to define a set of SDO Types from an XML Schema and load its instance from his corresponding xml.
I use Tuscany for my jar files with my referenced libraries:
tuscany-sdo-api-r2.1-1.1.1.jar
content:commonj.sdo, commonj.sdo.helper, commonj.sdo.impl
tuscany-sdo-lib-1.1.1.jar
content:org.apache.tuscany.sdo.api, org.apache.tuscany.sdo.lib,org.apache.tuscany.sdo.spi

But when i execute the code i have this problem:

Exception in thread "main" java.lang.ExceptionInInitializerError
at sdo.model.XsdXmlToSdo.main(XsdXmlToSdo.java:31)
Caused by: java.lang.NullPointerException
at org.apache.tuscany.sdo.api.SDOUtil.<clinit>(SDOUtil.java:48)
... 1 more


My code is as below:

package sdo.model;

import java.io.FileInputStream;
import org.apache.tuscany.sdo.api.SDOUtil;
import commonj.sdo.DataObject;
import commonj.sdo.helper.HelperContext;
import commonj.sdo.helper.XMLDocument;
import commonj.sdo.helper.XMLHelper;
import commonj.sdo.helper.XSDHelper;


public class XsdXmlToSdo {

public static void main(String[] args) throws Exception {

// HelperContext helperContext = HelperProvider.getDefaultContext();
31 HelperContext helperContext = SDOUtil.createHelperContext();

XSDHelper xsdHelper = helperContext.getXSDHelper();


FileInputStream xsd = new FileInputStream("model/can_db.xsd");
xsdHelper.define(xsd,null);
// XSDHelper.INSTANCE.define(xsd, null);
xsd.close();

FileInputStream xml = new FileInputStream("model/tiny.xml");
// XMLDocument doc = XMLHelper.INSTANCE.load(xml, null, null);
XMLDocument doc = XMLHelper.INSTANCE.load(xml);

DataObject customerDO = doc.getRootObject();

}
}

If anyone have a suggestion or a way to fix it i will be thankful because because i try since few days but i'm still blocked.

Thank you,
Ayoub
Re: Exception in thread "main" java.lang.ExceptionInInitializerError [message #1052719 is a reply to message #1052612] Tue, 30 April 2013 12:55 Go to previous messageGo to next message
Blaise Doughan is currently offline Blaise DoughanFriend
Messages: 163
Registered: July 2009
Senior Member

Hi Ayoub,

For Tuscany specific failures you will need to try their forum. You could try using EclipseLink SDO and then we could help you out with any issues you are seeing. Below are the binaries you need from the EclipseLink install.

- <ECLIPSELINK_HOME>/jlib/eclipselink.jar
- <ECLIPSELINK_HOME>/jlib/sdo/commonj.sdo_2.1.1.v201112051852.jar

-Blaise
Re: Exception in thread "main" java.lang.ExceptionInInitializerError [message #1052737 is a reply to message #1052719] Tue, 30 April 2013 13:20 Go to previous messageGo to next message
Ayoub El Barji is currently offline Ayoub El BarjiFriend
Messages: 15
Registered: April 2013
Junior Member
Hi Blaise,

First Thanks for your response.
I try to install EclipseLink but i encounter some difficulties...
Have you a link for a clear tutoriel or a website for eclipseLink installation?
Or just can you explain what is <ECLIPSELINK_HOME> because i have already download eclipselink-2.4.1.v20121003-ad44345.zip
And when i extract it i have a folder with eclipselink with the two jar files you cited : jlib/eclipselink.jar and jlib/sdo/commonj.sdo_2.1.1.v201112051852.jar.
But i don't understand if i have to create a new folder <ECLIPSELINK_HOME> and put the two jar files inside or add them like external jars...

Ayoub


Re: Exception in thread "main" java.lang.ExceptionInInitializerError [message #1052816 is a reply to message #1052737] Tue, 30 April 2013 15:18 Go to previous message
Ayoub El Barji is currently offline Ayoub El BarjiFriend
Messages: 15
Registered: April 2013
Junior Member
Blaise,

I managed to fix my problem thanks to eclipseLink it's works fine.
Thank you.
But i noticed when i debug my code that i can't access to all my proprieties and elements of my xml file.
In my customerDO variable i have juste the first layer of my xml proprieties, i haven't access for all others attributes et proprieties under them.
Have you a better idea to load my xml file for having access at all my data.

Ayoub
Previous Topic:JPA/Dynamic OneToOne attribute in inherited table
Next Topic:Complex Key: Multiple writable mappings exist;
Goto Forum:
  


Current Time: Wed Nov 26 05:46:24 GMT 2014

Powered by FUDForum. Page generated in 0.07134 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software