abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Wells <todd.we...@theplatform.com>
Subject Re: NullPointerException when calling ClientResponse.getDocument()
Date Mon, 28 Apr 2008 23:21:48 GMT
You bet.  For what it's worth, I changed my maven dependency to Abdera 0.3.0
and had the same problem.  I am suspecting this is a race condition of some
sort, because analyzing line 96 in AbstractClientResponse w
here the NullPointerException is thrown, it seems like it’s probably calling
parser. getDefaultParserOptions() before parser is initialized--so it’s
trying to call getDefaultParserOptions() on a null object.  It seems as if
Abdera is using the Parser in a multi-threaded fashion since the getParser()
method is synchronized  -- so I’m suspecting a race condition between
threads somewhere where I’m actually managing to call getDocument() before
the parser is initialized.

I wrote a little code to munge the classpaths at the command line vs. in
IDEA, and it said that IDEA has the following things in the classpath that
ant doesn't:

/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/../Classes/cha
rsets.jar
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/../Classes/cla
sses.jar
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/../Classes/dt.
jar
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/../Classes/jce
.jar
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/../Classes/jco
nsole.jar
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/../Classes/jss
e.jar
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/../Classes/laf
.jar
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/../Classes/ui.
jar
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/deploy.jar
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/dt.jar
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/ext/apple_
provider.jar
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/ext/dnsns.
jar
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/ext/locale
data.jar
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/ext/sunjce
_provider.jar
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/ext/sunpkc
s11.jar
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/javaws.jar
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/jce.jar
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/plugin.jar
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/sa-jdi.jar

Since the command-line is using the same VM (the one built in to OS X), I’ll
assume those VM jars are actually there implicitly.  There weren’t any cases
where there were mis-matched versions of jars.  The only jar that the
command line class path included that isn’t included in IDEA is the jar that
contains the code which is being developed in IDEA which is the code that
calls into Abdera (hence IDEA doesn’t need a jar of it, it has the classes
directly).

Below are the "raw" class paths -- they are big, my apologies in advance.

Classpath from the command line (ant):

/Users/todd.wells/.m2/repository/org/apache/maven/maven-artifact/2.0.2/maven
-artifact-2.0.2.jar:/Users/todd.wells/.m2/repository/org/springframework/spr
ing-beans/2.0.6/spring-beans-2.0.6.jar:/Users/todd.wells/.m2/repository/aopa
lliance/aopalliance/1.0/aopalliance-1.0.jar:/Users/todd.wells/.m2/repository
/org/apache/abdera/abdera-i18n/0.4.0-incubating/abdera-i18n-0.4.0-incubating
.jar:/Users/todd.wells/.m2/repository/org/apache/maven/maven-error-diagnosti
cs/2.0.2/maven-error-diagnostics-2.0.2.jar:/Users/todd.wells/.m2/repository/
commons-httpclient/commons-httpclient/3.1-rc1/commons-httpclient-3.1-rc1.jar
:/Users/todd.wells/.m2/repository/javax/servlet/servlet-api/2.4/servlet-api-
2.4.jar:/Users/todd.wells/.m2/repository/commons-logging/commons-logging/1.0
.4/commons-logging-1.0.4.jar:/Users/todd.wells/.m2/repository/stax/stax-api/
1.0.1/stax-api-1.0.1.jar:/Users/todd.wells/.m2/repository/log4j/log4j/1.2.13
/log4j-1.2.13.jar:/Users/todd.wells/.m2/repository/org/apache/abdera/abdera-
server/0.4.0-incubating/abdera-server-0.4.0-incubating.jar:/Users/todd.wells
/.m2/repository/com/theplatform/test/modules/wordgenerator/pl-test-wordgener
ator/1.0.0/pl-test-wordgenerator-1.0.0.jar:/Users/todd.wells/.m2/repository/
jaxen/jaxen/1.1.1/jaxen-1.1.1.jar:/Users/todd.wells/.m2/repository/org/apach
e/geronimo/specs/geronimo-stax-api_1.0_spec/1.0.1/geronimo-stax-api_1.0_spec
-1.0.1.jar:/Users/todd.wells/.m2/repository/org/springframework/spring-web/2
.0.6/spring-web-2.0.6.jar:/Users/todd.wells/.m2/repository/org/apache/maven/
maven-artifact-ant/2.0.4/maven-artifact-ant-2.0.4.jar:/Users/todd.wells/.m2/
repository/com/theplatform/modules/pl-galaxy/1.1.0-SNAPSHOT/pl-galaxy-1.1.0-
SNAPSHOT.jar:/Users/todd.wells/.m2/repository/xml-apis/xml-apis/1.3.03/xml-a
pis-1.3.03.jar:/Users/todd.wells/.m2/repository/commons-codec/commons-codec/
1.3/commons-codec-1.3.jar:/Users/todd.wells/.m2/repository/org/codehaus/plex
us/plexus-container-default/1.0-alpha-9/plexus-container-default-1.0-alpha-9
.jar:/Users/todd.wells/.m2/repository/org/apache/maven/wagon/wagon-provider-
api/1.0-alpha-6/wagon-provider-api-1.0-alpha-6.jar:/Users/todd.wells/.m2/rep
ository/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar:/Use
rs/todd.wells/.m2/repository/org/apache/ws/commons/axiom/axiom-impl/1.2.5/ax
iom-impl-1.2.5.jar:/Users/todd.wells/.m2/repository/org/springframework/spri
ng-core/2.0.6/spring-core-2.0.6.jar:/Users/todd.wells/.m2/repository/javax/m
ail/mail/1.4/mail-1.4.jar:/Users/todd.wells/.m2/repository/org/apache/abdera
/abdera-parser/0.4.0-incubating/abdera-parser-0.4.0-incubating.jar:/Users/to
dd.wells/.m2/repository/org/apache/maven/maven-artifact-manager/2.0.2/maven-
artifact-manager-2.0.2.jar:/Users/todd.wells/.m2/repository/org/apache/maven
/maven-project/2.0.2/maven-project-2.0.2.jar:/Users/todd.wells/.m2/repositor
y/org/apache/maven/maven-settings/2.0.2/maven-settings-2.0.2.jar:/Users/todd
.wells/.m2/repository/groovy/groovy-all/1.5.5/groovy-all-1.5.5.jar:/Users/to
dd.wells/.m2/repository/org/apache/maven/maven-model/2.0.2/maven-model-2.0.2
.jar:/Users/todd.wells/.m2/repository/org/apache/geronimo/specs/geronimo-act
ivation_1.0.2_spec/1.1/geronimo-activation_1.0.2_spec-1.1.jar:/Users/todd.we
lls/.m2/repository/org/codehaus/woodstox/wstx-asl/3.2.1/wstx-asl-3.2.1.jar:/
Users/todd.wells/.m2/repository/ant/ant/1.7/ant-1.7.jar:/Users/todd.wells/.m
2/repository/org/springframework/spring-context/2.0.6/spring-context-2.0.6.j
ar:/Users/todd.wells/.m2/repository/org/apache/maven/maven-repository-metada
ta/2.0.2/maven-repository-metadata-2.0.2.jar:/Users/todd.wells/.m2/repositor
y/xalan/xalan/2.6.0/xalan-2.6.0.jar:/Users/todd.wells/.m2/repository/com/ibm
/icu/icu4j/2.6.1/icu4j-2.6.1.jar:/Users/todd.wells/.m2/repository/jdom/jdom/
1.0/jdom-1.0.jar:/Users/todd.wells/.m2/repository/org/apache/abdera/abdera-s
pring/0.4.0-incubating/abdera-spring-0.4.0-incubating.jar:/Users/todd.wells/
.m2/repository/junit/junit/4.0/junit-4.0.jar:/Users/todd.wells/.m2/repositor
y/org/apache/maven/maven-profile/2.0.2/maven-profile-2.0.2.jar:/Users/todd.w
ells/.m2/repository/com/theplatform/test/modules/datehelper/pl-test-datehelp
er/1.0-SNAPSHOT/pl-test-datehelper-1.0-SNAPSHOT.jar:/Users/todd.wells/.m2/re
pository/javax/activation/activation/1.1/activation-1.1.jar:/Users/todd.well
s/.m2/repository/org/apache/ws/commons/axiom/axiom-api/1.2.5/axiom-api-1.2.5
.jar:/Users/todd.wells/.m2/repository/org/apache/maven/wagon/wagon-file/1.0-
alpha-7/wagon-file-1.0-alpha-7.jar:/Users/todd.wells/.m2/repository/org/code
haus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar:/Users/todd.wells/.m2/repo
sitory/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar:/Users/todd.wells/.m2/repository/an
t/ant-launcher/1.7/ant-launcher-1.7.jar:/Users/todd.wells/.m2/repository/xer
ces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.jar:/Users/todd.wells/.m2/reposi
tory/xom/xom/1.0/xom-1.0.jar:/Users/todd.wells/.m2/repository/org/apache/abd
era/abdera-client/0.4.0-incubating/abdera-client-0.4.0-incubating.jar:/Users
/todd.wells/.m2/repository/org/apache/abdera/abdera-core/0.4.0-incubating/ab
dera-core-0.4.0-incubating.jar:/Users/todd.wells/.m2/repository/xerces/xerce
sImpl/2.8.0/xercesImpl-2.8.0.jar:/Users/todd.wells/.m2/repository/org/apache
/maven/wagon/wagon-http-lightweight/1.0-alpha-6/wagon-http-lightweight-1.0-a
lpha-6.jar

Classpath in IDEA:

/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/deploy.jar
:/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/dt.jar:/S
ystem/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/javaws.jar:/
System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/jce.jar:/Sy
stem/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/plugin.jar:/S
ystem/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/sa-jdi.jar:/
System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/../Classes/char
sets.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/../Cl
asses/classes.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5/H
ome/../Classes/dt.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1
.5/Home/../Classes/jce.jar:/System/Library/Frameworks/JavaVM.framework/Versi
ons/1.5/Home/../Classes/jconsole.jar:/System/Library/Frameworks/JavaVM.frame
work/Versions/1.5/Home/../Classes/jsse.jar:/System/Library/Frameworks/JavaVM
.framework/Versions/1.5/Home/../Classes/laf.jar:/System/Library/Frameworks/J
avaVM.framework/Versions/1.5/Home/../Classes/ui.jar:/System/Library/Framewor
ks/JavaVM.framework/Versions/1.5/Home/lib/ext/apple_provider.jar:/System/Lib
rary/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/ext/dnsns.jar:/System
/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/ext/localedata.ja
r:/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/ext/sunj
ce_provider.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Hom
e/lib/ext/sunpkcs11.jar:/depot/Tools/deploy/galaxy/main/target/classes:/User
s/todd.wells/.m2/repository/junit/junit/4.0/junit-4.0.jar:/Users/todd.wells/
.m2/repository/log4j/log4j/1.2.13/log4j-1.2.13.jar:/Users/todd.wells/.m2/rep
ository/com/theplatform/test/modules/wordgenerator/pl-test-wordgenerator/1.0
.0/pl-test-wordgenerator-1.0.0.jar:/Users/todd.wells/.m2/repository/com/thep
latform/test/modules/datehelper/pl-test-datehelper/1.0-SNAPSHOT/pl-test-date
helper-1.0-SNAPSHOT.jar:/Users/todd.wells/.m2/repository/org/apache/abdera/a
bdera-client/0.4.0-incubating/abdera-client-0.4.0-incubating.jar:/Users/todd
.wells/.m2/repository/org/apache/abdera/abdera-core/0.4.0-incubating/abdera-
core-0.4.0-incubating.jar:/Users/todd.wells/.m2/repository/org/apache/abdera
/abdera-i18n/0.4.0-incubating/abdera-i18n-0.4.0-incubating.jar:/Users/todd.w
ells/.m2/repository/org/apache/geronimo/specs/geronimo-activation_1.0.2_spec
/1.1/geronimo-activation_1.0.2_spec-1.1.jar:/Users/todd.wells/.m2/repository
/commons-codec/commons-codec/1.3/commons-codec-1.3.jar:/Users/todd.wells/.m2
/repository/org/apache/abdera/abdera-parser/0.4.0-incubating/abdera-parser-0
.4.0-incubating.jar:/Users/todd.wells/.m2/repository/org/apache/ws/commons/a
xiom/axiom-impl/1.2.5/axiom-impl-1.2.5.jar:/Users/todd.wells/.m2/repository/
org/apache/ws/commons/axiom/axiom-api/1.2.5/axiom-api-1.2.5.jar:/Users/todd.
wells/.m2/repository/commons-logging/commons-logging/1.0.4/commons-logging-1
.0.4.jar:/Users/todd.wells/.m2/repository/jaxen/jaxen/1.1.1/jaxen-1.1.1.jar:
/Users/todd.wells/.m2/repository/xerces/xercesImpl/2.8.0/xercesImpl-2.8.0.ja
r:/Users/todd.wells/.m2/repository/xml-apis/xml-apis/1.3.03/xml-apis-1.3.03.
jar:/Users/todd.wells/.m2/repository/org/apache/geronimo/specs/geronimo-stax
-api_1.0_spec/1.0.1/geronimo-stax-api_1.0_spec-1.0.1.jar:/Users/todd.wells/.
m2/repository/org/codehaus/woodstox/wstx-asl/3.2.1/wstx-asl-3.2.1.jar:/Users
/todd.wells/.m2/repository/commons-httpclient/commons-httpclient/3.1-rc1/com
mons-httpclient-3.1-rc1.jar:/Users/todd.wells/.m2/repository/org/apache/abde
ra/abdera-server/0.4.0-incubating/abdera-server-0.4.0-incubating.jar:/Users/
todd.wells/.m2/repository/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar:
/Users/todd.wells/.m2/repository/org/apache/abdera/abdera-spring/0.4.0-incub
ating/abdera-spring-0.4.0-incubating.jar:/Users/todd.wells/.m2/repository/or
g/springframework/spring-web/2.0.6/spring-web-2.0.6.jar:/Users/todd.wells/.m
2/repository/org/springframework/spring-beans/2.0.6/spring-beans-2.0.6.jar:/
Users/todd.wells/.m2/repository/org/springframework/spring-core/2.0.6/spring
-core-2.0.6.jar:/Users/todd.wells/.m2/repository/org/springframework/spring-
context/2.0.6/spring-context-2.0.6.jar:/Users/todd.wells/.m2/repository/aopa
lliance/aopalliance/1.0/aopalliance-1.0.jar:/Users/todd.wells/.m2/repository
/org/apache/maven/maven-artifact-ant/2.0.4/maven-artifact-ant-2.0.4.jar:/Use
rs/todd.wells/.m2/repository/org/apache/maven/maven-project/2.0.2/maven-proj
ect-2.0.2.jar:/Users/todd.wells/.m2/repository/org/apache/maven/maven-profil
e/2.0.2/maven-profile-2.0.2.jar:/Users/todd.wells/.m2/repository/org/apache/
maven/maven-model/2.0.2/maven-model-2.0.2.jar:/Users/todd.wells/.m2/reposito
ry/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar:/Users/todd.wel
ls/.m2/repository/org/codehaus/plexus/plexus-container-default/1.0-alpha-9/p
lexus-container-default-1.0-alpha-9.jar:/Users/todd.wells/.m2/repository/cla
ssworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar:/Users/todd.wel
ls/.m2/repository/org/apache/maven/maven-artifact-manager/2.0.2/maven-artifa
ct-manager-2.0.2.jar:/Users/todd.wells/.m2/repository/org/apache/maven/maven
-repository-metadata/2.0.2/maven-repository-metadata-2.0.2.jar:/Users/todd.w
ells/.m2/repository/org/apache/maven/maven-artifact/2.0.2/maven-artifact-2.0
.2.jar:/Users/todd.wells/.m2/repository/org/apache/maven/wagon/wagon-provide
r-api/1.0-alpha-6/wagon-provider-api-1.0-alpha-6.jar:/Users/todd.wells/.m2/r
epository/org/apache/maven/maven-error-diagnostics/2.0.2/maven-error-diagnos
tics-2.0.2.jar:/Users/todd.wells/.m2/repository/org/apache/maven/maven-setti
ngs/2.0.2/maven-settings-2.0.2.jar:/Users/todd.wells/.m2/repository/org/apac
he/maven/wagon/wagon-file/1.0-alpha-7/wagon-file-1.0-alpha-7.jar:/Users/todd
.wells/.m2/repository/org/apache/maven/wagon/wagon-http-lightweight/1.0-alph
a-6/wagon-http-lightweight-1.0-alpha-6.jar:/Users/todd.wells/.m2/repository/
ant/ant/1.7/ant-1.7.jar:/Users/todd.wells/.m2/repository/groovy/groovy-all/1
.5.5/groovy-all-1.5.5.jar:/Users/todd.wells/.m2/repository/javax/mail/mail/1
.4/mail-1.4.jar:/Users/todd.wells/.m2/repository/javax/activation/activation
/1.1/activation-1.1.jar:/Users/todd.wells/.m2/repository/stax/stax-api/1.0.1
/stax-api-1.0.1.jar:/Users/todd.wells/.m2/repository/dom4j/dom4j/1.6.1/dom4j
-1.6.1.jar:/Users/todd.wells/.m2/repository/jdom/jdom/1.0/jdom-1.0.jar:/User
s/todd.wells/.m2/repository/xom/xom/1.0/xom-1.0.jar:/Users/todd.wells/.m2/re
pository/xerces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.jar:/Users/todd.well
s/.m2/repository/xalan/xalan/2.6.0/xalan-2.6.0.jar:/Users/todd.wells/.m2/rep
ository/com/ibm/icu/icu4j/2.6.1/icu4j-2.6.1.jar:/Users/todd.wells/.m2/reposi
tory/ant/ant-launcher/1.7/ant-launcher-1.7.jar




On 4/28/08 2:56 PM, "Dan Diephouse" <dan.diephouse@mulesource.com> wrote:

> Well I'll be honest, I'm stumped too. This is with 0.4.0 right? Any
> chance you can print out the classpath?
> 
> Dan
> 
> Todd Wells wrote:
>> I¹m stumped.  I have this repeatable case where ClientResponse.getDocument()
>> results in a NullPointerException, even though a fully-formed atom document
>> was successfully retrieved.
>> 
>> Here¹s the weird part ‹ and sorry there are so many caveats here ‹ this is
>> running from inside an ant task that I¹ve written.  When I run it inside of
>> the debugger or IDE (while not debugging) it works just fine.  When I run it
>> via the command line I get the NPE every time.  I¹m routing both attempts
>> through an HTTP proxy (fiddler) and I can see that the HTTP request and
>> response are the same in both cases , but in the one case Abdera throws the
>> NPE.  I¹ve been poking at this for several hours now and I¹m at my wit¹s
>> end.  Here¹s the stack trace I¹m getting.  Any idea how I could further nail
>> this down?
>> 
>> Caused by: java.lang.NullPointerException
>>         at 
>> org.apache.abdera.protocol.client.AbstractClientResponse.getDocument(Abstrac
>> tClientResponse.java:96)
>>         at 
>> org.apache.abdera.protocol.client.AbstractClientResponse.getDocument(Abstrac
>> tClientResponse.java:74)
>>         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:585)
>>         at 
>> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
>>         at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)
>>         at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:910)
>>         at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:754)
>>         at 
>> org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.jav
>> a:765)
>>         at 
>> org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:75
>> 3)
>>         at 
>> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptByteco
>> deAdapter.java:167)
>> 
>> My best (and somewhat feeble) guess is that there¹s something different in
>> the class paths that is causing the difference in behavior.  What that might
>> be, I have no idea.
>> 
>>   
> 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message