You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/03/23 09:26:40 UTC

[GitHub] [shardingsphere-elasticjob] buhecoffee opened a new issue #2062: elasticjob-lite-spring-boot-starter 3.0.1 启动时报ip is null异常

buhecoffee opened a new issue #2062:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/2062


   有基于SpringBoot 3.0版的演示例子,请给一个。
   ```xml
   <dependency>
       <groupId>org.apache.shardingsphere.elasticjob</groupId>
       <artifactId>elasticjob-lite-spring-boot-starter</artifactId>
       <version>3.0.1</version>
   </dependency>
   ```
   ```yml
   elasticjob:
     regCenter:
       #zookeeper 的ip:port
       serverLists: 127.0.0.1:2181
       #名命空间,自己定义就好了
       namespace: my-job4
     jobs:
       #你的这个定时任务名称,自定义名称
       myElasticJob:
         #定时任务的全路径名
         elasticJobClass: xin.altitude.elastic.job.job.MyJob
         #定时任务执行的cron表达式
         cron: 0/5 * * * * ?
         #分片数量
         shardingTotalCount: 3
   ```
   ```text
   org.apache.shardingsphere.elasticjob.infra.env.HostException: ip is null
     at org.apache.shardingsphere.elasticjob.infra.env.IpUtils.getIp(IpUtils.java:70) ~[elasticjob-infra-common-3.0.1.jar:3.0.1]
     at org.apache.shardingsphere.elasticjob.infra.handler.sharding.JobInstance.<init>(JobInstance.java:44) ~[elasticjob-infra-common-3.0.1.jar:3.0.1]
     at org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduler.registerStartUpInfo(JobScheduler.java:176) ~[elasticjob-lite-core-3.0.1.jar:3.0.1]
     at org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduler.createJobScheduleController(JobScheduler.java:140) ~[elasticjob-lite-core-3.0.1.jar:3.0.1]
     at org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduler.<init>(JobScheduler.java:90) ~[elasticjob-lite-core-3.0.1.jar:3.0.1]
     at org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap.<init>(ScheduleJobBootstrap.java:36) ~[elasticjob-lite-core-3.0.1.jar:3.0.1]
     at org.apache.shardingsphere.elasticjob.lite.spring.boot.job.ElasticJobBootstrapConfiguration.registerClassedJob(ElasticJobBootstrapConfiguration.java:108) ~[elasticjob-lite-spring-boot-starter-3.0.1.jar:3.0.1]
     at org.apache.shardingsphere.elasticjob.lite.spring.boot.job.ElasticJobBootstrapConfiguration.constructJobBootstraps(ElasticJobBootstrapConfiguration.java:91) ~[elasticjob-lite-spring-boot-starter-3.0.1.jar:3.0.1]
     at org.apache.shardingsphere.elasticjob.lite.spring.boot.job.ElasticJobBootstrapConfiguration.createJobBootstrapBeans(ElasticJobBootstrapConfiguration.java:64) ~[elasticjob-lite-spring-boot-starter-3.0.1.jar:3.0.1]
     at org.apache.shardingsphere.elasticjob.lite.spring.boot.job.ElasticJobBootstrapConfiguration.afterSingletonsInstantiated(ElasticJobBootstrapConfiguration.java:52) ~[elasticjob-lite-spring-boot-starter-3.0.1.jar:3.0.1]
     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:972) ~[spring-beans-5.3.16.jar:5.3.16]
     at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.16.jar:5.3.16]
     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.16.jar:5.3.16]
     at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.4.jar:2.6.4]
     at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740) [spring-boot-2.6.4.jar:2.6.4]
     at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415) [spring-boot-2.6.4.jar:2.6.4]
     at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-2.6.4.jar:2.6.4]
     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312) [spring-boot-2.6.4.jar:2.6.4]
     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) [spring-boot-2.6.4.jar:2.6.4]
     at xin.altitude.elastic.job.ElasticJobDemoApplication.main(ElasticJobDemoApplication.java:10) [classes/:na]
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org