Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [xsd-dev] NullPointerException on getResource()

Very sorry...I'm used to the something-dev and something-user
pattern of mailing lists and wondered why there was no -user
mailing list. But it didn't occur to me to look for it in a
different medium... 

You were right about my problem though. (Thanks much Ed!) I
persisted the typo "xsd.resource.jar" (missing s) from your
FAQ. Let me throw in one perhaps -dev appropriate suggestion
though: something ought to be throwing some kind of "resource
not found" exception rather than letting it manifest as a
NullPointerException...

Thanks,

Eric


---- Original message ----
>Date: Fri, 21 Nov 2003 14:05:43 -0500
>From: Ed Merks <merks@xxxxxxxxxx>  
>Subject: Re: [xsd-dev] NullPointerException on getResource()  
>To: xsd-dev@xxxxxxxxxxx
>Cc: xsd-dev@xxxxxxxxxxx, xsd-dev-admin@xxxxxxxxxxx
>
>
>
>
>
>Eric,
>
>Please ask questions on the XSD newsgroup forum rather than
on this mailing
>list for developers of the XSD model.   This problem looks
like what would
>happen if the xsd.resources.jar is missing from the
classpath.  Are you
>sure you have it right?  Have you looked at
org.eclipse.xsd.test has a
>starting point?
>
>
>Ed Merks/Toronto/IBM@IBMCA
>mailto: merks@xxxxxxxxxx
>905-413-3265  (t/l 969)
>
>
>
>
>                                                            
                                                             
                       
>                      ericjs@xxxxxxx                        
                                                             
                       
>                      Sent by:                 To:      
xsd-dev@xxxxxxxxxxx                                          
                           
>                      xsd-dev-admin@ecl        cc:          
                                                             
                       
>                      ipse.org                 Subject: 
[xsd-dev] NullPointerException on getResource()              
                           
>                                                            
                                                             
                       
>                                                            
                                                             
                       
>                      11/21/2003 01:51                      
                                                             
                       
>                      PM                                    
                                                             
                       
>                      Please respond to                     
                                                             
                       
>                      xsd-dev                               
                                                             
                       
>                                                            
                                                             
                       
>                                                            
                                                             
                       
>
>
>
>Hi,
>
>I'm just trying to get started with this tool, and seem to be
>hitting a wall out of the box. I'd really appreciate any help
>anyone can offer pointing me in the right direction.
>
>I'm trying to use it outside of the Eclipse environment.
>I've downgraded my environment to use jdk 1.3.1 and xerces
>2.0.6 as it seems to require, and set up the classpath to be
>exactly the 6 jars specified in the FAQ and in that order,
>except that I am using 1.1.1 of these jars.
>
>To get started I'm just trying to load up a simple schema,
>borrowing from the code I've found on the site--the same
>pattern used in the "Analyzing XML schemas with the Schema
>Infoset Model" article, and in the sample code in the java doc
>pointed to by the FAQ (XSDPrototypicalSchema.html).
>
>However I keep getting a NullPointerException on the call to
>getResource() on the ResourceSet.  Am I doing something
>stupid? Missing something basic? Or is the info I'm looking at
>out of date for version 1.1.1?
>
>My code, up to the line where the NullPointerException occurs,
>looks like this:
>----------------------
>
>Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("xsd",
>new XSDResourceFactoryImpl());
>   File schemaFile = newFile("C:\\aps\\schemas\\myschema.xsd");
>   URI schemaURI =
>URI.createFileURI(schemaFile.getCanonicalFile().toString());
>   ResourceSet resourceSet = new ResourceSetImpl();
>   XSDResourceImpl xsdSchemaResource =
>(XSDResourceImpl)resourceSet.getResource(schemaURI, true);
>
>---------------------
>I was originally working with a HTTP based schema URL and was
>originally using a line more like what was in the example code
>like
>
>XSDResourceImpl xsdSchemaResource =
>(XSDResourceImpl)resourceSet.getResource(URI.createDeviceURI(schemaURI),
>true)
>
>But this gave me that exception so I attempted to simply to
>use a local file. All roads seems to lead to that same
>stack traces (some seem to be emitted from the guts of the xsd
>code):
>
>java.lang.NullPointerException
>        at
>org.eclipse.emf.common.EMFPlugin.getBaseURL(EMFPlugin.java:101)
>        at
>org.eclipse.xsd.util.XSDResourceImpl.createEntityResolver(XSDResourceImpl.java:207)
>
>        at
>org.eclipse.xsd.util.XSDResourceImpl.getDocument(XSDResourceImpl.java:179)
>        at
>org.eclipse.xsd.util.XSDResourceImpl.doLoad(XSDResourceImpl.java:333)
>
>        at
>org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:881)
>
>        at
>org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:755)
>
>        at
>org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:220)
>
>        at
>org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:286)
>
>        at
>com.classwell.offline.schema.XsdParseTest.getSchema(XsdParseTest.java:71)
>        at
>com.classwell.offline.schema.XsdParseTest.main(XsdParseTest.java:42)
>java.lang.NullPointerException
>        at
>org.eclipse.emf.common.EMFPlugin.getBaseURL(EMFPlugin.java:101)
>        at
>org.eclipse.xsd.impl.XSDSchemaImpl.getSchemaInstance(XSDSchemaImpl.java:707)
>
>        at
>org.eclipse.xsd.impl.XSDSchemaImpl.resolveSchema(XSDSchemaImpl.java:2040)
>        at
>org.eclipse.xsd.impl.XSDSchemaImpl.patch(XSDSchemaImpl.java:1485)
>        at
>org.eclipse.xsd.impl.XSDSchemaImpl.changeAttribute(XSDSchemaImpl.java:2241)
>        at
>org.eclipse.xsd.impl.XSDConcreteComponentImpl.eNotify(XSDConcreteComponentImpl.java:1205)
>
>        at
>org.eclipse.xsd.impl.XSDSchemaImpl.setSchemaLocation(XSDSchemaImpl.java:842)
>
>        at
>org.eclipse.xsd.util.XSDResourceImpl.attached(XSDResourceImpl.java:410)
>        at
>org.eclipse.emf.ecore.resource.impl.ResourceImpl$ContentsEList.inverseAdd(ResourceImpl.java:326)
>
>        at
>org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:233)
>
>        at
>org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:588)
>        at
>org.eclipse.xsd.util.XSDResourceImpl.doLoad(XSDResourceImpl.java:374)
>
>        at
>org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:881)
>
>        at
>org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:755)
>
>        at
>org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:220)
>
>        at
>org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:286)
>
>        at
>com.classwell.offline.schema.XsdParseTest.getSchema(XsdParseTest.java:71)
>        at
>com.classwell.offline.schema.XsdParseTest.main(XsdParseTest.java:42)
>Exception in thread "main" java.lang.NullPointerException
>        at
>org.eclipse.emf.common.EMFPlugin.getBaseURL(EMFPlugin.java:101)
>        at
>org.eclipse.xsd.impl.XSDSchemaImpl.getGlobalResourceSet(XSDSchemaImpl.java:527)
>
>        at
>org.eclipse.xsd.impl.XSDSchemaImpl.getSchemaInstance(XSDSchemaImpl.java:721)
>
>        at
>org.eclipse.xsd.impl.XSDSchemaImpl.resolveSchema(XSDSchemaImpl.java:2040)
>        at
>org.eclipse.xsd.impl.XSDSchemaImpl.patch(XSDSchemaImpl.java:1485)
>        at
>org.eclipse.xsd.impl.XSDSchemaImpl.changeAttribute(XSDSchemaImpl.java:2241)
>        at
>org.eclipse.xsd.impl.XSDConcreteComponentImpl.eNotify(XSDConcreteComponentImpl.java:1205)
>
>        at
>org.eclipse.xsd.impl.XSDSchemaImpl.setSchemaLocation(XSDSchemaImpl.java:842)
>
>        at
>org.eclipse.xsd.util.XSDResourceImpl.attached(XSDResourceImpl.java:410)
>        at
>org.eclipse.emf.ecore.resource.impl.ResourceImpl$ContentsEList.inverseAdd(ResourceImpl.java:326)
>
>        at
>org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:233)
>
>        at
>org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:588)
>        at
>org.eclipse.xsd.util.XSDResourceImpl.doLoad(XSDResourceImpl.java:374)
>
>        at
>org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:881)
>
>        at
>org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:755)
>
>        at
>org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:220)
>
>        at
>org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:286)
>
>        at
>com.classwell.offline.schema.XsdParseTest.getSchema(XsdParseTest.java:71)
>        at
>com.classwell.offline.schema.XsdParseTest.main(XsdParseTest.java:42)
>
>
>
>Thanks,
>
>Eric
>_______________________________________________
>xsd-dev mailing list
>xsd-dev@xxxxxxxxxxx
>http://dev.eclipse.org/mailman/listinfo/xsd-dev
>
>
>
>_______________________________________________
>xsd-dev mailing list
>xsd-dev@xxxxxxxxxxx
>http://dev.eclipse.org/mailman/listinfo/xsd-dev


Back to the top