Hi Chris,

Thanks for the help! I got it working per with some more playing around. It 
looks like the problem had to do with referencing my custom query handler JAR 
within webgrid, which you suggested might be incorrect.

My old (incorrect) referencing setup:
1a) Added an entry to webgrid conf page's "Code Base" form, pointing to my JAR 
located within tomcat/lib
1b) Added an entry to webgrid conf page's "Product Query Handlers" form, 
pointing to the name of my handler class: 
"gov.nasa.jpl.co2.cdx.hdf5.HDF5GetMetHandler"

My new (correct) referencing setup:
2a) Removed the entry within webgrid conf page's "Code Base" form, pointing to 
my JAR located within tomcat/lib
2b) Kept the entry within webgrid conf page's "Product Query Handlers" form, 
pointing to the name of my handler class: 
"gov.nasa.jpl.co2.cdx.hdf5.HDF5GetMetHandler"
2c) Placed my JAR within webgrid/WEB-INF/lib

This brings up the question, is the correct procedure to always copy custom 
query handler JARs to WEB-INF/lib (ie. 2a-2c)? Or is it to somehow use the 
"Code Base" form entry to point to the JAR? The latter does not seem to work 
for me given [1a-1b] configuration setup.

By the way, I just checked in the code + pom to: 
http://oodt.jpl.nasa.gov/repo/projects/co2portal/trunk/cdx/hdf5met
* Quick note on the pom, it won't build properly the first time since I haven't 
configured the workaround you suggested. I just manually installed the Apache 
OODT dependency jars to my local repository for now.

Also, for the contextual purposes, below is the error I was receiving from the 
query handler when invoked via HTTP call:

java.lang.ClassCastException: gov.nasa.jpl.co2.cdx.hdf5.HDF5GetMetHandler 
cannot be cast to org.apache.oodt.product.handlers.ofsn.OFSNGetHandler
        
org.apache.oodt.product.handlers.ofsn.util.OFSNObjectFactory.getGetHandler(OFSNObjectFactory.java:91)
        
org.apache.oodt.product.handlers.ofsn.OFSNFileHandler.getGetHandler(OFSNFileHandler.java:206)
        
org.apache.oodt.product.handlers.ofsn.OFSNFileHandler.query(OFSNFileHandler.java:126)
        
org.apache.oodt.grid.ProductQueryServlet.handleQuery(ProductQueryServlet.java:59)
        org.apache.oodt.grid.QueryServlet.doPost(QueryServlet.java:100)
        org.apache.oodt.grid.QueryServlet.doGet(QueryServlet.java:75)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

Thanks!
Rishi


On Dec 2, 2010, at 7:12 PM, Mattmann, Chris A (388J) wrote:

Hi Rishi,

Is this code checked in? Can I see your POM and how you are integrating this 
code into web-grid? Are you referencing it as a Jar file from the web grid conf 
page? Or, are you actually dropping a Jar into WEB-INF/lib within web-grid, and 
if so, what jar?

Cheers,
Chris

P.S. Feel free to ask questions like this on the 
[email protected]<mailto:[email protected]> list. I think it would be 
great! Feel free to repost there!

On Dec 2, 2010, at 5:09 PM, Verma, Rishi (317I) wrote:

Hi Chris, Mike

This is kind of a low-level coding question, but I wonder if either of you 
could help out. I made a custom query handler (attached) that extends 
StdOFSNGetHandler and tried to run it within webgrid. This class does not do 
anything special, but should return a prod file when queried from webgrid via 
REST just like StdOFSNGetHandler does.

However, when trying to run my query handler from webgrid, I receive a class 
cast exception from the framework (attached).

I made sure to register the query handler within my 
org.apache.oodt.product.handlers.ofsn.xmlConfigFilePath file as below:
 <handler name="HDF5Met" type ="get" 
class="gov.nasa.jpl.co2.cdx.hdf5.HDF5GetMetHandler"/>

To test the handler out, I tried issuing the following query:
http://localhost:8080/webgrid-apache/prod?q=OFSN=/subdirectory/testfile.h5+AND+RT%3DHDF5Met

Do you have any tips on why I might be getting a ClassCastException?

Thanks!
Rishi



<HDF5GetMetHandler.java><ATT00001..htm><webgrid_error.html><ATT00002..htm>


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Chris Mattmann, Ph.D.
Senior Computer Scientist
NASA Jet Propulsion Laboratory Pasadena, CA 91109 USA
Office: 171-266B, Mailstop: 171-246
Email: [email protected]<mailto:[email protected]>
WWW:   http://sunset.usc.edu/~mattmann/
Phone: +1 (818) 354-8810
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adjunct Assistant Professor, Computer Science Department
University of Southern California, Los Angeles, CA 90089 USA
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


Reply via email to