: Subject: java.lang.IllegalAccessError when invoking protected method from : another class in the same package path but different jar. ... : I am overriding the query component and creating a custom component. I am : using _responseDocs from org.apache.solr.handler.component.ResponseBuilder : to get the values. I have my component in same package
_responseDocs is not "protected" it is "package-private" which is why you can't access it from a subclass in another *runtime* pacakge. Even if you put your custom component in the same org.apache.solr... package namespace, the runtime package is determined by the ClassLoader combined with the source package... http://www.cooljeff.co.uk/2009/05/03/the-subtleties-of-overriding-package-private-methods/ ...this is helpful to ensure plugins don't attempt to do tihngs they shouldn't. In general, the ResponseBuilder class internals aren't very friendly in terms of allowing custom components to interact with the intermediate results of other built in components -- it's primarily designed arround letting other internal Solr components share data with eachother in (hopefully) well tested ways. Note that there is even a specific comment one line directly above the declaration of _responseDocs that alludes to it and several other variables being deliberately package-private... /* private... components that don't own these shouldn't use them */ SolrDocumentList _responseDocs; StatsInfo _statsInfo; TermsComponent.TermsHelper _termsHelper; SimpleOrderedMap<List<NamedList<Object>>> _pivots; If you want access to the SolrDocumentList containing the query results, the only safe way/time to do that is by fetching it out of the response (ResponseBuilder.rsp) after the QueryComponent has put it there in it's finishStage -- untill then ResponseBuilder._responseDocs may not be correct (ie: distribute search, grouped search, etc...) -Hoss