Giter VIP home page Giter VIP logo

Comments (5)

dosubot avatar dosubot commented on May 29, 2024 2

Hey @starsky20, back for more Apollo adventures, I see! 🚀

Based on the error log you provided, it seems that the Apollo service is trying to resolve a hostname (apollo.meta) that is not defined in your environment or DNS settings. This typically happens when the application tries to connect to a server with a hostname that cannot be resolved to an IP address.

In the Apollo codebase, the apollo.meta hostname is referenced in the context of loading meta server addresses. This is done by looking for keys that end with "_meta" (for system properties and OS environment variables) and ".meta" (for user's configuration files) in a case-insensitive manner. The relevant code segments are found in the DefaultPortalMetaServerProvider class, specifically in the methods getDomainsFromSystemProperty(), getDomainsFromOSEnvironment(), and getDomainsFromPropertiesFile(). These methods are responsible for loading the meta server addresses from the system properties, OS environment variables, and properties file (apollo-env.properties), respectively. You can find this in the DefaultPortalMetaServerProvider.java file.

To resolve this issue, you have a couple of options:

  1. Define apollo.meta in your Hosts File: If apollo.meta is supposed to point to a specific IP address, you can manually add an entry to your hosts file to resolve this hostname to the correct IP. This is done by editing the hosts file on your system (/etc/hosts on Linux/macOS, C:\Windows\System32\drivers\etc\hosts on Windows) and adding a line like 127.0.0.1 apollo.meta (replace 127.0.0.1 with the actual IP address if it's not meant to point to localhost).

  2. Update Your Application Configuration: If the usage of apollo.meta is a mistake or if it should be replaced with one of the defined meta server URLs (dev_meta, fat_meta, uat_meta, pro_meta), update your application's configuration to use the correct meta server URL based on your environment.

Without more specific details on where apollo.meta is being referenced in your application, these are general approaches to resolve the java.net.UnknownHostException. You'll need to identify where apollo.meta is being used (e.g., in application properties, environment variables, or code) and apply one of the above solutions accordingly.

I also found a similar issue in the Apollo repository: apollo客户端无法获取项目下apollo-env.properties中的dev.meta地址. The suggested solution there is to ensure that the server.properties file is correctly placed in the C:\opt\settings\ directory and that the file does not have a hidden extension like .txt. Also, verify that the apollo-env.properties file is placed in the correct location, which should be the resources directory, and ensure that this directory is marked as a resource folder in your project settings. Lastly, make sure that the environment is set correctly, for example, env=DEV or env=dev, and that the apollo-env.properties file contains the correct property for the environment, such as dev.meta.

If the issue persists, consider debugging the com.ctrip.framework.apollo.core.internals.LegacyMetaServerProvider#getMetaServerAddress(com.ctrip.framework.apollo.core.enums.Env) logic and the com.ctrip.framework.apollo.core.MetaDomainConsts#initMetaServerAddress to find out why the dev.meta is not being retrieved.

I hope this helps! If you need further assistance, please provide more details about your configuration and where apollo.meta is being referenced in your application.

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

from apollo.

starsky20 avatar starsky20 commented on May 29, 2024

按照您提供的解决办法,分别验证了以下几种办法:
1.在apollo-env.properties设置中设置dev.meta=http://192.168.3.174:8080、apollo.meta=http://192.168.3.174:8080

2.在C:\opt\settings\server.properties 文件中添加env=DEV
image

3.启动增加jvm参数 -Dapollo_profile=github -Denv=dev -Dapollo.meta=http://192.168.3.174:8080

以上三种方式都不可以,还是提示无法java.net.UnknownHostException: apollo.meta。调试代码后发现是env环境没有生效导致。
通过打成jar包后,修改application.yml的激活环境为github,dev,auth,然后在命令行直接执行 java -jar apollo-portal-2.3.0-SNAPSHOT.jar 启动无任务问题。

image

from apollo.

nobodyiam avatar nobodyiam commented on May 29, 2024

可以在系统信息页面看到详情

image

from apollo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.