首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Spring-Boot BeanCreatingException

Spring-Boot BeanCreatingException
EN

Stack Overflow用户
提问于 2018-11-12 11:08:20
回答 1查看 2.5K关注 0票数 1

我的项目正在运行,但5分钟后没有变化,我重新编译了我的项目,有一个错误,只需在这里输入如下代码。

代码语言:javascript
复制
2018-11-12 14:04:27.508  INFO 7904 --- [           main] c.i.IwbEmuhasebeAdapterApplication       : Starting IwbEmuhasebeAdapterApplication on PRMS-ALC with PID 7904 (D:\eclipse-workspace\iwb-emuhasebe-adapter\target\classes started by Alican in D:\eclipse-workspace\iwb-emuhasebe-adapter)
2018-11-12 14:04:27.516  INFO 7904 --- [           main] c.i.IwbEmuhasebeAdapterApplication       : No active profile set, falling back to default profiles: default
2018-11-12 14:04:27.626  INFO 7904 --- [           main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@5a45133e: startup date [Mon Nov 12 14:04:27 EET 2018]; root of context hierarchy
2018-11-12 14:04:30.873  INFO 7904 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8083 (http)
2018-11-12 14:04:30.940  INFO 7904 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2018-11-12 14:04:30.940  INFO 7904 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.34
2018-11-12 14:04:30.969  INFO 7904 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jdk1.8.0_171\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files\Java\jdk1.8.0_171\jre\bin;C:/Program Files/Java/jre1.8.0_191/bin/server;C:/Program Files/Java/jre1.8.0_191/bin;C:/Program Files/Java/jre1.8.0_191/lib/amd64;C:\oracle\product\11.2.0\dbhome_1\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Java\jdk1.8.0_171;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Program Files\MongoDB\Server\3.6\bin;C:\Program Files\PuTTY\;C:\Program Files\Java\jdk1.8.0_171\bin\;C:\Program Files\Java\jre1.8.0_191\bin;C:\Users\Alican\AppData\Local\Microsoft\WindowsApps;;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\Alican\AppData\Roaming\npm;C:\eclipse;;.]
2018-11-12 14:04:31.212  INFO 7904 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2018-11-12 14:04:31.213  INFO 7904 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 3599 ms
2018-11-12 14:04:31.354  INFO 7904 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Servlet dispatcherServlet mapped to [/]
2018-11-12 14:04:31.359  INFO 7904 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-11-12 14:04:31.360  INFO 7904 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-11-12 14:04:31.360  INFO 7904 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-11-12 14:04:31.360  INFO 7904 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2018-11-12 14:04:31.800  WARN 7904 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'appServlet': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [com.iworkbetter.controller.AppServlet] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
2018-11-12 14:04:31.804  INFO 7904 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]

这是我的appServlet.java

代码语言:javascript
复制
@RestController
public class AppServlet {
    @Autowired
    private AdapterEngine engine;

    public AppServlet(AdapterEngine engine) {
        this.engine = engine;
    }

    @RequestMapping("/EFaturaSender")
    public void hndEFaturaSender(HttpServletRequest request, HttpServletResponse response) {
        Map<String, String> requestParams = AdapterUtil.getParameterMap(request);
        int customizationId = 0;

        if (!AdapterUtil.isEmpty(requestParams.get("customizationId"))) {
            try {
                customizationId = AdapterUtil.uInt(requestParams.get("customizationId"));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        response.setContentType("text/html; charset=UTF-8");
        engine.eFaturaSender(customizationId, AdapterUtil.uInt(requestParams.get("efatura_id")));
    }

    /*
     * @RequestMapping("/EFaturaReceiverGelen") public void
     * hndEFaturaReceiverGelen(HttpServletRequest request, HttpServletResponse
     * response) throws IOException { Map<String, String> requestParams =
     * AdapterUtil.getParameterMap(request); int customizationId = 0;
     * 
     * if (!AdapterUtil.isEmpty(requestParams.get("customizationId"))) { try {
     * customizationId = AdapterUtil.uInt(requestParams.get("customizationId")); }
     * catch (Exception e) { e.printStackTrace(); } } int insertedInvoice = 0;
     * response.setContentType("text/html; charset=UTF-8"); insertedInvoice =
     * engine.eFaturaGelenAra(customizationId,
     * AdapterUtil.uDate(requestParams.get("start_dt")),
     * AdapterUtil.uDate(requestParams.get("end_dt")));
     * response.getWriter().write("{'success':true,'insertedInvoice':" +
     * insertedInvoice + "}");
     * 
     * }
     */

    @RequestMapping("/EFaturaReceiverGiden") // TODO Şimdilik gerek yok
    public void hndEFaturaReceiverGiden(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        Map<String, String> requestParams = AdapterUtil.getParameterMap(request);
        int customizationId = 0;

        if (!AdapterUtil.isEmpty(requestParams.get("customizationId"))) {
            try {
                customizationId = AdapterUtil.uInt(requestParams.get("customizationId"));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        int insertedInvoice = 0;
        response.setContentType("text/html; charset=UTF-8");
        try {
            insertedInvoice = engine.eFaturaAlGiden(customizationId, requestParams);
            response.getWriter().write("{'success':true,'insertedInvoice':" + insertedInvoice + "}");
        } catch (Exception e) {
            response.getWriter().write("{'success':false}");
            e.printStackTrace();
        } finally {
            response.getWriter().close();
        }
    }

    @RequestMapping("/EFaturaMukellefGuncelle") // TODO
    public void hndEFaturaMukellefGuncelle(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        Map<String, String> requestParams = AdapterUtil.getParameterMap(request);
        int customizationId = 0;
        if (!AdapterUtil.isEmpty(requestParams.get("customizationId"))) {
            try {
                customizationId = AdapterUtil.uInt(requestParams.get("customizationId"));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        int insertedMukellef = 0;
        response.setContentType("text/html; charset=UTF-8");
        try {
            insertedMukellef = engine.eFaturaMukellefGuncelle(customizationId);
            response.getWriter().write("{'success':true,'insertedMukellef':" + insertedMukellef + "}");
        } catch (IOException e) {
            response.getWriter().write("{'success':false}");
            e.printStackTrace();
        } finally {
            response.getWriter().close();
        }
    }

    @RequestMapping("/EFaturaGelenFaturaDurum")
    public void hndGelenEFaturaDurumGuncelle(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        Map<String, String> requestParams = AdapterUtil.getParameterMap(request);
        int customizationId = 0;

        if (!AdapterUtil.isEmpty(requestParams.get("customizationId"))) {
            try {
                customizationId = AdapterUtil.uInt(requestParams.get("customizationId"));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        response.setContentType("text/html; charset=UTF-8");
        try {
            engine.eFaturaGelenDurumSorgula(customizationId, AdapterUtil.uInt(requestParams.get("efatura_id")));
            response.getWriter().write("{'success':true}");
        } catch (Exception e) {
            response.getWriter().write("{'success':false}");
            e.printStackTrace();
        } finally {
            response.getWriter().close();
        }
    }

    @RequestMapping("/EFaturaGidenFaturaDurum")
    public void hndGidenEFaturaDurumGuncelle(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        Map<String, String> requestParams = AdapterUtil.getParameterMap(request);
        int customizationId = 0;

        if (!AdapterUtil.isEmpty(requestParams.get("customizationId"))) {
            try {
                customizationId = AdapterUtil.uInt(requestParams.get("customizationId"));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        response.setContentType("text/html; charset=UTF-8");
        try {
            engine.eFaturaGidenFaturaDurumSorgula(customizationId, AdapterUtil.uInt(requestParams.get("efatura_id")));
            response.getWriter().write("{'success':true}");
        } catch (Exception e) {
            response.getWriter().write("{'success':false}");
            e.printStackTrace();
        } finally {
            response.getWriter().close();
        }
    }

    @RequestMapping("/EFaturaYanıtla")
    public void hndEFaturaYanitla(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        Map<String, String> requestParams = AdapterUtil.getParameterMap(request);
        int customizationId = 0;

        if (!AdapterUtil.isEmpty(requestParams.get("customizationId"))) {
            try {
                customizationId = AdapterUtil.uInt(requestParams.get("customizationId"));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        response.setContentType("text/html; charset=UTF-8");
        try {
            engine.eFaturaYanitla(customizationId, requestParams);
            response.getWriter().write("{'success':true}");
        } catch (Exception e) {
            response.getWriter().write("{'success':false}");
            e.printStackTrace();
        } finally {
            response.getWriter().close();
        }
    }

    // @Scheduled(fixedRate = 200000) // gelen fatura icin scheduled
    public void scheduled4ReceiverInvoice() {
        int customizationId = 0;// TODO
        Date end_date = new Date();
        GregorianCalendar start_date = new GregorianCalendar();
        start_date.setTime(end_date);
        start_date.add(Calendar.DATE, -6);// bugunle 6 gun oncesi
        engine.eFaturaGelenAra(customizationId, start_date.getTime(), end_date);

    }

    // @Scheduled(fixedRate = 200000)
    public void scheduled4MukellefUpdate() {
        int customizationId = 0;
        engine.eFaturaMukellefGuncelle(customizationId);
    }

    @RequestMapping("EFaturaReceiverGelen")
    public void deserializeTest(HttpServletRequest request, HttpServletResponse response)
            throws JAXBException, IOException {
        Map<String, String> requestParams = AdapterUtil.getParameterMap(request);
        int customizationId = 0;

        if (!AdapterUtil.isEmpty(requestParams.get("customizationId"))) {
            try {
                customizationId = AdapterUtil.uInt(requestParams.get("customizationId"));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        int insertedInvoice = 0;
        response.setContentType("text/html; charset=UTF-8");
        insertedInvoice = engine.deserializeTest(customizationId, AdapterUtil.uDate(requestParams.get("start_dt")),
                AdapterUtil.uDate(requestParams.get("end_dt")));
        response.getWriter().write("{'success':true,'insertedInvoice':" + insertedInvoice + "}");

    }

    @RequestMapping("ShowInvoice")
    public void showInvoiceOnBrowser(HttpServletRequest request, HttpServletResponse response) throws IOException {
        byte[] pdfBytes = engine.showInvoice();

        JSONObject j = new JSONObject();
        try {
            j.put("data1", pdfBytes);
        } catch (JSONException e2) {
            // TODO Auto-generated catch block
            e2.printStackTrace();
        }
        // response.setContentType("application/json");
        PrintWriter out = response.getWriter();
        response.setContentType("application/json");
        response.setCharacterEncoding("UTF-8");
        out.print(j);
        out.flush();

        try {
            response.getWriter().write("{'success':true,'data':" + "}");
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        /*
         * response.setHeader("Content-Type", "text/plain");
         * response.setHeader("success", "yes"); PrintWriter writer =
         * response.getWriter(); writer.write(pdfBytes.toString()); writer.close();
         */
    }

}

这就是警告信息:

2018-11-12 14:54:13.580警告7784 --主ConfigServletWebServerApplicationContext :上下文初始化过程中遇到的异常-取消刷新尝试:创建名为‘appServlet’的bean时出现ConfigServletWebServerApplicationContext错误:查找方法解析失败;嵌套异常是java.lang.IllegalStateException:未能从ClassLoader sun.misc.Launcher$AppClassLoader@18b4aac2内省类com.iworkbetter.controller.AppServlet

EN

回答 1

Stack Overflow用户

发布于 2021-02-07 23:25:16

我也有同样的问题。我解决了两件事,问题解决了:

  • 我发现我在pom.xml做了一个错误。
  • 我使用Java 8运行,但使用Java 11编译。
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53260885

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档