On 8/21/07, Simon Laws <[EMAIL PROTECTED]> wrote:
>
>
>
> On 8/21/07, Steve Jones <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > I'm trying to host the Tuscany calculator-webapp sample under Tomcat 5.5
> > .
> >
> > Tomcat seems to be working OK and the Servlet Examples that come with
> > Tomcat are working fine.
> >
> > I've built the calculator-webapp sample from the svn source (V567016)
> > and copied the WAR file across to <Tomcat>/webapps/.
> >
> > Tomcat unpacks the WAR immediately and the Tomcat manager lists
> > "sample-calculator-webapp" as one of it's known applications.
> >
> > When I try to run the sample by pointing at:
> >
> > http://localhost:8080/sample-calculator-webapp/calc.jsp
> >
> > I get a NPE error (see end).
> >
> > Do I need to install/configure some other SCA components on Tomcat to
> > get the Tuscany examples to run or is everything that's needed already
> > in the WAR file?
> >
> > Also what's the best way to go about debugging such problems?
> >
> > Thanks, Steve.
> >
> >
> > org.apache.jasper.JasperException : Exception in JSP: /calc.jsp:26
> >
> > 23: <%@ page contentType="text/html;charset=UTF-8" language="java" %>
> > 24: <%
> > 25:    SCADomain scaDomain = (SCADomain)
> > application.getAttribute(" org.apache.tuscany.sca.SCADomain");
> > 26:    CalculatorService calculatorService =
> > scaDomain.getService(CalculatorService.class,
> > "CalculatorServiceComponent");
> > 27: %>
> > 28: <html>
> > 29: <head><title>Calculator sample</title></head>
> >
> >
> > Stacktrace:
> >         org.apache.jasper.servlet.JspServletWrapper.handleJspException(
> > JspServletWrapper.java:467)
> >         org.apache.jasper.servlet.JspServletWrapper.service(
> > JspServletWrapper.java:389)
> >          org.apache.jasper.servlet.JspServlet.serviceJspFile(
> > JspServlet.java:315)
> >         org.apache.jasper.servlet.JspServlet.service(JspServlet.java
> > :265)
> >         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >
> > root cause
> >
> > java.lang.NullPointerException
> >         org.apache.jsp.calc_jsp._jspService(calc_jsp.java:52)
> >         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java
> > :98)
> >         javax.servlet.http.HttpServlet.service (HttpServlet.java:803)
> >         org.apache.jasper.servlet.JspServletWrapper.service(
> > JspServletWrapper.java:328)
> >         org.apache.jasper.servlet.JspServlet.serviceJspFile(
> > JspServlet.java:315)
> >         org.apache.jasper.servlet.JspServlet.service (JspServlet.java
> > :265)
> >         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > Hi Steve
>
> It works for me on Tomcat 6.0.13. Let me give it a spin on 5.5 and see
> what happens.
>
> Regards
>
> Simon
>
There isn't any else you should need to do other than copying the war into
the Tomcat webapps directory. I just tried on a fresh install of 5.5.23 and
a fresh update from svn and it works there too. So not that much help
immediately.

Looking at the stack trace from above it seems to be that the jsp is being
parsed/generated successfully and that when it retrieves the SCA domain it's
getting null, i.e. at the line:

   SCADomain scaDomain = (SCADomain) application.getAttribute("
org.apache.tuscany.sca.SCADomain");
   CalculatorService calculatorService = scaDomain.getService(
CalculatorService.class, "CalculatorServiceComponent");

So when it comes to use it it fails.

If you are able to update to the latest version of the tuscany code form
subversion and rebuild tuscany that would be useful (I don't know if there
were specific issues in this area with 567016).
Also check that there aren't any other error messages in the tomcat logs. In
particular look out for "exception initializing SCADomain"

The way that this hangs together is that the calculator-webapp contains a
webapp (in particular a web.xml file) and has a dependency on the tuscany
host-webapp module. The web.xml file declares a listener implemented by
TuscanyContextListener from the host-webapp module.

If you follow the code through you see in
SCADomainHelper.javainitSCADomain() a couple of lines at the bottom
where the SCA domain is
created and the contribution (the calculator application) is read.

        if (scaDomain == null) {
            scaDomain = SCADomain.newInstance(domainURI, contributionRoot);
            servletContext.setAttribute(SCA_DOMAIN_ATTRIBUTE, scaDomain);
        }

My first step would be to ensure that this is actually happening either by
putting some System.out output here or by stopping it remotely in a
debugger.

Hope that helps

Simon

Reply via email to