分享一个CLASSPATH的问题导致SERVLET出错却没有任何log

在websphere的console http://localhost:9062/ibm/console/login.do 中environment\Shared Libraries 中的一个ClassPath"C:\SLEWorkspace\lib\httpservice\ Httpclient\httpcore-4.2-alpha2.jar" 中不小心多了一个空格,结果导致运行这个 servlet 的 get 方法中出错却没有任何的System.out.println的输出,调试了好长时间。



      public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
             System.out.println("call servlet succesfully - get method");
             String url = "http://localhost:9088/UI/entitled/CommandControler";
             try {
                 CommandControlerVO vo = new CommandControlerVO();
                 vo.setMessageId(1);
                 vo.setMessageSource("BES");
                 vo.setMessageSubtype("537U");
                 vo.setMessageType("INV");
                 vo.setMessageContent("content");
                
                
                 StringWriter xmlWriter = new StringWriter();
                 try {          
                      final JAXBContext jaxbContext = JAXBContext.newInstance(CommandControlerVO.class);                                      
                       jaxbContext.createMarshaller().marshal(vo, xmlWriter);    
                                                                        
                 }catch(JAXBException e){          
                      System.out.println("JAXB Exception caused "+e);
                      throw new RuntimeException("Error ocurred "+e);
                 }            
                
                 System.out.println("the xml to pass " + xmlWriter.toString());
                 List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
                 nameValuePairs.add(new BasicNameValuePair("xmlData", xmlWriter.toString()));    
                
                 DefaultHttpClient httpClient  = new DefaultHttpClient();
                 HttpPost postRequest = new HttpPost(url);      
                 postRequest.addHeader("accept", "application/json");        
                 postRequest.setEntity(new UrlEncodedFormEntity(nameValuePairs,"UTF-8"));
                 HttpResponse httpResponse = httpClient.execute(postRequest);
                 HttpEntity httpEntity = httpResponse.getEntity();
                 String xmlResponse = EntityUtils.toString(httpEntity);    
                 System.out.println("response value is " + xmlResponse);
                
             } catch (Exception e) {
                 e.printStackTrace();
             }
          
      }     


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值