You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by sri v <ma...@yahoo.com> on 2002/02/16 14:03:47 UTC

fulcrum-1.0, TurbineServices initialization failing inside a servlet

I have built the fulcrum-1.0.jar from the src and
successfully able to run a stand alone testprogram
(for GlobalCacheService). 

However, when I tried to use the same fulcrum services
library inside a servlet (not turbine),
org.apache.fulcrum.TurbineServices class
initialization is failing and is crashing the tomcat
startup process. 

>>>>> code snippet follows>>
import org.apache.fulcrum.TurbineServices;
import org.apache.fulcrum.ServiceException;
import org.apache.fulcrum.ServiceManager;

public class BaseStrutsActionServlet extends
HttpServlet {

public void init() throws ServletException {
    log("hello");
    ServiceManager serviceManager =
TurbineServices.getManager();
}

}

tomcat is crashing at the getManager() call above. 
fulcrum-1.0.jar is in my WEB-INF/lib directory.

I looked at the turbine-3.0's Turbine.java file and it
is initializing the same way I am trying to do. 

Any help is greatly appreciated...

thanks
srini

__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: fulcrum-1.0, TurbineServices initialization failing inside a servlet

Posted by Daniel Rall <dl...@finemaltcoding.com>.
Jason van Zyl <jv...@zenplex.com> writes:

> Do you have the stack trace? A lot of refactoring has gone on in Fulcrum and
> we are striving to make it truly usable outside the Turbine context but this
> hasn't been thoroughly tested.

FWIW, I'm using Fulcrum outside the context of Turbine and am quite
happy with it.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: fulcrum-1.0, TurbineServices initialization failing inside a servlet

Posted by Christian Asmussen <kr...@kriconet.com.br>.
Looks like there is some class that must be recompiled?
Try to clean the srcs...

On Sat, 16 Feb 2002, sri v wrote:

> Thanks for helping out. I have figured out what the
> problem is...I am using the latest log4j build
> (jakarta-log4j-1.2alpha7) which has deprecated
> Category.getInstance(String) method. And it is where
> fulcrum's getManager() method is failing. I have
> reverted back to log4j-1.1.3 and fulcrum is
> initializing properly.
> 
> This is weird though...since log4j-1.2 is supposed to
> be backward compatable and the method is only
> deprecated.
> 
> thanks
> srini
> 
> btw, here is the stack trace:
> 
> 2002-02-16 11:37:32,465 DEBUG [main]
> framework.BaseStrutsActionServlet (BaseStru
> tsActionServlet.java:224) - Successfully initialized
> log4j
> java.lang.NoSuchMethodError
>         at
> org.apache.fulcrum.BaseServiceBroker.<init>(BaseServiceBroker.java:14
> 7)
>         at
> org.apache.fulcrum.TurbineServices.<init>(TurbineServices.java:81)
>         at
> org.apache.fulcrum.TurbineServices.<clinit>(TurbineServices.java:73)
>         at
> com.srinicom.common.framework.BaseStrutsActionServlet.initFulcrum(Bas
> eStrutsActionServlet.java:243)
>         at
> com.srinicom.common.framework.BaseStrutsActionServlet.initInternal(Ba
> seStrutsActionServlet.java:102)
>         at
> com.srinicom.common.framework.BaseStrutsActionServlet.init(BaseStruts
> ActionServlet.java:72)
>         at
> javax.servlet.GenericServlet.init(GenericServlet.java:258)
>         at
> org.apache.tomcat.core.ServletWrapper.doInit(ServletWrapper.java:317)
> 
>         at
> org.apache.tomcat.core.Handler.init(Handler.java:215)
>         at
> org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:296)
>         at
> org.apache.tomcat.context.LoadOnStartupInterceptor.contextInit(LoadOn
> StartupInterceptor.java:130)
>         at
> org.apache.tomcat.core.ContextManager.initContext(ContextManager.java
> :491)
>         at
> org.apache.tomcat.core.ContextManager.init(ContextManager.java:453)
>         at
> org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:195)
>         at
> org.apache.tomcat.startup.Tomcat.main(Tomcat.java:235)
> 
> --- Pete Kazmier <pe...@kazmier.com> wrote:
> > 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:  
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Sports - Coverage of the 2002 Olympic Games
> http://sports.yahoo.com
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 

-- 
"If we did all the things we are capable of, 
we would literally astound ourselves"
 - Thomas Edison


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: fulcrum-1.0, TurbineServices initialization failing inside a servlet

Posted by sri v <ma...@yahoo.com>.
Thanks for helping out. I have figured out what the
problem is...I am using the latest log4j build
(jakarta-log4j-1.2alpha7) which has deprecated
Category.getInstance(String) method. And it is where
fulcrum's getManager() method is failing. I have
reverted back to log4j-1.1.3 and fulcrum is
initializing properly.

This is weird though...since log4j-1.2 is supposed to
be backward compatable and the method is only
deprecated.

thanks
srini

btw, here is the stack trace:

2002-02-16 11:37:32,465 DEBUG [main]
framework.BaseStrutsActionServlet (BaseStru
tsActionServlet.java:224) - Successfully initialized
log4j
java.lang.NoSuchMethodError
        at
org.apache.fulcrum.BaseServiceBroker.<init>(BaseServiceBroker.java:14
7)
        at
org.apache.fulcrum.TurbineServices.<init>(TurbineServices.java:81)
        at
org.apache.fulcrum.TurbineServices.<clinit>(TurbineServices.java:73)
        at
com.srinicom.common.framework.BaseStrutsActionServlet.initFulcrum(Bas
eStrutsActionServlet.java:243)
        at
com.srinicom.common.framework.BaseStrutsActionServlet.initInternal(Ba
seStrutsActionServlet.java:102)
        at
com.srinicom.common.framework.BaseStrutsActionServlet.init(BaseStruts
ActionServlet.java:72)
        at
javax.servlet.GenericServlet.init(GenericServlet.java:258)
        at
org.apache.tomcat.core.ServletWrapper.doInit(ServletWrapper.java:317)

        at
org.apache.tomcat.core.Handler.init(Handler.java:215)
        at
org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:296)
        at
org.apache.tomcat.context.LoadOnStartupInterceptor.contextInit(LoadOn
StartupInterceptor.java:130)
        at
org.apache.tomcat.core.ContextManager.initContext(ContextManager.java
:491)
        at
org.apache.tomcat.core.ContextManager.init(ContextManager.java:453)
        at
org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:195)
        at
org.apache.tomcat.startup.Tomcat.main(Tomcat.java:235)

--- Pete Kazmier <pe...@kazmier.com> wrote:
> 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:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>



__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: fulcrum-1.0, TurbineServices initialization failing inside a servlet

Posted by Pete Kazmier <pe...@kazmier.com>.
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

Re: fulcrum-1.0, TurbineServices initialization failing inside a servlet

Posted by sri v <ma...@yahoo.com>.
Pardon my ignorance, but can you tell me how to turn
on the stack trace and where to get it from in tomcat.
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.,

Once I noticed getManager() is causing the crash, I
moved it all the way up in the init() method after the
log method as in the included code snippet. That for
sure proved that it is this method that is causing
servlet init to fail and tomcat to crash. 

One question, I looked at the Turbine.java file in 3.0
and it is not setting any context before calling
TurbineServices.getManager() method. Then why do you
think context may be an issue here? 

I will send the code also ....

thanks
srini

 
--- Jason van Zyl <jv...@zenplex.com> wrote:
> On 2/16/02 8:03 AM, "sri v" <ma...@yahoo.com>
> wrote:
> 
> > I have built the fulcrum-1.0.jar from the src and
> > successfully able to run a stand alone testprogram
> > (for GlobalCacheService).
> > 
> > However, when I tried to use the same fulcrum
> services
> > library inside a servlet (not turbine),
> > org.apache.fulcrum.TurbineServices class
> > initialization is failing and is crashing the
> tomcat
> > startup process. 
> > 
> >>>>>> code snippet follows>>
> > import org.apache.fulcrum.TurbineServices;
> > import org.apache.fulcrum.ServiceException;
> > import org.apache.fulcrum.ServiceManager;
> > 
> > public class BaseStrutsActionServlet extends
> > HttpServlet {
> > 
> > public void init() throws ServletException {
> >   log("hello");
> >   ServiceManager serviceManager =
> > TurbineServices.getManager();
> > }
> > 
> > }
> > 
> > tomcat is crashing at the getManager() call above.
> > fulcrum-1.0.jar is in my WEB-INF/lib directory.
> > 
> > I looked at the turbine-3.0's Turbine.java file
> and it
> > is initializing the same way I am trying to do.
> > 
> > Any help is greatly appreciated...
> 
> Do you have the stack trace? A lot of refactoring
> has gone on in Fulcrum and
> we are striving to make it truly usable outside the
> Turbine context but this
> hasn't been thoroughly tested.
> 
> If you have some code you can share then maybe we
> can try to make a cactus
> test for the case where Fulcrum is being used in a
> generic servlet so we can
> figure out what is going on. But if you toss the
> stack trace our way, or
> even a test where the failure is evident then we can
> get the problem fixed.
> 
> > 
> > thanks
> > srini
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Sports - Coverage of the 2002 Olympic Games
> > http://sports.yahoo.com
> > 
> > --
> > To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> -- 
> 
> jvz.
> 
> Jason van Zyl
> 
> http://tambora.zenplex.org
> http://jakarta.apache.org/turbine
> http://jakarta.apache.org/velocity
> http://jakarta.apache.org/alexandria
> http://jakarta.apache.org/commons
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: fulcrum-1.0, TurbineServices initialization failing inside a servlet

Posted by Jason van Zyl <jv...@zenplex.com>.
On 2/16/02 8:03 AM, "sri v" <ma...@yahoo.com> wrote:

> I have built the fulcrum-1.0.jar from the src and
> successfully able to run a stand alone testprogram
> (for GlobalCacheService).
> 
> However, when I tried to use the same fulcrum services
> library inside a servlet (not turbine),
> org.apache.fulcrum.TurbineServices class
> initialization is failing and is crashing the tomcat
> startup process. 
> 
>>>>>> code snippet follows>>
> import org.apache.fulcrum.TurbineServices;
> import org.apache.fulcrum.ServiceException;
> import org.apache.fulcrum.ServiceManager;
> 
> public class BaseStrutsActionServlet extends
> HttpServlet {
> 
> public void init() throws ServletException {
>   log("hello");
>   ServiceManager serviceManager =
> TurbineServices.getManager();
> }
> 
> }
> 
> tomcat is crashing at the getManager() call above.
> fulcrum-1.0.jar is in my WEB-INF/lib directory.
> 
> I looked at the turbine-3.0's Turbine.java file and it
> is initializing the same way I am trying to do.
> 
> Any help is greatly appreciated...

Do you have the stack trace? A lot of refactoring has gone on in Fulcrum and
we are striving to make it truly usable outside the Turbine context but this
hasn't been thoroughly tested.

If you have some code you can share then maybe we can try to make a cactus
test for the case where Fulcrum is being used in a generic servlet so we can
figure out what is going on. But if you toss the stack trace our way, or
even a test where the failure is evident then we can get the problem fixed.

> 
> thanks
> srini
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Sports - Coverage of the 2002 Olympic Games
> http://sports.yahoo.com
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

-- 

jvz.

Jason van Zyl

http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>