ok I will try and debug thanks ritika
"Yang ZHONG" <[EMAIL PROTECTED]> 08/23/2006 08:45 AM Please respond to [email protected] To [email protected] cc Subject Re: java.lang.NullPointer exception when invoking XSDHelper.INSTANCE Seems we have assured right ClassPath, are you also interested in debuging? You can download sdo-api source code from Tuscany. HelperProvider.java line 65 provider = getInstance(HelperProvider.class.getClassLoader()); is the place instantiating HelperProvider. Same HelperProvider.java line 176 InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME); is the place reading "META-INF/services/commonj.sdo.impl.HelperProvider" sdo-impl ships one "META-INF/services/commonj.sdo.impl.HelperProvider" with content of org.apache.tuscany.sdo.helper.HelperProviderImpl On 8/23/06, Ritika Maheshwari <[EMAIL PROTECTED]> wrote: > > Thanks for the input.I did insert the code in my main of test client and > the output was > file:/C:/WTP0629Host/TestCase/ > file:/C:/WTP0629Host/TuscanySDO2/bin/ > and TuscanySDO2/bin contains > META-INF/services/commonj.sdo.impl.HelperProvider.I am not sure why it is > not picking up > > ritika > > > > "Yang ZHONG" <[EMAIL PROTECTED]> > 08/21/2006 09:17 AM > Please respond to > [email protected] > > > To > [email protected] > cc > > Subject > Re: java.lang.NullPointer exception when invoking XSDHelper.INSTANCE > > > > > > > Do you want to try the following code to verify the folders part of your > ClassPath? > > try > { > for > ( > java.util.Enumeration folders = > commonj.sdo.impl.HelperProvider.class.getClassLoader().getResources( ""); > folders.hasMoreElements(); > ) > System.out.println( folders.nextElement()); > } > catch(java.io.IOException eIO) > {} > > > On 8/18/06, Ritika Maheshwari <[EMAIL PROTECTED]> wrote: > > > > My TestProject depends on the TuscanySDO Project .Currently The Test > > Project has a src/main/resources directory on class path(I manually > > created this directory)And also as you have suggested the TuscanySDO > > Project has TuscanySDO/impl/src/main/resources on its classpath.This > > folder contains the META-INF and HelperProvider info. > > So basically I have put HelperProvierImpl info at all possible > places.But > > it just does not seem to be getting picked up. > > > > ritika > > > > > > > > "Yang ZHONG" <[EMAIL PROTECTED]> > > 08/18/2006 01:44 PM > > Please respond to > > [email protected] > > > > > > To > > [email protected] > > cc > > > > Subject > > Re: java.lang.NullPointer exception when invoking XSDHelper.INSTANCE > > > > > > > > > > > > > > sdo-impl project has a "main/resources" directory under "src" directory > > already, you don't really have to create your own. > > It may be easier to just configure that as part of your "source". > > > > On 8/18/06, Ritika Maheshwari <[EMAIL PROTECTED]> wrote: > > > > > > I created a package src.main.resources under my TestProject .Then > under > > > this package creates > > META-INF/services/commonj.sdo.impl.HelperProvider.The > > > source folder for Test Project included all the packages under this > > > project.Therefore src.main.resources is also on the classpath.But > still > > I > > > have NPE for > > > XSDHelper.INSTANCE > > > > > > ritika > > > > > > > > > > > > "Yang ZHONG" <[EMAIL PROTECTED]> > > > 08/18/2006 12:29 PM > > > Please respond to > > > [email protected] > > > > > > > > > To > > > [email protected] > > > cc > > > > > > Subject > > > Re: java.lang.NullPointer exception when invoking XSDHelper.INSTANCE > > > > > > > > > > > > > > > > > > > > > File in folder doesn't necessarily automatically make it into > ClassPath, > > > you > > > can either mvn to generate Eclipse project file or manually configure > > > src/main/resources > > > as one of the project source directories > > > project properties : Java build path : source (tab) : add folder > > > (button) > > > ... > > > > > > > > > On 8/18/06, Ritika Maheshwari <[EMAIL PROTECTED]> wrote: > > > > > > > > My Test project has a folder META-INF/services which contains text > > file > > > > commonj.sdo.impl.HelperProvider > > > > Also my TuscanySDO project has a folder META-INF/services in > > > > (src.main.resources) package.which contains the same text file. > > > > > > > > I believe the other way I could try is to set the HelperProvider as > a > > > > System property.Would you know how I could do this in Eclipse? > > > > > > > > ritika > > > > > > > > > > > > > > > > "Yang ZHONG" <[EMAIL PROTECTED]> > > > > 08/18/2006 11:55 AM > > > > Please respond to > > > > [email protected] > > > > > > > > > > > > To > > > > [email protected] > > > > cc > > > > > > > > Subject > > > > Re: java.lang.NullPointer exception when invoking XSDHelper.INSTANCE > > > > > > > > > > > > > > > > > > > > > > > > > > > > I think it's fine to use sdo-impl project instead of the jar > version, > > as > > > > long as > > > > META-INF/services/commonj.sdo.impl.HelperProvider > > > > is in the same ClassPath/ClassLoader as the sdo-api jar/project. > > > > > > > > Sometimes people forgets to include > > > > src/main/resources > > > > which has META-INF/services/commonj.sdo.impl.HelperProvider, > > > > is that also your case? > > > > > > > > On 8/18/06, Ritika Maheshwari <[EMAIL PROTECTED]> wrote: > > > > > > > > > > you are right I do have sdo-api-1.0-SNAPSHOT.jar in the build path > > of > > > my > > > > > TestCase Java project (which contains my test client).This project > > > > depends > > > > > on TuscanySDO project which contains all the source code for SDO > > > > 's.(which > > > > > I extracted from SVN)Therefore I did not put the sdo-impl jar in > > build > > > > > path.By the way by sdo-impl jar did you mean > > > > > tuscany-sdo-impl-1.0-SNAPSHOT.jar? > > > > > > > > > > ritika > > > > > > > > > > > > > > > > > > > > "Yang ZHONG" <[EMAIL PROTECTED]> > > > > > 08/18/2006 11:35 AM > > > > > Please respond to > > > > > [email protected] > > > > > > > > > > > > > > > To > > > > > [email protected] > > > > > cc > > > > > > > > > > Subject > > > > > Re: java.lang.NullPointer exception when invoking > XSDHelper.INSTANCE > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Looks like you have sdo-api jar in ClassPath, what about sdo-impl > > jar? > > > > > > > > > > On 8/18/06, Ritika Maheshwari <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > Hi, > > > > > > here is my test client code > > > > > > > > > > > > //Create a DataGraph > > > > > > //SDOUtil.createTypeHelper(); > > > > > > DataObjectUtil.initRuntime(); > > > > > > URL url = > > > thisClass.getResource("/newEMF.xsd"); > > > > > > InputStream inputStream = > url.openStream(); > > > > > > //HelperProviderImpl helperProvider = new > > > > > > HelperProviderImpl(); > > > > > > XSDHelper.INSTANCE.define(inputStream, > > > > > > url.toString()); > > > > > > inputStream.close(); > > > > > > DataGraphImpl datagraph = > > > > (DataGraphImpl)SDOUtil. > > > > > > createDataGraph(); > > > > > > datagraph.createRootObject( > > > > > > "http://www.ibm.com/websphere/fvt/ejbquery/emf > ","DataGraphRoot"); > > > > > > > > > > > > XSDHelper.INSTANCE invocation gives the following stack trace > > > > > > Caused by: java.lang.NullPointerException > > > > > > at commonj.sdo.impl.HelperProvider.getXSDHelper( > > > > > > HelperProvider.java:343) > > > > > > at > > commonj.sdo.helper.XSDHelper.<clinit>(XSDHelper.java:192) > > > > > > at java.lang.J9VMInternals.initializeImpl(Native Method) > > > > > > at > > java.lang.J9VMInternals.initialize(J9VMInternals.java:148) > > > > > > ... 4 more > > > > > > I tried to put the HelperProviderImpl class name in the > > > > > > META-INF/services/commonj.sdo.impl.HelperProviderImpl text file > in > > > the > > > > > > src.main.resources package.But looks like it is not picking up > the > > > > name > > > > > > for the HelperProviderImpl. > > > > > > > > > > > > Here is the xsd file > > > > > > > > > > > > <schema > > > > > > xmlns="http://www.w3.org/2001/XMLSchema" > > > > > > targetNamespace="http://www.ibm.com/websphere/fvt/ejbquery/emf " > > > > > > xmlns:ritika="http://www.ibm.com/websphere/fvt/ejbquery/emf" > > > > > > xmlns:sdo="commonj.sdo/XML" > > > > > > xmlns:sdoJava="commonj.sdo/java" > > > > > > sdoJava:package="com.ibm.websphere.fvt.ejbquery.emf"> > > > > > > <complexType name="DataGraphRoot"> > > > > > > <sequence> > > > > > > <element maxOccurs="unbounded" minOccurs="0" name="deptMed" > > > > > > type="ritika:DeptMed"/> > > > > > > <element maxOccurs="unbounded" minOccurs="0" name="empMed" > > > > > > type="ritika:EmpMed"/> > > > > > > <element maxOccurs="unbounded" minOccurs="0" > > name="projectMed" > > > > > > type="ritika:ProjectMed"/> > > > > > > <element maxOccurs="unbounded" minOccurs="0" name="taskMed" > > > > > > type="ritika:TaskMed"/> > > > > > > <!-- <element name="changeSummary" > > type="sdo:ChangeSummaryType" > > > > /> > > > > > > --> > > > > > > </sequence> > > > > > > </complexType> > > > > > > <complexType name="DeptMed"> > > > > > > <sequence> > > > > > > <element name="deptno" type="int"/> > > > > > > <element name="name" type="string"/> > > > > > > <element name="budget" type="double"/> > > > > > > <element sdo:oppositeProperty="manages" > > > > > > sdo:propertyType="ritika:EmpMed" name="mgr" type="ritika:EmpMed" > > /> > > > > > > <element sdo:oppositeProperty="dept" > > > > > > sdo:propertyType="ritika:ProjectMed" name="proj" > > > > > type="ritika:ProjectMed" > > > > > > /> > > > > > > <element sdo:oppositeProperty="dept" > > > > sdo:propertyType="ritika:EmpMed" > > > > > > name="emp" type="ritika:EmpMed" /> > > > > > > </sequence> > > > > > > </complexType> > > > > > > <complexType name="EmpMed"> > > > > > > <sequence> > > > > > > <element name="empid" type="int"/> > > > > > > <element name="name" type="string"/> > > > > > > <element name="salary" type="double"/> > > > > > > <element name="bonus" type="double"/> > > > > > > <element sdo:oppositeProperty="emp" > > > > sdo:propertyType="ritika:DeptMed" > > > > > > name="dept" type="ritika:DeptMed" /> > > > > > > <element sdo:oppositeProperty="emp" > > > > sdo:propertyType="ritika:TaskMed" > > > > > > name="task" type="ritika:TaskMed" /> > > > > > > <element sdo:oppositeProperty="mgr" > > > > sdo:propertyType="ritika:DeptMed" > > > > > > name="manages" type="ritika:DeptMed" /> > > > > > > </sequence> > > > > > > </complexType> > > > > > > <complexType name="ProjectMed"> > > > > > > <sequence> > > > > > > <element name="projid" type="int"/> > > > > > > <element name="cost" type="double"/> > > > > > > <element name="startDate" type="dateTime" > > > > > > sdoJava:instanceClass="java.sql.Timestamp"/> > > > > > > <element name="endDate" type="dateTime" > > > > > > sdoJava:instanceClass="java.sql.Timestamp"/> > > > > > > <element sdo:oppositeProperty="proj" > > > > > sdo:propertyType="ritika:DeptMed" > > > > > > name="dept" type="ritika:DeptMed" /> > > > > > > <element sdo:oppositeProperty="proj" > > > > > sdo:propertyType="ritika:TaskMed" > > > > > > name="task" type="ritika:TaskMed" /> > > > > > > </sequence> > > > > > > </complexType> > > > > > > <complexType name="TaskMed"> > > > > > > <sequence> > > > > > > <element name="taskid" type="int"/> > > > > > > <element name="description" type="string"/> > > > > > > <element name="startDate" type="dateTime" > > > > > > sdoJava:instanceClass="java.sql.Timestamp" /> > > > > > > <element name="endDate" type="dateTime" > > > > > > sdoJava:instanceClass="java.sql.Timestamp" /> > > > > > > <element sdo:oppositeProperty="task" > > > > > > sdo:propertyType="ritika:ProjectMed" name="proj" > > > > > > type="ritika:ProjectMed"/> > > > > > > <element sdo:oppositeProperty="task" > > > > sdo:propertyType="ritika:EmpMed" > > > > > > name="emp" type="ritika:EmpMed" /> > > > > > > </sequence> > > > > > > </complexType> > > > > > > </schema> > > > > > > > > > > > > ritika > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > Yang ZHONG > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > Yang ZHONG > > > > > > > > > > > > > > > > > > > > > -- > > > > > > Yang ZHONG > > > > > > > > > > > > > > > -- > > > > Yang ZHONG > > > > > > > > > -- > > Yang ZHONG > > > -- Yang ZHONG
