On Tuesday 21 August 2007 10:55, Simon Laws wrote:
> 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

Hi Simon,

Thanks for the info. 

I was trying to follow the instuctions at:

http://wiki.apache.org/ws/Tuscany/TuscanyJava/TomcatIntegration?highlight=%28Tomcat%29

Presumably that's now out of date.

I've upgraded my svn source to HEAD (r568049) and moved to tomcat 
6.0.13/jvm 1.5.0_11-b03. Tomcat is being hosted on Windows Vista.

I've rebuilt the source and copied the new WAR across. Unfortunately a NPE 
is still reported when the calc.jsp page is served.

Looking in the Tomcat logs I do get an "exception initializing SCADomain" 
as you expected.

Maybe you can spot what going wrong from the dump. If not I'll have to 
take a deep breath and jump in.

Thanks, Steve.


SEVERE: exception initializing SCADomain
org.osoa.sca.ServiceRuntimeException: 
org.osoa.sca.ServiceRuntimeException: java.lang.IllegalArgumentException
        at 
org.apache.tuscany.sca.host.embedded.SCADomain.createNewInstance(SCADomain.java:264)
        at 
org.apache.tuscany.sca.host.embedded.SCADomain.newInstance(SCADomain.java:82)
        at 
org.apache.tuscany.sca.webapp.SCADomainHelper.initSCADomain(SCADomainHelper.java:63)
        at 
org.apache.tuscany.sca.webapp.TuscanyContextListener.contextInitialized(TuscanyContextListener.java:37)
        at 
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
        at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:4334)
        at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
        at 
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825)
        at 
org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:714)
        at 
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
        at 
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
        at 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at 
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at 
org.apache.catalina.core.StandardService.start(StandardService.java:516)
        at 
org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: org.osoa.sca.ServiceRuntimeException: 
java.lang.IllegalArgumentException
        at 
org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.<init>(DefaultSCADomain.java:109)
        at 
org.apache.tuscany.sca.host.embedded.SCADomain.createNewInstance(SCADomain.java:230)
        ... 27 more
Caused by: java.lang.IllegalArgumentException
        at java.net.URI.create(Unknown Source)
        at 
org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.getContributionLocation(DefaultSCADomain.java:246)
        at 
org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.<init>(DefaultSCADomain.java:103)
        ... 28 more
Caused by: java.net.URISyntaxException: Illegal character in path at index 
16: file:/C:/Program Files/Apache Software Foundation/Tomcat 
6.0/webapps/sample-calculator-webapp/
        at java.net.URI$Parser.fail(Unknown Source)
        at java.net.URI$Parser.checkChars(Unknown Source)
        at java.net.URI$Parser.parseHierarchical(Unknown Source)
        at java.net.URI$Parser.parse(Unknown Source)
        at java.net.URI.<init>(Unknown Source)
        ... 31 more
21-Aug-2007 12:12:58 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
21-Aug-2007 12:12:58 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
21-Aug-2007 12:13:09 org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
        at org.apache.jsp.calc_jsp._jspService(calc_jsp.java:63)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
        at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
        at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
        at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Unknown Source)
21-Aug-2007 12:13:58 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
21-Aug-2007 12:13:58 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()





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

Reply via email to