簡體   English   中英

在窗口電話上推送通知

[英]Push notification on window phone

我正在移動操作系統上構建一個多平台推送通知系統。 我的服務器是用JSP Servlet編寫的。 在窗口電話平台上構建時遇到我的問題。 我在ASP服務器上對該操作系統進行了推送測試,它們運行良好。 但是因為我的服務器是JSP,所以我想從ASP遷移到JSP以獲得一致性。 我在https://github.com/notnoop/java-mpns這里使用了庫mpns來做到這一點。 但是在運行過程中,我的服務器出現故障,無法將消息發送給客戶端。能幫幫我!

當我在MpnsService服務的調試中運行它時= MPNS.newService()。build(); ,服務器停止運行,不再運行。 和WebBrowser錯誤消息HTTP狀態500-Servlet執行引發異常

代碼服務器

public class SendAllMessagesServlet extends BaseServlet {

@Override
 protected void doPost(HttpServletRequest req, HttpServletResponse resp)
  throws IOException, ServletException {
  String uri=req.getParameter("uri");
  String title=req.getParameter("title");
  String content=req.getParameter("content");
  String page=req.getParameter("page");
  MpnsService service =
          MPNS.newService()
                  .build();
  TileNotification tile = MPNS.newNotification().tile()
          .count(1).title(title).backBackgroundImage("http://sample.com/image.png")
          .backTitle(content)
          .build();
  String subscriptionUri = uri;
  service.push(subscriptionUri, tile);

//PushNotificationWP push=new PushNotificationWP();
//push.PushNotif(title,content,page,uri);
getServletContext().getRequestDispatcher("/home").forward(req, resp);
 }

 }

網絡瀏覽器錯誤

HTTP Status 500 - Servlet execution threw an exception

type Exception report message Servlet execution threw an exception description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet execution threw an exception root cause

java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
org.apache.http.impl.client.AbstractHttpClient.<init>(AbstractHttpClient.java:187)
org.apache.http.impl.client.DefaultHttpClient.<init>(DefaultHttpClient.java:146)
mpns.MpnsServiceBuilder.build(MpnsServiceBuilder.java:185)
SendAllMessagesServlet.doPost(SendAllMessagesServlet.java:32)
javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
 note The full stack trace of the root cause is available in the Apache Tomcat/7.0.37 logs.

您應該在應用程序中包含commons-loggin jar。 您可以在這里找到commons.apache.org

下載文件后,將其打開,然后將名為commons-logging-1.1.3.jar的文件(假設您已下載了最后一個二進制文件)復制到Web應用程序。

祝好運

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM