我以前看过这个问题,但似乎找不到可靠的解决方案。截至目前,Google App Engine 不支持 java.util.logging.Logger 的子类。我在使用 Base CRM API(此处的信息: https ://github.com/basecrm/basecrm-java )将联系人输入到我的 CRM的 java 端点中有一些代码。在 locahost 环境中使用它进行测试时,这可以按预期工作,但是一旦部署它就不喜欢 Base API 正在执行的日志记录。这是我从 GAE 得到的错误:
java.lang.SecurityException: Google App Engine does not support subclasses of java.util.logging.Logger: com/getbase/http/jersey/HttpClient$Slf4jAdapter
at com.google.appengine.runtime.Request.process-bbdc1f6d27729bc9(Request.java)
at java.lang.ClassLoader.loadClass(ClassLoader.java:375)
at com.getbase.http.jersey.HttpClient.<init>(HttpClient.java:31)
at com.getbase.Client.<init>(Client.java:34)
at com.nicholas.leadsbackend.LeadsServlet.sendToBase(LeadsServlet.java:90)
at com.nicholas.leadsbackend.LeadsServlet.doPost(LeadsServlet.java:61)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:453)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:460)
at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:293)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:319)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:311)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:457)
at java.lang.Thread.run(Thread.java:745)
这是我的端点中发送到基础的代码:
Client client = new Client(new Configuration.Builder()
.accessToken(BASECRM_ACCESS_TOKEN)
.verbose()
.build());
Contact contact = new Contact();
contact.setName(name);
contact.setPhone(phone);
contact.setEmail(email);
contact.setDescription("Make/Model/Year: " + make + "\n" +
"Type of Ad: " + adType);
client.contacts().create(contact);
API 代码是非常简单的代码,这里不是问题。我的问题是 CRM API 需要此依赖项compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.21'
才能正常工作,否则会引发错误。
请让我知道是否有任何方法可以为 GAE 解决此问题。我正在寻找除 GAE 之外的其他选项,因为其他选项可能没有严格的日志记录规则。我知道这也是一种特殊情况,因为它是导致我出现问题的额外 API,但任何见解都会非常有帮助。提前致谢!