[
https://issues.apache.org/jira/browse/HBASE-6656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13551134#comment-13551134
]
Mauricio Morales commented on HBASE-6656:
-----------------------------------------
The jar is stored in HDFS and the Coprocessor setup refers to the HDFS path for
the Endpoint's class location.
The RegionServer is able to load that very same jar (from HDFS) on remote
calls... it's only the local call from another Coprocessor (say a
RegionObserver) that fails.
Do you think having the jar on the CLASSPATH for the JVM should do the trick?
(this implies, however, manual deployment to all nodes instead of the
convenience of using HDFS for jar storage of Coprocessor jars.
> Cannot call a Coprocessor Endpoint from a RegionObserver
> --------------------------------------------------------
>
> Key: HBASE-6656
> URL: https://issues.apache.org/jira/browse/HBASE-6656
> Project: HBase
> Issue Type: Bug
> Components: Coprocessors
> Affects Versions: 0.92.1
> Environment: CentOS5
> Reporter: Mauricio Morales
>
> I'm trying to call a Coprocessor Endpoint from within the preGet handler of a
> RegionObserver, and it's throwing Class Loader issues.
> The exact same Coprocessor Endpoint works perfectly from remote Java client,
> however, fails from within the same Region Server.
> For our particular test environment, only 1 Region Server is available, so I
> guess it's a "local" call that fails, and perhaps a remote RegionServer
> wouldn't fail, but that doesn't justify the issue :).
> The Code within the RegionObserver is roughly (way reduced) as follows:
> ---
> @Override
> public void preGet(ObserverContext<RegionCoprocessorEnvironment> e, Get
> get, List<KeyValue> results)
> throws IOException {
> Map<byte[], Set<byte[]>> results;
> // scan: for all regions
> try {
>
> Batch.Call<PlatformStatsIndexEndpointProtocol,Set<byte[]>> batchCall = new
> Batch.Call<PlatformStatsIndexEndpointProtocol,Set<byte[]>>() {
> public Set<byte[]>
> call(PlatformStatsIndexEndpointProtocol instance) throws IOException{
> return instance.getKeyTokenByPrefix(index,
> match, additionalMatches);
> }
> };
> results =
> indexTable.coprocessorExec(PlatformStatsIndexEndpointProtocol.class, null,
> null, batchCall);
> } catch (Throwable e1) {
> e1.printStackTrace();
> throw new IOException(e1);
> }
>
> Set<byte[]> finalResultSet = new HashSet<byte[]>();
> for (Map.Entry<byte[], Set<byte[]>> e : results.entrySet()) {
> finalResultSet.addAll(e.getValue());
> }
> }
> ---
> The Code for the Coprocessor Endpoint is irrelevant, as it never gets
> executed.
> This is the Exception I get on the Client side (Server side logged exception
> below).
> ---
> Thu Aug 23 17:37:45 CST 2012,
> org.apache.hadoop.hbase.client.HTable$5@26659db7,java.io.IOException:
> java.io.IOException: java.io.IOException: java.lang.IllegalArgumentException:
> interface com.company.hbase.platformstats.PlatformStatsIndexEndpointProtocol
> is not visible from class loader
> at
> com.company.hbase.platformstats.IndexQueryRegionObserver.preGet(IndexQueryRegionObserver.java:100)
> at
> org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.preGet(RegionCoprocessorHost.java:553)
> at org.apache.hadoop.hbase.regionserver.HRegion.get(HRegion.java:3737)
> at org.apache.hadoop.hbase.regionserver.HRegion.get(HRegion.java:3639)
> at
> org.apache.hadoop.hbase.regionserver.HRegionServer.get(HRegionServer.java:1785)
> at sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.apache.hadoop.hbase.ipc.WritableRpcEngine$Server.call(WritableRpcEngine.java:364)
> at
> org.apache.hadoop.hbase.ipc.HBaseServer$Handler.run(HBaseServer.java:1336)
> Caused by: java.io.IOException: java.lang.IllegalArgumentException: interface
> com.company.hbase.platformstats.PlatformStatsIndexEndpointProtocol is not
> visible from class loader
> at
> com.company.hbase.platformstats.PlatformStatsIndexer.getKeyTokens(PlatformStatsIndexer.java:390)
> at
> com.company.hbase.platformstats.PlatformStatsIndexer.getKeyTokensBySubstring(PlatformStatsIndexer.java:348)
> at
> com.company.hbase.platformstats.IndexQueryRegionObserver.searchTokens(IndexQueryRegionObserver.java:148)
> at
> com.company.hbase.platformstats.IndexQueryRegionObserver.preGet(IndexQueryRegionObserver.java:97)
> ... 9 more
> Caused by: java.lang.IllegalArgumentException: interface
> com.company.hbase.platformstats.PlatformStatsIndexEndpointProtocol is not
> visible from class loader
> at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353)
> at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
> at
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation$4.call(HConnectionManager.java:1451)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:662)
> at
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getRegionServerWithRetries(HConnectionManager.java:1345)
> at org.apache.hadoop.hbase.client.HTable.get(HTable.java:657)
> at Test.queryIndex(Test.java:109)
> at Test.main(Test.java:42)
> ---
> This is the Server Side exception logged:
> ---
> 2012-08-23 19:37:44,705 ERROR
> org.apache.hadoop.hbase.regionserver.HRegionServer:
> java.io.IOException: java.io.IOException: java.lang.IllegalArgumentException:
> interface com.company.hbase.platformstats.PlatformStatsIndexEndpointProtocol
> is not
> visible from class loader
> at
> com.company.hbase.platformstats.IndexQueryRegionObserver.preGet(IndexQueryRegionObserver.java:100)
> at
> org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.preGet(RegionCoprocessorHost.java:553)
> at org.apache.hadoop.hbase.regionserver.HRegion.get(HRegion.java:3737)
> at org.apache.hadoop.hbase.regionserver.HRegion.get(HRegion.java:3639)
> at
> org.apache.hadoop.hbase.regionserver.HRegionServer.get(HRegionServer.java:1785)
> at sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.apache.hadoop.hbase.ipc.WritableRpcEngine$Server.call(WritableRpcEngine.java:364)
> at
> org.apache.hadoop.hbase.ipc.HBaseServer$Handler.run(HBaseServer.java:1336)
> Caused by: java.io.IOException: java.lang.IllegalArgumentException: interface
> com.company.hbase.platformstats.PlatformStatsIndexEndpointProtocol is not
> visible from class loader
> at
> com.company.hbase.platformstats.PlatformStatsIndexer.getKeyTokens(PlatformStatsIndexer.java:390)
> at
> com.company.hbase.platformstats.PlatformStatsIndexer.getKeyTokensBySubstring(PlatformStatsIndexer.java:348)
> at
> com.company.hbase.platformstats.IndexQueryRegionObserver.searchTokens(IndexQueryRegionObserver.java:148)
> at
> com.company.hbase.platformstats.IndexQueryRegionObserver.preGet(IndexQueryRegionObserver.java:97)
> ... 9 more
> Caused by: java.lang.IllegalArgumentException: interface
> com.company.hbase.platformstats.PlatformStatsIndexEndpointProtocol is not
> visible from class loader
> at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353)
> at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
> at
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation$4.call(HConnectionManager.java:1451)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:662)
> ---
> I'm not senior java developer, so this Class Loader visibility issue goes
> beyond my reach. I have the theory that because it's a local call, the
> ClassLoaders for the very same Protocol interface may be different (1 reads
> from the .jar, another from the remote HTable client call); but I have not
> been able to prove nor fix this behavior.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira