On Sat, Feb 16, 2002 at 07:10:59AM -0800, sri v wrote:
> Pardon my ignorance, but can you tell me how to turn on the stack
> trace and where to get it from in tomcat.  

You can probably find the stack traces in your Tomcat log files.  Look
in $TOMCAT_HOME/logs, specifically in the file "localhost_log.DATE.txt"
(assuming you haven't configured it otherwise).

> Meanwhile, I am sure that the failure is in the getManager() call,
> since originally I was calling it somewhere late in the initialization
> process after initializing other libraries such as log4j etc.,
 
I've attached a very rudimentary servlet that uses fulcrum's global
cache service.  Perhaps this will be of assistance.

thanks,
pete
package com.kazmier.test;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

import org.apache.log4j.*;
import org.apache.fulcrum.*;
import org.apache.fulcrum.cache.*;
import org.apache.stratum.configuration.*;

public class TestFulcrum extends HttpServlet 
{
    public void init()
    {
        try
        {
            String propsPath = 
                    getServletContext().getRealPath("./fulcrum.properties");
            Configuration configuration = 
                    (Configuration) new PropertiesConfiguration(propsPath);
            ServiceManager serviceManager = TurbineServices.getManager();
            serviceManager.setApplicationRoot(getServletContext().getRealPath(""));
            serviceManager.setConfiguration(configuration);
            serviceManager.init();
        }
        catch (Exception e)
        {
        }
    }

    public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException
    {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        out.println("<html>");
        out.println("<body>");
        out.println(testCache());
        out.println("<body>");
        out.println("</body>");
        out.println("</html>");
    }

    private String testCache()
    {
        GlobalCacheService gs = null;
        try
        {
            gs = (GlobalCacheService) TurbineServices.getInstance().
                    getService(GlobalCacheService.SERVICE_NAME);
            CachedObject obj = gs.getObject("cached_object");
            return "Got " + obj.getContents() + " from global cache";
        }
        catch(ObjectExpiredException gone)
        {
            gs.addObject("cached_object",
                    new CachedObject("in_the_cache",5000));
            return "Added new item to the cache! Expires in 5 seconds";
        }
    }
}

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to