JPushClient初始化问题

jpush
标签: #<Tag:0x00007fb8317263c0>

(逍遥天涯) #1
26-Sep-2017 09:47:40.776 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log Destroying Spring FrameworkServlet 'springMvc'
26-Sep-2017 09:47:40.789 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext
26-Sep-2017 09:47:40.803 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log Shutting down log4j
26-Sep-2017 09:47:40.819 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log Destroying Spring FrameworkServlet 'springMvc'
26-Sep-2017 09:47:40.831 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext
26-Sep-2017 09:47:40.842 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log Shutting down log4j
26-Sep-2017 09:47:40.862 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log SessionListener: contextDestroyed()
26-Sep-2017 09:47:40.862 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log ContextListener: contextDestroyed()
26-Sep-2017 09:47:59.838 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log No Spring WebApplicationInitializer types detected on classpath
26-Sep-2017 09:47:59.849 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Set web app root system property: 'www.1b23.com' = [/usr/apache-tomcat-8.0.29/webapps/ZTO/]
26-Sep-2017 09:47:59.911 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing log4j from [classpath:log4j.properties]
26-Sep-2017 09:47:59.930 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing Spring root WebApplicationContext
26-Sep-2017 09:48:04.024 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing Spring FrameworkServlet 'springMvc'
26-Sep-2017 09:48:07.983 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log No Spring WebApplicationInitializer types detected on classpath
26-Sep-2017 09:48:07.991 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Set web app root system property: 'www.1b23.com' = [/usr/apache-tomcat-8.0.29/webapps/ZTO/]
26-Sep-2017 09:48:08.036 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing log4j from [classpath:log4j.properties]
26-Sep-2017 09:48:08.047 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing Spring root WebApplicationContext
26-Sep-2017 09:48:11.283 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing Spring FrameworkServlet 'springMvc'
26-Sep-2017 09:48:12.536 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
26-Sep-2017 09:48:12.536 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
26-Sep-2017 09:48:29.260 SEVERE [http-nio-8099-exec-7] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [springMvc] in context with path [] threw exception [Handler processing failed; nested exception is java.lang.NoSuchMethodError: cn.jpush.api.JPushClient.<init>(Ljava/lang/String;Ljava/lang/String;I)V] with root cause
 java.lang.NoSuchMethodError: cn.jpush.api.JPushClient.<init>(Ljava/lang/String;Ljava/lang/String;I)V
        at com.fh.util.JPushClientUtil.<init>(JPushClientUtil.java:53)
        at com.fh.util.PushUtil.pushMessage(PushUtil.java:184)
        at com.fh.controller.app.order.AppOrderController.pushMessage(AppOrderController.java:3155)
        at com.fh.controller.app.order.AppOrderController.appRobOrder(AppOrderController.java:2675)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:817)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:731)
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:968)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:870)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
        at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
        at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
        at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
        at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
        at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
        at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
        at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
        at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
        at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
        at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
        at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)

我在服务器(阿里云,tomcat环境)中使用极光推送会出现如上的bug,但是在自己的机子(eclipse,tomcat环境)上就没问题,两边都是用的springmvc结构,求解。


#2

1、是否有更多日志,譬如caused by的信息

2、关于阿里云服务器,可能出现的问题是
阿里云服务器jdk是什么版本?是使用的openjdk还是 sun jdk?如果是使用open jdk,建议替换sun jdk尝试。

3、使用的我们的服务端SDK的版本号是多少。


(逍遥天涯) #3

1.很抱歉。log中没有caused by的信息
2.阿里云服务器的jdk版本是sun jdk1.8.0_111
3,极光的sdk版本是jpush-client-3.2.19和jpush-java-libraryV2


(KenChoi) #4

很多人报 NoSuchMethod 或者 NoClassDefFoundError 错是因为自己问题,没有设置好路径或者没把 sdk 打包进去。


(逍遥天涯) #5

查看了一下,jar包已经用maven导入了

>  <dependency>
                        <groupId>jpush-gson</groupId>
                        <artifactId>gson</artifactId>
                        <version>2.2.4</version>
                        <scope>system</scope>
                        <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/gson-2.2.4.jar</systemPath>
                </dependency>
                <dependency>
                        <groupId>jiguang-common-1.0.6</groupId>
                        <artifactId>jiguang-common</artifactId>
                        <version>1.0.6</version>
                        <scope>system</scope>
                        <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/jiguang-common-1.0.6.jar</systemPath>
                </dependency>
                <dependency>
                        <groupId>jpush-client-3.2.19</groupId>
                        <artifactId>jpush-client</artifactId>
                        <version>3.2.19</version>
                        <scope>system</scope>
                        <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/jpush-client-3.2.19.jar</systemPath>
                </dependency>

(逍遥天涯) #6

还有就是appkey有没有使用限制?因为这是在测试服务器上出的问题,正式服务器没有出现这种现象。


#7

1、内网限制

2、频率限制
https://docs.jiguang.cn/jpush/server/push/server_overview/#api_1