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

debug mode is ok,run mode error (调试模式运行正常,运行模式报错) #146

Closed
licheng541472110 opened this issue May 24, 2022 · 7 comments

Comments

@licheng541472110
Copy link

  1. debug mode is ok (调试模式运行正常)

java -jar -DAPISIX_LISTEN_ADDRESS=unix:/tmp/runner.sock -DAPISIX_CONF_EXPIRE_TIME=3600 /path/to/apisix-java-plugin-runner.jar
说明:使用这种方式运行是正常的,并且过滤能够生效。
It is normal to run in this way, and the filtering can take effect.

2.run mode error (运行模式报错)
ext-plugin: cmd: ['java', '-jar', '-Xmx4g', '-Xms4g', '/path/to/apisix-runner-bin/apisix-java-plugin-runner.jar']
说明:通过APISIX 自身运行的方式报错,查看日志文件如下:
Report an error through APISIX's own operation, check the log file as follows:

java.lang.IllegalStateException: Failed to execute CommandLineRunner at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:822) [spring-boot-2.4.5.jar!/:2.4.5] at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:803) [spring-boot-2.4.5.jar!/:2.4.5] at org.springframework.boot.SpringApplication.run(SpringApplication.java:346) [spring-boot-2.4.5.jar!/:2.4.5] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:144) [spring-boot-2.4.5.jar!/:2.4.5] at org.apache.apisix.plugin.runner.PluginRunnerApplication.main(PluginRunnerApplication.java:30) [classes!/:0.2.0] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) [apisix-java-plugin-runner.jar:0.2.0] at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) [apisix-java-plugin-runner.jar:0.2.0] at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) [apisix-java-plugin-runner.jar:0.2.0] at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:467) [apisix-java-plugin-runner.jar:0.2.0] Caused by: io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: No such file or directory

@tzssangglass
Copy link
Member

ref: #137

Or give the complete reproduction steps.

@licheng541472110
Copy link
Author

1.The operating system is centos7. Running in debug mode, everything works fine.
After compiling the jar file, after running the following command, the configuration and enabling plugin can be used normally.

"java -jar -DAPISIX_LISTEN_ADDRESS=unix:/tmp/runner.sock -DAPISIX_CONF_EXPIRE_TIME=3600 /home/apisix-java-plugin-runner.jar"

"ext-plugin:
path_for_test: /tmp/runner.sock"

2.The mode of switching to official operation cannot run successfully

Modify the configuration file "config.yaml"

The following is the configuration according to the document, which does not work properly

"ext-plugin:
cmd: ['java', '-jar', '-Xmx4g', '-Xms4g', '/home/apisix-java-plugin-runner.jar'] "

Try to modify it to the following parameters, the access route can display the request header, but not the main body.

"['java', '-jar', '-DAPISIX_LISTEN_ADDRESS=unix:/tmp/runner.sock', '-DAPISIX_CONF_EXPIRE_TIME=3600', '-Xmx4g', '-Xms4g', '/usr/local/apisix-runner-bin/apisix-java-plugin-runner.jar']"

According to the document, I have tried many times, but it can only run normally in the debug mode, and it can never be successful in the official running mode.

Can you speak Chinese

@licheng541472110
Copy link
Author

参考:#137

或者给出完整的复制步骤。

Please see reply

@tzssangglass
Copy link
Member

"['java', '-jar', '-DAPISIX_LISTEN_ADDRESS=unix:/tmp/runner.sock', '-DAPISIX_CONF_EXPIRE_TIME=3600', '-Xmx4g', '-Xms4g', '/usr/local/apisix-runner-bin/apisix-java-plugin-runner.jar']"

in run model, no need to set it up like this.

From your description of the reproduction steps, I was unable to reproduce them.

I think you can check if the .sock file exists under apisix/conf/.

In run mode, APISIX will generate the sock file under apisix/conf/ and pass the address to the java runner.

@licheng541472110
Copy link
Author

"['java', '-jar', '-DAPISIX_LISTEN_ADDRESS=unix:/tmp/runner.sock', '-DAPISIX_CONF_EXPIRE_TIME=3600', '-Xmx4g', '-Xms4g', '/usr/local/apisix-runner-bin/apisix-java-plugin-runner.jar']"

in run model, no need to set it up like this.

From your description of the reproduction steps, I was unable to reproduce them.

I think you can check if the .sock file exists under apisix/conf/.

In run mode, APISIX will generate the sock file under apisix/conf/ and pass the address to the java runner.

”/usr/local/apisix/conf“
There is no .sock file in the directory, whether it is related to permissions, the debug mode is started with the java command executed by "root".

When called via APISIX program an error is displayed:
”2022/05/24 01:33:02 [error] 9728#9746: lua pipe child execvp() failed while executing java -jar ... (2: No such file or directory)“

@licheng541472110
Copy link
Author

"['java', '-jar', '-DAPISIX_LISTEN_ADDRESS=unix:/tmp/runner.sock', '-DAPISIX_CONF_EXPIRE_TIME=3600', '-Xmx4g', '-Xms4g', '/usr/local/apisix-runner-bin/apisix-java-plugin-runner.jar']"

in run model, no need to set it up like this.

From your description of the reproduction steps, I was unable to reproduce them.

I think you can check if the .sock file exists under apisix/conf/.

In run mode, APISIX will generate the sock file under apisix/conf/ and pass the address to the java runner.

Thanks! The problem is solved, jdk is the decompressed version, you need to specify the full path of java.

Modify it to the following configuration:

ext-plugin:
cmd: ['/home/jdk11/java', '-jar', '-Xmx4g', '-Xms4g', '/home/apisix-java-plugin-runner.jar']

@caojianfei
Copy link

"['java', '-jar', '-DAPISIX_LISTEN_ADDRESS=unix:/tmp/runner.sock', '-DAPISIX_CONF_EXPIRE_TIME=3600', '-Xmx4g', '-Xms4g', '/usr/local/apisix-runner-bin/apisix-java-plugin-runner.jar']"

in run model, no need to set it up like this.
From your description of the reproduction steps, I was unable to reproduce them.
I think you can check if the .sock file exists under apisix/conf/.
In run mode, APISIX will generate the sock file under apisix/conf/ and pass the address to the java runner.

Thanks! The problem is solved, jdk is the decompressed version, you need to specify the full path of java.

Modify it to the following configuration:

ext-plugin: cmd: ['/home/jdk11/java', '-jar', '-Xmx4g', '-Xms4g', '/home/apisix-java-plugin-runner.jar']

我跟你有同样的问题?当时我用完整的java路径还是报同样的错误,你是在修改了java执行路径之后就解决问题了吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants