Hi all

I am calling a function from my servlet but getting following exception

SEVERE: Servlet.service() for servlet In_Servlet threw exception
javax.servlet.ServletException: Servlet execution threw an exception
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:313)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
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:216)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Thread.java:619)


please suggest.

function is this which i am calling from my servlet and getting printing in catalina till "A" but after it getting same exception in localhost log of apache.

public String retr_subscriber(String msisdn,String id)
        {       System.out.println("0");
                try
                {
                System.out.println("A");
                //ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem("/home/ussd_src/self_care/axis2/axis2-1.5/repository/");
                ConfigurationContext ctx = ConfigurationContextFactory.createDefaultConfigurationContext();
                SAM_BR_Service_v1_0Stub stub =new SAM_BR_Service_v1_0Stub(ctx,"http://10.16.4.15:8180/axis2/services/SAM_BR_Service_v1_0");
                ServiceClient sClient = stub._getServiceClient();
                sClient.engageModule("rampart");
                System.out.println("B");

                //ServiceClient sClient=new ServiceClient(ctx,stub);

                Options options = sClient.getOptions();
                HttpTransportProperties.Authenticator   auth = new HttpTransportProperties.Authenticator();
                auth.setPreemptiveAuthentication(true);
                auth.setUsername("unitech1");
                auth.setPassword("unitecha");
                options.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);


//            options.setUserName("unitech1");
 //           options.setPassword("unitecha");

                sClient.setOptions(options);

                System.out.println("C");
        /*      ((Stub) stub)._setProperty(Call.USERNAME_PROPERTY, "unitech1");
                ((Stub) stub)._setProperty(Call.PASSWORD_PROPERTY, "unitecha");*/
                BalanceRetrAllDocument req = BalanceRetrAllDocument.Factory.newInstance();
                BalanceRetrAllReqType data = req.addNewBalanceRetrAll();
                data.setSubscriberID(msisdn);
                data.setAgentID("spice_ussd");
                BalanceRetrAllRespDocument resp = stub.balanceRetrAll(req);
                BalanceRetrAllRespType bal=resp.getBalanceRetrAllResp();
                System.out.println("Request Message :");
                System.out.println("SubscriberID :"+ data.getSubscriberID() + "\nAgentID :" + data.getAgentID());
                System.out.println("Code :"+ bal.getStatusCode() + "\nBalanceBucket Table :" + bal.getBalanceBucketTable()+"\nBalance Version :"+bal.getBalanceVersion()+"\nBalanceBucket Max Rows :"+bal.getBalanceBucketMaxRows()+"\ngetBalanceSubscriberOrGroup :"+bal.getBalanceSubscriberOrGroup());
}

can you post your code.

@manish250- Sorry this code is too heavy for me i am also a begginer in servlets and JSP. But i think your Servlets service() method is throwing an exception and i think there can be an mistake in the service() method and not the one which you have posted. Or i think you must have forgotton to throw an exception , do this

public void service(HttpServletRequest req, HttpServletResponse res) throws IOException,ServletException

sorry but this is not the problem you are telling

@manish250- Sorry this code is too heavy for me i am also a begginer in servlets and JSP. But i think your Servlets service() method is throwing an exception and i think there can be an mistake in the service() method and not the one which you have posted. Or i think you must have forgotton to throw an exception , do this

public void service(HttpServletRequest req, HttpServletResponse res) throws IOException,ServletException

You need to post the whole stack trace. If you read it carefully you will find that it tells you which of your files has the error.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.