apache / apisix-java-plugin-runner

APISIX Plugin Runner in Java
https://apisix.apache.org/
Apache License 2.0
126 stars 95 forks source link

help request: question about the socket file of java plugin #279

Open mayunSaicmotor opened 7 months ago

mayunSaicmotor commented 7 months ago

Description

Dear,

Does the socket file need to config manually in the spring config file for java plugin ? I found if i don't config the socket file , the java plugin can't be started correctly. if need to config manually, is there some rules for the socket file path? or I can config any file path?

image

Environment

APISIX 3.7.0 Operating system Mac(m2) I used docker example from docker-apisix, all docker container info as below

mayunSaicmotor commented 7 months ago

@shreemaan-abhishek dear shreemaan, could you help me

shreemaan-abhishek commented 7 months ago

sorry I am not much familiar with the plugin runner.

mayunSaicmotor commented 7 months ago

who can help?

sorry I am not much familiar with the plugin runner.

lakshya8066 commented 7 months ago

I can look into it

yijieshusheng-git commented 7 months ago

调试模式是需要先指定 sock文件的,运行模式则不需要,apisix在启动插件时会自动在 /usr/local/生成一个sock啊

mayunSaicmotor commented 7 months ago

调试模式是需要先指定 sock文件的,运行模式则不需要,apisix在启动插件时会自动在 /usr/local/生成一个sock啊

这样啊?等会我试试 你知道 运行模式 怎么新增jvm参数吗

yijieshusheng-git commented 7 months ago

式 怎么新增jvm参数吗

这个应是在springbooot启动命令中增加,我还没做到这一步,我有个问题,receive undefined filter: xxxx, skip it 这个你遇到过吗,插件启动正常,但是apisix检测不到配置的自定义插件

mayunSaicmotor commented 6 months ago

式 怎么新增jvm参数吗

这个应是在springbooot启动命令中增加,我还没做到这一步,我有个问题,receive undefined filter: xxxx, skip it 这个你遇到过吗,插件启动正常,但是apisix检测不到配置的自定义插件

没有碰到 我也是新手 我现在因为用了jdk17 启动java 程序需要增加一些jvm参数 死活配置不了 我吐血了,他哪个启动时配置的 apisix conf文件里的

yijieshusheng-git commented 6 months ago

这个有很多啊 https://blog.csdn.net/CNDN_Web/article/details/132103148 配置在cmd里面的

mayunSaicmotor commented 6 months ago

这个有很多啊 https://blog.csdn.net/CNDN_Web/article/details/132103148 配置在cmd里面的

他是apisix 自己去调用 java命令启动的 不是自己写的脚本启动

mayunSaicmotor commented 6 months ago

If i remove the socket.file configuration from the application.yml, it shows the below error when startup:

, context: ngx.timer
2023/12/26 15:55:30 [warn] 53#53: *81 [lua] init.lua:961: 2023-12-26 15:55:30.912  WARN 88 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'applicationRunner': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'socket.file' in value "${socket.file}"
, context: ngx.timer
2023/12/26 15:55:30 [warn] 53#53: *81 [lua] init.lua:961: 2023-12-26 15:55:30.912  INFO 88 --- [           main] c.a.c.d.s.DubboGenericServiceFactory     : The Dubbo GenericService ReferenceBeans are destroying...
, context: ngx.timer
2023/12/26 15:55:30 [warn] 53#53: *81 [lua] init.lua:961: 2023-12-26 15:55:30.912  INFO 88 --- [           main] c.a.c.d.s.DubboGenericServiceFactory     : Destroyed the ReferenceBean  : <dubbo:reference /> 
, context: ngx.timer
2023/12/26 15:55:30 [warn] 53#53: *81 [lua] init.lua:961: 2023-12-26 15:55:30.913  INFO 88 --- [           main] c.a.c.d.s.DubboGenericServiceFactory     : Destroyed the ReferenceBean  : <dubbo:reference /> 
, context: ngx.timer
2023/12/26 15:55:30 [warn] 53#53: *81 [lua] init.lua:961: 2023-12-26 15:55:30.914  INFO 88 --- [           main] f.a.ReferenceAnnotationBeanPostProcessor : org.apache.dubbo.common.bytecode.proxy2@2cec704c was destroying!
, context: ngx.timer
2023/12/26 15:55:30 [warn] 53#53: *81 [lua] init.lua:961: 2023-12-26 15:55:30.914  INFO 88 --- [           main] f.a.ReferenceAnnotationBeanPostProcessor : org.apache.dubbo.common.bytecode.proxy2@2cec704c was destroying!
, context: ngx.timer
2023/12/26 15:55:30 [warn] 53#53: *81 [lua] init.lua:961: 2023-12-26 15:55:30.914  INFO 88 --- [           main] f.a.ReferenceAnnotationBeanPostProcessor : class org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor was destroying!
, context: ngx.timer
2023/12/26 15:55:30 [warn] 53#53: *81 [lua] init.lua:961: 2023-12-26 15:55:30.915  INFO 88 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
, context: ngx.timer
2023/12/26 15:55:30 [warn] 53#53: *81 [lua] init.lua:961: 2023-12-26 15:55:30.994  INFO 88 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
, context: ngx.timer
2023/12/26 15:55:31 [warn] 53#53: *81 [lua] init.lua:961: 2023-12-26 15:55:31.000 ERROR 88 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'applicationRunner': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'socket.file' in value "${socket.file}"
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:405) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1420) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879) ~[spring-context-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) ~[spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) ~[spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) ~[spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
    at com.zebra.carcloud.openapi.apisix.plugin.dubbo.GateWayApplication.main(GateWayApplication.java:24) ~[classes!/:0.0.1-SNAPSHOT]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/, context: ngx.timer
2023/12/26 15:55:31 [warn] 53#53: *81 [lua] init.lua:961: java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[dubbo-plugin-0.0.1-SNAPSHOT-exec.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:107) ~[dubbo-plugin-0.0.1-SNAPSHOT, context: ngx.timer
2023/12/26 15:55:31 [warn] 53#53: *81 [lua] init.lua:961: -exec.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[dubbo-plugin-0.0.1-SNAPSHOT-exec.jar:0.0.1-SNAPSHOT]
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) ~[dubbo-plugin-0.0.1-SNAPSHOT-exec.jar:0.0.1-SNAPSHOT]
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'socket.file' in value "${socket.file}"
    at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:178) ~[spring-core-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
    at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124) ~[spring-core-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
    at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:239) ~[spring-core-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
    at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210) ~[spring-core-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
    at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175) ~[spring-context-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:918) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1248) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
    ... 26 common frames omitted