Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE] 实现 SmsUpMessageListener 类之后启动报错 #59

Open
blankhang opened this issue Apr 22, 2021 · 0 comments
Open

[ISSUE] 实现 SmsUpMessageListener 类之后启动报错 #59

blankhang opened this issue Apr 22, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@blankhang
Copy link

blankhang commented Apr 22, 2021

///**
// * SmsUpMessageListener
// *
// * @author blank
// * @date 2021-4-22 下午 5:18
// */
//@Component
//public class MySmsUpMessageListener implements SmsUpMessageListener {
//
//    @Override
//    public boolean dealMessage(Message message) {
//        //添加处理逻辑
//        System.err.println(this.getClass().getName() + "; " + message.toString());
//        return true;
//    }
//}


2021-04-22 17:23:13.372  INFO 7684 --- [           main] com.blankhang.sms.SmsApplication         : Starting SmsApplication using Java 11.0.10 on blank-work with PID 7684 (D:\Blank\Projects\sms\target\classes started by blank in D:\Blank\Projects\sms)
2021-04-22 17:23:13.375  INFO 7684 --- [           main] com.blankhang.sms.SmsApplication         : No active profile set, falling back to default profiles: default
2021-04-22 17:23:14.190  INFO 7684 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 9051 (http)
2021-04-22 17:23:14.196  INFO 7684 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-04-22 17:23:14.197  INFO 7684 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.45]
2021-04-22 17:23:14.264  INFO 7684 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-04-22 17:23:14.264  INFO 7684 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 833 ms
2021-04-22 17:23:14.451  INFO 7684 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2021-04-22 17:23:14.725  INFO 7684 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 14 endpoint(s) beneath base path '/actuator'
2021-04-22 17:23:14.763  INFO 7684 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 9051 (http) with context path ''
2021-04-22 17:23:14.774  INFO 7684 --- [           main] com.blankhang.sms.SmsApplication         : Started SmsApplication in 1.774 seconds (JVM running for 2.668)
2021-04-22 17:23:15.021  INFO 7684 --- [)-192.168.1.100] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-04-22 17:23:15.022  INFO 7684 --- [)-192.168.1.100] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2021-04-22 17:23:15.022  INFO 7684 --- [)-192.168.1.100] o.s.web.servlet.DispatcherServlet        : Completed initialization in 0 ms

正常启动
反注释上面的短信回复监听器代码后启动
D:\Java\jdk11.0.10_9\bin\java.exe -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:60012,suspend=y,server=n -Dvisualvm.id=30400962847000 -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -javaagent:C:\Users\blank\AppData\Local\JetBrains\IntelliJIdea2020.3\captureAgent\debugger-agent.jar -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dfile.encoding=UTF-8 -classpath "D:\Blank\Projects\sms\target\classes;D:\Java\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.4.5\spring-boot-starter-web-2.4.5.jar;D:\Java\.m2\repository\org\springframework\boot\spring-boot-starter\2.4.5\spring-boot-starter-2.4.5.jar;D:\Java\.m2\repository\org\springframework\boot\spring-boot\2.4.5\spring-boot-2.4.5.jar;D:\Java\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.4.5\spring-boot-autoconfigure-2.4.5.jar;D:\Java\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.4.5\spring-boot-starter-logging-2.4.5.jar;D:\Java\.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\Java\.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\Java\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.13.3\log4j-to-slf4j-2.13.3.jar;D:\Java\.m2\repository\org\apache\logging\log4j\log4j-api\2.13.3\log4j-api-2.13.3.jar;D:\Java\.m2\repository\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar;D:\Java\.m2\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\Java\.m2\repository\org\yaml\snakeyaml\1.27\snakeyaml-1.27.jar;D:\Java\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.4.5\spring-boot-starter-json-2.4.5.jar;D:\Java\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.11.4\jackson-databind-2.11.4.jar;D:\Java\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.11.4\jackson-annotations-2.11.4.jar;D:\Java\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.11.4\jackson-core-2.11.4.jar;D:\Java\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.11.4\jackson-datatype-jdk8-2.11.4.jar;D:\Java\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.11.4\jackson-datatype-jsr310-2.11.4.jar;D:\Java\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.11.4\jackson-module-parameter-names-2.11.4.jar;D:\Java\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.4.5\spring-boot-starter-tomcat-2.4.5.jar;D:\Java\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.45\tomcat-embed-core-9.0.45.jar;D:\Java\.m2\repository\org\glassfish\jakarta.el\3.0.3\jakarta.el-3.0.3.jar;D:\Java\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.45\tomcat-embed-websocket-9.0.45.jar;D:\Java\.m2\repository\org\springframework\spring-web\5.3.6\spring-web-5.3.6.jar;D:\Java\.m2\repository\org\springframework\spring-beans\5.3.6\spring-beans-5.3.6.jar;D:\Java\.m2\repository\org\springframework\spring-webmvc\5.3.6\spring-webmvc-5.3.6.jar;D:\Java\.m2\repository\org\springframework\spring-aop\5.3.6\spring-aop-5.3.6.jar;D:\Java\.m2\repository\org\springframework\spring-context\5.3.6\spring-context-5.3.6.jar;D:\Java\.m2\repository\org\springframework\spring-expression\5.3.6\spring-expression-5.3.6.jar;D:\Java\.m2\repository\org\springframework\boot\spring-boot-configuration-processor\2.4.5\spring-boot-configuration-processor-2.4.5.jar;D:\Java\.m2\repository\org\projectlombok\lombok\1.18.20\lombok-1.18.20.jar;D:\Java\.m2\repository\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;D:\Java\.m2\repository\org\springframework\spring-core\5.3.6\spring-core-5.3.6.jar;D:\Java\.m2\repository\org\springframework\spring-jcl\5.3.6\spring-jcl-5.3.6.jar;D:\Java\.m2\repository\org\springframework\boot\spring-boot-starter-actuator\2.4.5\spring-boot-starter-actuator-2.4.5.jar;D:\Java\.m2\repository\org\springframework\boot\spring-boot-actuator-autoconfigure\2.4.5\spring-boot-actuator-autoconfigure-2.4.5.jar;D:\Java\.m2\repository\org\springframework\boot\spring-boot-actuator\2.4.5\spring-boot-actuator-2.4.5.jar;D:\Java\.m2\repository\io\micrometer\micrometer-core\1.6.6\micrometer-core-1.6.6.jar;D:\Java\.m2\repository\org\hdrhistogram\HdrHistogram\2.1.12\HdrHistogram-2.1.12.jar;D:\Java\.m2\repository\org\latencyutils\LatencyUtils\2.0.3\LatencyUtils-2.0.3.jar;D:\Java\.m2\repository\com\alibaba\cloud\aliyun-sms-spring-boot-starter\1.0.0\aliyun-sms-spring-boot-starter-1.0.0.jar;D:\Java\.m2\repository\com\alibaba\cloud\aliyun-context-spring-boot-starter\1.0.0\aliyun-context-spring-boot-starter-1.0.0.jar;D:\Java\.m2\repository\com\alibaba\cloud\alicloud-context\1.0.5\alicloud-context-1.0.5.jar;D:\Java\.m2\repository\com\aliyun\aliyun-java-sdk-edas\2.44.0\aliyun-java-sdk-edas-2.44.0.jar;D:\Java\.m2\repository\com\aliyun\aliyun-java-sdk-core\4.5.0\aliyun-java-sdk-core-4.5.0.jar;D:\Java\.m2\repository\com\google\code\gson\gson\2.8.6\gson-2.8.6.jar;D:\Java\.m2\repository\org\apache\httpcomponents\httpclient\4.5.13\httpclient-4.5.13.jar;D:\Java\.m2\repository\commons-codec\commons-codec\1.15\commons-codec-1.15.jar;D:\Java\.m2\repository\org\apache\httpcomponents\httpcore\4.4.14\httpcore-4.4.14.jar;D:\Java\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;D:\Java\.m2\repository\javax\xml\bind\jaxb-api\2.3.1\jaxb-api-2.3.1.jar;D:\Java\.m2\repository\javax\activation\javax.activation-api\1.2.0\javax.activation-api-1.2.0.jar;D:\Java\.m2\repository\org\jacoco\org.jacoco.agent\0.8.5\org.jacoco.agent-0.8.5-runtime.jar;D:\Java\.m2\repository\org\ini4j\ini4j\0.5.4\ini4j-0.5.4.jar;D:\Java\.m2\repository\io\opentracing\opentracing-api\0.33.0\opentracing-api-0.33.0.jar;D:\Java\.m2\repository\io\opentracing\opentracing-util\0.33.0\opentracing-util-0.33.0.jar;D:\Java\.m2\repository\io\opentracing\opentracing-noop\0.33.0\opentracing-noop-0.33.0.jar;D:\Java\.m2\repository\com\aliyun\aliyun-java-sdk-dysmsapi\1.1.0\aliyun-java-sdk-dysmsapi-1.1.0.jar;D:\Java\.m2\repository\com\aliyun\mns\aliyun-sdk-mns\1.1.8.6\aliyun-sdk-mns-1.1.8.6.jar;D:\Java\.m2\repository\org\apache\httpcomponents\httpasyncclient\4.1.4\httpasyncclient-4.1.4.jar;D:\Java\.m2\repository\org\apache\httpcomponents\httpcore-nio\4.4.14\httpcore-nio-4.4.14.jar;D:\Java\.m2\repository\org\apache\commons\commons-lang3\3.11\commons-lang3-3.11.jar;D:\Java\.m2\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar;D:\Java\.m2\repository\com\aliyun\aliyun-java-sdk-ecs\3.0.0\aliyun-java-sdk-ecs-3.0.0.jar;D:\Java\.m2\repository\org\json\json\20170516\json-20170516.jar;D:\Java\IntelliJ IDEA 2020.3.2\lib\idea_rt.jar" com.blankhang.sms.SmsApplication
Connected to the target VM, address: '127.0.0.1:60012', transport: 'socket'

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.4.5)

2021-04-22 17:25:30.365  INFO 2672 --- [           main] com.blankhang.sms.SmsApplication         : Starting SmsApplication using Java 11.0.10 on blank-work with PID 2672 (D:\Blank\Projects\sms\target\classes started by blank in D:\Blank\Projects\sms)
2021-04-22 17:25:30.368  INFO 2672 --- [           main] com.blankhang.sms.SmsApplication         : No active profile set, falling back to default profiles: default
2021-04-22 17:25:31.156  INFO 2672 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 9051 (http)
2021-04-22 17:25:31.163  INFO 2672 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-04-22 17:25:31.163  INFO 2672 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.45]
2021-04-22 17:25:31.224  INFO 2672 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-04-22 17:25:31.225  INFO 2672 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 811 ms
2021-04-22 17:25:31.432  INFO 2672 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2021-04-22 17:25:31.695  INFO 2672 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 14 endpoint(s) beneath base path '/actuator'
2021-04-22 17:25:31.734  INFO 2672 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 9051 (http) with context path ''
2021-04-22 17:25:31.751  INFO 2672 --- [           main] com.blankhang.sms.SmsApplication         : Started SmsApplication in 1.791 seconds (JVM running for 2.698)
2021-04-22 17:25:32.166  INFO 2672 --- [)-192.168.1.100] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-04-22 17:25:32.166  INFO 2672 --- [)-192.168.1.100] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2021-04-22 17:25:32.167  INFO 2672 --- [)-192.168.1.100] o.s.web.servlet.DispatcherServlet        : Completed initialization in 1 ms
2021-04-22 17:25:32.479 ERROR 2672 --- [p-thread-pool-1] c.a.c.s.b.s.b.DefaultAlicomMessagePuller : PullMessageTask_execute_error,messageType:SmsUp,queueName:Alicom-Queue-test-SmsUp

com.aliyun.mns.common.ServiceException: <?xml version="1.0" ?>
<Error xmlns="http://mns.aliyuncs.com/doc/v1">
  <Code>AccessDeniedByRamPolicy</Code>
  <Message>The request is denied by ram policy.</Message>
  <RequestId>6081410D314543877A0C839E</RequestId>
  <HostId>http://1943695596114318.mns.cn-hangzhou.aliyuncs.com</HostId>
</Error>
	at com.aliyun.mns.common.http.ExceptionResultParser.parse(ExceptionResultParser.java:46) ~[aliyun-sdk-mns-1.1.8.6.jar:na]
	at com.aliyun.mns.common.http.ExceptionResultParser.parse(ExceptionResultParser.java:12) ~[aliyun-sdk-mns-1.1.8.6.jar:na]
	at com.aliyun.mns.common.http.HttpCallback.handleResult(HttpCallback.java:144) ~[aliyun-sdk-mns-1.1.8.6.jar:na]
	at com.aliyun.mns.common.http.HttpCallback.buildResponseMessage(HttpCallback.java:117) ~[aliyun-sdk-mns-1.1.8.6.jar:na]
	at com.aliyun.mns.common.http.HttpCallback.completed(HttpCallback.java:77) ~[aliyun-sdk-mns-1.1.8.6.jar:na]
	at com.aliyun.mns.common.http.HttpCallback.completed(HttpCallback.java:22) ~[aliyun-sdk-mns-1.1.8.6.jar:na]
	at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:122) ~[httpcore-4.4.14.jar:4.4.14]
	at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:181) ~[httpasyncclient-4.1.4.jar:4.1.4]
	at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:448) ~[httpcore-nio-4.4.14.jar:4.4.14]
	at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:338) ~[httpcore-nio-4.4.14.jar:4.4.14]
	at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:265) ~[httpcore-nio-4.4.14.jar:4.4.14]
	at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81) ~[httpasyncclient-4.1.4.jar:4.1.4]
	at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39) ~[httpasyncclient-4.1.4.jar:4.1.4]
	at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:121) ~[httpcore-nio-4.4.14.jar:4.4.14]
	at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162) ~[httpcore-nio-4.4.14.jar:4.4.14]
	at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337) ~[httpcore-nio-4.4.14.jar:4.4.14]
	at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315) ~[httpcore-nio-4.4.14.jar:4.4.14]
	at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276) ~[httpcore-nio-4.4.14.jar:4.4.14]
	at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) ~[httpcore-nio-4.4.14.jar:4.4.14]
	at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591) ~[httpcore-nio-4.4.14.jar:4.4.14]
	at java.base/java.lang.Thread.run(Thread.java:829) ~[na:na]
参数配置为

# Spring Boot properties
spring.application.name=aliyun-spring-boot-sms-sample
server.port=9051

# Spring Boot Actuator
management.endpoints.web.exposure.include=*

# Aliyun SMS properties
alibaba.cloud.access-key=key
alibaba.cloud.secret-key=secret
alibaba.cloud.sms.report-queue-name=Alicom-Queue-test-Report
alibaba.cloud.sms.up-queue-name=Alicom-Queue-test-SmsUp

# The value of placeholders using in the sample
#sample.phone-number = *********
#sample.sign-name = *********
#sample.template-code = *******
pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.5</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.blankhang</groupId>
    <artifactId>sms</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>sms</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>11</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>aliyun-sms-spring-boot-starter</artifactId>
        </dependency>

    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>aliyun-spring-boot-dependencies</artifactId>
                <version>1.0.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>

        </plugins>
    </build>
    <repositories>
        <repository>
            <id>spring-releases</id>
            <name>Spring Releases</name>
            <url>https://repo.spring.io/release</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-releases</id>
            <name>Spring Releases</name>
            <url>https://repo.spring.io/release</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>


</project>
@blankhang blankhang added the bug Something isn't working label Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant