This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
you need to put nlog4j in your classpath, see http://www.slf4j.org/nlog4j/ > Dear Sir/Madam > > I have some code which I have converted (I think) to use the slf4j facade. > > //import org.apache.log4j.Logger; > import org.slf4j.Logger; > import org.slf4j.LoggerFactory; > > > public class SaveNetcdfServlet extends HttpServlet{ > > //private Logger logger = Logger.getLogger(this.getClass().getName()); > private Logger logger = LoggerFactory.getLogger(SaveNetcdfServlet.class); > > /** Initializes the servlet. > */ > public void init(ServletConfig config) throws ServletException { > super.init(config); > } > > /** Destroys the servlet. > */ > public void destroy() { > } > > > private boolean createFile(String inFileName, String outFileName, > float minLat, float maxLat, float minLon, float maxLon) { > > logger.debug("createFile - 1a"); > NetcdfFile inFile; > > logger.debug("createFile - 1b"); > NetcdfFileWriteable outFile; > > logger.debug("createFile - 1c "+inFileName); > > // open the file > try { > inFile = NetcdfFile.open(inFileName); > } catch (IOException e) { > return false; > } > > > I am getting the error below > > type Exception report > message > description The server encountered an internal error () that prevented it > from fulfilling this request. > exception > javax.servlet.ServletException: Servlet execution threw an exception > root cause > java.lang.IncompatibleClassChangeError: Class org.apache.log4j.Logger does > not implement the requested interface org.slf4j.Logger > ucar.nc2.NetcdfFile.open(NetcdfFile.java:488) > ucar.nc2.NetcdfFile.open(NetcdfFile.java:284) > ucar.nc2.NetcdfFile.open(NetcdfFile.java:254) > ucar.nc2.NetcdfFile.open(NetcdfFile.java:241) > ucar.nc2.NetcdfFile.open(NetcdfFile.java:229) > uk.ac.bodc.gebcoWeb.SaveNetcdfServlet.createGEBCOfile(SaveNetcdfServlet.java:62) > uk.ac.bodc.gebcoWeb.SaveNetcdfServlet.processRequest(SaveNetcdfServlet.java:609) > uk.ac.bodc.gebcoWeb.SaveNetcdfServlet.doPost(SaveNetcdfServlet.java:689) > javax.servlet.http.HttpServlet.service(HttpServlet.java:710) > javax.servlet.http.HttpServlet.service(HttpServlet.java:803) > note The full stack trace of the root cause is available in the Apache > Tomcat/6.0.16 logs. > > > The logger debug output is being written into the logger file. Does this look > like something I have done wrong, or something in the NetcdfFile.open (which > I can't really believe)? Any assistance would be gratefully received. > > Cheers > Ray > > > > -- > This message (and any attachments) is for the recipient only. NERC > is subject to the Freedom of Information Act 2000 and the contents > of this email and any reply you make may be disclosed by NERC unless > it is exempt from release under the Act. Any material supplied to > NERC may be stored in an electronic records management system. > > Ticket Details =================== Ticket ID: PJI-127309 Department: Support netCDF Java Priority: Critical Status: Open