1

私はサンプルクラスを書きます。

package org.openId.appengine;

import com.google.step2.xmlsimplesign.TrustRootsProvider;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.security.cert.X509Certificate;
import java.util.Collection;
import java.util.logging.Logger;

import org.ritesh.SampleGoogleAppServlet;

public class AppEngineTrustsRootProvider implements TrustRootsProvider {

  private static final String CERT_FILE = "cacerts.bin";

  private final Collection<X509Certificate> certs;
  private static final Logger log = Logger.getLogger(SampleGoogleAppServlet.class.getName()); 

  @SuppressWarnings("unchecked")
  public AppEngineTrustsRootProvider() {

    try {
      ObjectInputStream in =
          new ObjectInputStream(AppEngineTrustsRootProvider.class.getResourceAsStream(CERT_FILE));
      log.info("Coming here");
      certs = (Collection<X509Certificate>) in.readObject();
    } catch (IOException e) {
      throw new RuntimeException(e);
    } catch (ClassNotFoundException e) {
      throw new RuntimeException(e);
    }
  }

  public Collection<X509Certificate> getTrustRoots() {
    return certs;
  }
}

プロジェクトをGoogle App Engineにデプロイすると、エラーが発生します

2013-09-02 07:43:45.852
Uncaught exception from servlet
javax.servlet.UnavailableException: com.google.inject.ProvisionException: Guice provision errors:

1) Error injecting constructor, java.lang.NullPointerException
  at org.openId.appengine.AppEngineTrustsRootProvider.<init>(AppEngineTrustsRootProvider.java:21)
  while locating org.openId.appengine.AppEngineTrustsRootProvider
  while locating com.google.step2.xmlsimplesign.TrustRootsProvider
    for parameter 0 at com.google.step2.xmlsimplesign.CachedCertPathValidator.<init>(CachedCertPathValidator.java:61)
  while locating com.google.step2.xmlsimplesign.CachedCertPathValidator
    for parameter 0 at com.google.step2.xmlsimplesign.Verifier.<init>(Verifier.java:51)
  while locating com.google.step2.xmlsimplesign.Verifier
    for parameter 1 at com.google.step2.discovery.LegacyXrdsResolver.<init>(LegacyXrdsResolver.java:91)
  while locating com.google.step2.discovery.LegacyXrdsResolver
  while locating com.google.step2.discovery.XrdDiscoveryResolver
    for parameter 1 at com.google.step2.discovery.Discovery2.<init>(Discovery2.java:167)
  while locating com.google.step2.discovery.Discovery2
    for parameter 1 at com.google.step2.ConsumerHelper.<init>(ConsumerHelper.java:60)
  while locating com.google.step2.ConsumerHelper

1 error
    at org.mortbay.jetty.servlet.ServletHolder.makeUnavailable(ServletHolder.java:415)
    at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:458)
    at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:125)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:35)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    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 com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:266)
    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 com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:146)
    at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:439)
    at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:435)
    at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:442)
    at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:186)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:306)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:298)
    at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:439)
    at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:251)
    at java.lang.Thread.run(Thread.java:722)

このエラーに直面している理由とそれを削除する方法。AppEngineTrustsRootProvider.java と同じパッケージのコーディング ディレクトリに cacert.bin ファイルを追加しました。このエラーに直面している理由とそれを削除する方法を教えてください。

編集:どのjarファイルについて話しているのか、jarファイルからディレクトリリストの意味がわかりませんでしたが、Eclipseでのプロジェクトのディレクトリ構造を示すスクリーンショットを投稿しました ここに画像の説明を入力

4

0 に答える 0