Forum Discussion

sergiy's avatar
sergiy
Occasional Contributor
8 years ago
Solved

NullPointerException with mock and TomCat

Hi, could anybody please help me?

 

About my problem - I have created mock project, after that I have deployed it as a war file to the TomCat server. But when I'm trying to open mock web application I'm getting an error - java.lang.NullPointerException.

 

On my machine proxy is disabled and I also have disabled proxy in the mock project, but the stack trace shows another info:

at com.btr.proxy.search.browser.ie.IEProxySearchStrategy.createPacSelector(IEProxySearchStrategy.java:70)
at com.btr.proxy.search.browser.ie.IEProxySearchStrategy.getProxySelector(IEProxySearchStrategy.java:44)
at com.btr.proxy.search.desktop.win.WinProxySearchStrategy.getProxySelector(WinProxySearchStrategy.java:37)
at com.btr.proxy.search.desktop.DesktopProxySearchStrategy.getProxySelector(DesktopProxySearchStrategy.java:34)
at com.btr.proxy.search.ProxySearch.getProxySelector(ProxySearch.java:193)
at com.eviware.soapui.impl.wsdl.support.http.ProxyUtils.setGlobalProxy(ProxyUtils.java:176)
at com.eviware.soapui.model.propertyexpansion.PropertyExpander.<clinit>(PropertyExpander.java:71)

 

And I can't figure out why Soap UI tries to use proxy when I have disabled it. I have disassembled "soapui-5.2.1.jar", and found that place, where null point exception occurs. Also I have noticed that Soap UI will use the proxy only if a flag named "proxyEnabled" is equals to "true". The value for this flag is stored in "soapui-settings.xml", where I already set it to "false". And I really don't understand where Soap UI gets "true" for proxy.

 

Thank you

8 Replies

    • rupert_anderson's avatar
      rupert_anderson
      Valued Contributor

      Hi,

       

      Thats interesting, I've never seen that issue before.

       

      When you build a mock war it does reference your soapui-settings.xml, but I haven't noticed the settings file being included in the war, only the project file. I guess it might be worth understanding how the property you're talking about gets transferred to the mock war.

       

      I take it your mock is fairly ordinary? I have never had any proxy requirement for a mock, and don't understand why a proxy is relevant at all given that the mock is hosted locally. Trouble is, the whole of SoapUI including all its dependencies gets packaged in the mock war, so it could be the proxy code is somehow being triggered.. strange.

       

      Regards,

      Rupert

      • sergiy's avatar
        sergiy
        Occasional Contributor

        Hi, thank you for your reply.

         

        About "soapui-settings.xml": I have created many variants of war file, with checked "Include Global Settings" and without, but I can't get rid of this error. If I check "Include Global Settings" then the settings file is appears in "\WEB-INF\soapui" otherwise not. I mean eventually, in any case, in the local and in the global settings files there are everywhere "proxyEnabled" is set to false, but the error still occurs.

         

        Another interesting point is that when I'm opening mocked service web interface for the first time, then I can see an error I have written. And when I refresh the page, then error text is changing to:

        exception

        javax.servlet.ServletException: Servlet.init() for servlet SoapUIMockServlet threw exception
        org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
        org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
        org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
        org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
        org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783)
        org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
        org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:745)
        org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
        org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
        java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        java.lang.Thread.run(Unknown Source)

        root cause

        java.lang.NoClassDefFoundError: Could not initialize class com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport
        com.eviware.soapui.DefaultSoapUICore.initSettings(DefaultSoapUICore.java:361)
        com.eviware.soapui.DefaultSoapUICore.init(DefaultSoapUICore.java:129)
        com.eviware.soapui.DefaultSoapUICore.<init>(DefaultSoapUICore.java:114)
        com.eviware.soapui.mockaswar.MockAsWarServlet$MockServletSoapUICore.<init>(MockAsWarServlet.java:317)
        com.eviware.soapui.mockaswar.MockAsWarServlet.init(MockAsWarServlet.java:71)
        javax.servlet.GenericServlet.init(GenericServlet.java:158)
        org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
        org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
        org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
        org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
        org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783)
        org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
        org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:745)
        org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
        org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
        java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        java.lang.Thread.run(Unknown Source)

         

        P.S. I have also tried to deploy another mock from the example on the smartbear site (about currency exchange), but got the same problem.

         

        P.S.P.S. it could be not a proxy problem, but anyway I need to fix it, and I would be appreciated for any help.

         

        Thank you!