Hi Chris, I confirm Dave's prediction, at least for my setup.
I attempted to place my query handler JAR somewhere other that WEB-INF/lib and tomcat/lib (I placed it in my home directory, gave full read + execute permissions), and registered the JAR's location using the webgrid manager app. Despite being outside of tomcat/lib, I received a ClassCastException like before. [1] http://s.apache.org/1P8 In your above email, you show how you got 'oodt-xmlps-0.1-incubating-with-dependencies.jar' referenced within webgrid's config page. Wanted to ask you two questions about this: 1. What permissions did you set for that JAR file? 2. Do you remember if you modified any default tomcat security settings? Maybe webgrid cannot access the JAR because tomcat is restricting its runtime access to files. Thanks! On Dec 8, 2010, at 1:19 PM, Mattmann, Chris A (388J) wrote: Haha, *Kale*, forever the optimist. I'll make a prediction: we'll figure out a way to solve this (for Dave and Rishi)! :) And when we do, we'll post it back here to the list ^_^ There is something going on with Dave's setup, b/c, for whatever reason (like I stated in this earlier email [1]), the setup seemed to work fine for me... Cheers, Chris [1] http://s.apache.org/1P8 On Dec 8, 2010, at 11:44 AM, David Kale wrote: Rishi, I'll make a prediction: nothing will work other than directly copying the JAR file into WEB-INF/lib. This is something I've run into with using external JAR files to provide jdbc drivers (for both Oracle and SQL Server dbs), and we have yet to resolve it (i.e., no matter where I put it, referencing it from the config page simply does not work). There is something bizarre going on with the handling of JAR files in the config page's "code base." I suppose it's time to file a bug. Dave On Mon, Dec 6, 2010 at 10:08 AM, Mattmann, Chris A (388J) < [email protected]<mailto:[email protected]>> wrote: Hi Rishi, (cc to d...@oodt) Thanks much. I think that the issue is that you were referencing a JAR in 1a that was actually within tomcat's lib directory which caused tomcat to mess up. Typically I include web-grid code base jars *outside* of the realm of Tomcat which I think can confuse its own classloader from Web-Grid's. Copying the jar to WEB-INF/lib within Web-Grid will work, but it's not a best practice IMHO. So try next time redo-ing 1a and 1b but putting the jar outside of tomcat (e.g., in /usr/local/co2cdx/jarname or something) and see if that works...HTH! Cheers, Chris On Dec 6, 2010, at 10:00 AM, Verma, Rishi (317I) wrote: 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]> <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/<http://sunset.usc.edu/%7Emattmann/> Phone: +1 (818) 354-8810 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Adjunct Assistant Professor, Computer Science Department University of Southern California, Los Angeles, CA 90089 USA ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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/<http://sunset.usc.edu/%7Emattmann/> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Adjunct Assistant Professor, Computer Science Department University of Southern California, Los Angeles, CA 90089 USA ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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/ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Adjunct Assistant Professor, Computer Science Department University of Southern California, Los Angeles, CA 90089 USA ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
