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
