{"action":"created","issue":{"url":"https://api.github.com/repos/alipay/sofa-boot/issues/240","repository_url":"https://api.github.com/repos/alipay/sofa-boot","labels_url":"https://api.github.com/repos/alipay/sofa-boot/issues/240/labels{/name}","comments_url":"https://api.github.com/repos/alipay/sofa-boot/issues/240/comments","events_url":"https://api.github.com/repos/alipay/sofa-boot/issues/240/events","html_url":"https://github.com/alipay/sofa-boot/issues/240","id":369478208,"node_id":"MDU6SXNzdWUzNjk0NzgyMDg=","number":240,"title":"关于ark-plugin包的类加载不到的问题","user":{"login":"luoluo001","id":24263006,"node_id":"MDQ6VXNlcjI0MjYzMDA2","avatar_url":"https://avatars1.githubusercontent.com/u/24263006?v=4","gravatar_id":"","url":"https://api.github.com/users/luoluo001","html_url":"https://github.com/luoluo001","followers_url":"https://api.github.com/users/luoluo001/followers","following_url":"https://api.github.com/users/luoluo001/following{/other_user}","gists_url":"https://api.github.com/users/luoluo001/gists{/gist_id}","starred_url":"https://api.github.com/users/luoluo001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luoluo001/subscriptions","organizations_url":"https://api.github.com/users/luoluo001/orgs","repos_url":"https://api.github.com/users/luoluo001/repos","events_url":"https://api.github.com/users/luoluo001/events{/privacy}","received_events_url":"https://api.github.com/users/luoluo001/received_events","type":"User","site_admin":false},"labels":[{"id":887226205,"node_id":"MDU6TGFiZWw4ODcyMjYyMDU=","url":"https://api.github.com/repos/alipay/sofa-boot/labels/question","name":"question","color":"87CEFF","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-10-12T09:47:07Z","updated_at":"2018-10-15T03:53:46Z","closed_at":"2018-10-15T03:53:46Z","author_association":"NONE","body":"  background : project ,springboot    dev tool,IDEA\r\n\r\n     i can't load class of ark-plugin's jars when visit web api.(当访问web接口，不能加载到ark-plugin jar包的class)\r\nthe exception:\r\ncom.alipay.sofa.ark.exception.ArkLoaderException: [ArkBiz Loader] Startup In IDE:Mock version : can not load class: com.dinfo.custom.comp.AppServer\r\n\tat com.alipay.sofa.ark.container.service.classloader.BizClassLoader.loadClassInternal(BizClassLoader.java:90)\r\n\tat com.alipay.sofa.ark.container.service.classloader.AbstractClasspathClassloader.loadClass(AbstractClasspathClassloader.java:59)\r\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:357)\r\n\tat java.lang.Class.forName0(Native Method)\r\n\tat java.lang.Class.forName(Class.java:264)\r\n\tat com.dinfo.model.ModuleInvocation.invoke(ModuleInvocation.java:32)\r\n\tat com.dinfo.controller.CompController.httpLocalExecute(CompController.java:44)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:498)\r\n\tat org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)\r\n\tat org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)\r\n\tat org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)\r\n\tat org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)\r\n\tat org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)\r\n\tat org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)\r\n\tat org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)\r\n\tat org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)\r\n\tat org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)\r\n\tat org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)\r\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:661)\r\n\tat org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)\r\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:742)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\r\n\tat org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\r\n\tat org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)\r\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\r\n\tat org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)\r\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\r\n\r\nthe code:\r\n Class<?> cls = Class.forName(className);(在接口Controller中执行该代码报错)\r\n\r\n根据看的源码部分发现：每个pligin都有各自对应的类加载器，在PluginManagerServiceImpl中有个plugins map是可以获取plugin 问题是 ContainerClassLoader 我不知道怎么获取到，请问有获取的方法吗？或者 有什么方法可以直接获取到ark-plugin中的class？\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/alipay/sofa-boot/issues/comments/429700859","html_url":"https://github.com/alipay/sofa-boot/issues/240#issuecomment-429700859","issue_url":"https://api.github.com/repos/alipay/sofa-boot/issues/240","id":429700859,"node_id":"MDEyOklzc3VlQ29tbWVudDQyOTcwMDg1OQ==","user":{"login":"luoluo001","id":24263006,"node_id":"MDQ6VXNlcjI0MjYzMDA2","avatar_url":"https://avatars1.githubusercontent.com/u/24263006?v=4","gravatar_id":"","url":"https://api.github.com/users/luoluo001","html_url":"https://github.com/luoluo001","followers_url":"https://api.github.com/users/luoluo001/followers","following_url":"https://api.github.com/users/luoluo001/following{/other_user}","gists_url":"https://api.github.com/users/luoluo001/gists{/gist_id}","starred_url":"https://api.github.com/users/luoluo001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luoluo001/subscriptions","organizations_url":"https://api.github.com/users/luoluo001/orgs","repos_url":"https://api.github.com/users/luoluo001/repos","events_url":"https://api.github.com/users/luoluo001/events{/privacy}","received_events_url":"https://api.github.com/users/luoluo001/received_events","type":"User","site_admin":false},"created_at":"2018-10-15T03:53:46Z","updated_at":"2018-10-15T03:53:46Z","author_association":"NONE","body":"> > github地址为 https://github.com/luoluo001/sofaarkdemo 设置了导出类但是没有看到效果。\r\n> \r\n> postman 测试参数设置错误，你在配置导出类是 `myproject.custom.comp.AppServer`，然则参数设置的是 `com.dinfo.custom.comp.AppServer`。\r\n> \r\n> > 另外也不是很理解配置导出类，按文档的介绍，导出类不是其他ark-plugin加载的时候会优先加载该导出类的这个类吗，可是springboot这个ark jar不属于ark-plugin啊？\r\n> \r\n> 插件导出类优先被其他ark-plugin加载，前提是其他插件配置了**导入类**。 springboot 工程中之所以能够加载到ark plugin的导出类，因为biz会默认优先加载所有ark plugin 的导出类，不需要配置类似的导入类。 参考文档 http://www.sofastack.tech/sofa-boot/docs/sofa-ark-classloader\r\n给大佬添麻烦了，项目改了 包名忘记改过来了，不好意思\r\n"}}
{"actor":{"display_login":"luoluo001"}}