MarkA
MarkA

Reputation: 1226

How do I debug certain Java classes with Eclipse?

I have been using Eclipse for a year or so, and usually I have no problem debugging software. However, I have encountered a situation which has stumped me.

A test case which I am running is failing with the following stack trace:

com.sun.xml.internal.ws.protocol.soap.MessageCreationException: Couldn't create SOAP message due to exception: Unable to create StAX reader or writer
    at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:283)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:180)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:83)
    at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105)
    at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:587)
    at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:546)
    at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:531)
    at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:428)
    at com.sun.xml.internal.ws.client.Stub.process(Stub.java:211)
    at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:124)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
    at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
    at $Proxy34.getCommission(Unknown Source)
    at uk.co.bglgroup.servicehub.external.lifehub.v1_0.fitnesse.ws.LifeHubWebServiceLifeHubWebServicePortClient.doCallGetCommission(LifeHubWebServiceLifeHubWebServicePortClient.java:51)
    at uk.co.bglgroup.servicehub.external.lifehub.v1_0.fitnesse.service.GetCommissionService.getCommissionService(GetCommissionService.java:40)
    at uk.co.bglgroup.servicehub.external.lifehub.v1_0.fitnesse.endToEnd.SkeletalEndToEndTest.run(SkeletalEndToEndTest.java:82)
    at uk.co.bglgroup.servicehub.external.lifehub.v1_0.fitnesse.endToEnd.SkeletalEndToEndTest.skeletalTestQA(SkeletalEndToEndTest.java:66)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: com.sun.xml.internal.ws.streaming.XMLReaderException: Unable to create StAX reader or writer
    at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory$Default.doCreate(XMLStreamReaderFactory.java:358)
    at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.create(XMLStreamReaderFactory.java:139)
    at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.create(XMLStreamReaderFactory.java:143)
    at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:290)
    at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:118)
    at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:278)
    ... 39 more
Caused by: javax.xml.stream.XMLStreamException: java.net.MalformedURLException
    at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.setInputSource(XMLStreamReaderImpl.java:219)
    at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.<init>(XMLStreamReaderImpl.java:191)
    at com.sun.xml.internal.stream.XMLInputFactoryImpl.getXMLStreamReaderImpl(XMLInputFactoryImpl.java:279)
    at com.sun.xml.internal.stream.XMLInputFactoryImpl.createXMLStreamReader(XMLInputFactoryImpl.java:151)
    at com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory$Default.doCreate(XMLStreamReaderFactory.java:356)
    ... 44 more
Caused by: java.net.MalformedURLException
    at java.net.URL.<init>(URL.java:601)
    at java.net.URL.<init>(URL.java:464)
    at java.net.URL.<init>(URL.java:413)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:650)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1315)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDocumentEntity(XMLEntityManager.java:1267)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.setInputSource(XMLDocumentScannerImpl.java:281)
    at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.setInputSource(XMLStreamReaderImpl.java:206)
    ... 48 more 

OK, so now I want to debug into the issue, and I can step down through the code I have written until I reach an object called SEIStub.class For this object, Eclipse is reporting "The source attachment does not include the source for file SEIStub.class"

If I select "Change Attached Source", then a box pops up which correctly identifies the location of src.zip within the correct JDK version. So nothing to change there ...

I have gone into the src.zip manually, and indeed there is no com.sun.internal folder.

One confusing aspect is that when I run my test in a development environment, everything works. When I run my test in a QA environment, I get the stack trace listed out above.

What is most confusing of all, is that although I can put a break point into com.sun.org.apache.xerces.internal.impl.XMLEntityManager, and I can reach that break point after passing through the SEIStub object, I am unable to view any of the variables within that program, and they do not even show up as valid variables when I look in the Eclipse Variables tab.

I am using JDK 1.6.0_25

Hmmm ... very confused and running out of hair to pull out !

Can anyone help me to get my debug operating on this class ?

Many Thanks, Mark

UPDATE: I have also tried downloading the http://openjdk.java.net/projects/jdk6/ and this set of source also seems to be missing all of the com.sun.internal objects.

UPDATE: I am using Eclipse Helios, and a colleague has repeated the same issue using Juno.

Upvotes: 2

Views: 1223

Answers (1)

Dev
Dev

Reputation: 12196

The issue is caused by the XmlEntityManager trying to resolve entities in the document being parsed. Specifically it did not like the SystemId URL that it read on the document (because it was malformed).

Source for com.sun.org.apache.xerces.internal.impl.XMLEntityManager, you'll want to look at line 650

Upvotes: 1

Related Questions