0

I've tested multiple times some strange behavior exhibited by Google Plugin for Eclipse (GPE) when running a project both a JPA facet persisting to Google Cloud SQL and GWT. I'm using Eclipse 3.7 Indigo, AppEngine 1.6.5, EclipseLink 2.3 JPA, and GWT 2.4.0.

I successfully set up JPA 2.0 with GPE following the directions . Then, once that's working, I then try to check "use GWT" in the GPE "Google" menu for the project. At that very point, JPA persistence to the Google Cloud SQL breaks. This is reversible by unchecking "use GWT", luckily. I'm using the Cloud SQL for development, not the local MySQL. I want to test that next.

Here is my stacktrace for the connection error that pops up after checking "use GWT". The short of it is: "java.lang.NoClassDefFoundError: Could not initialize class sun.security.pkcs11.SunPKCS11".

    [EL Severe]: 2012-06-13 02:47:02.408--ServerSession(4315167)--com.google.apphosting.api.ApiProxy$UnknownException: An error occurred for the API request rdbms.OpenConnection().
Jun 13, 2012 2:47:02 AM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: /jpatest
javax.persistence.PersistenceException: com.google.apphosting.api.ApiProxy$UnknownException: An error occurred for the API request rdbms.OpenConnection().
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:517)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:294)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:272)
    at com.myproject.JpatestServlet.doGet(JpatestServlet.java:14)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    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 com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:35)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:60)
    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 com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java:97)
    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.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:78)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:369)
    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.HttpParser.parseNext(HttpParser.java:547)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: com.google.apphosting.api.ApiProxy$UnknownException: An error occurred for the API request rdbms.OpenConnection().
    at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.callInternal(ApiProxyLocalImpl.java:518)
    at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.call(ApiProxyLocalImpl.java:452)
    at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.call(ApiProxyLocalImpl.java:430)
    at java.util.concurrent.Executors$PrivilegedCallable$1.run(Executors.java:493)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.util.concurrent.Executors$PrivilegedCallable.call(Executors.java:490)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class sun.security.pkcs11.SunPKCS11
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
    at sun.security.jca.ProviderConfig$3.run(ProviderConfig.java:262)
    at sun.security.jca.ProviderConfig$3.run(ProviderConfig.java:244)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.security.jca.ProviderConfig.doLoadProvider(ProviderConfig.java:244)
    at sun.security.jca.ProviderConfig.getProvider(ProviderConfig.java:224)
    at sun.security.jca.ProviderList.getProvider(ProviderList.java:232)
    at sun.security.jca.ProviderList.getService(ProviderList.java:330)
    at sun.security.jca.GetInstance.getInstance(GetInstance.java:157)
    at java.security.Security.getImpl(Security.java:696)
    at java.security.AlgorithmParameters.getInstance(AlgorithmParameters.java:130)
    at sun.security.x509.AlgorithmId.decodeParams(AlgorithmId.java:121)
    at sun.security.x509.AlgorithmId.<init>(AlgorithmId.java:114)
    at sun.security.x509.AlgorithmId.parse(AlgorithmId.java:381)
    at sun.security.x509.X509Key.parse(X509Key.java:168)
    at sun.security.x509.CertificateX509Key.<init>(CertificateX509Key.java:75)
    at sun.security.x509.X509CertInfo.parse(X509CertInfo.java:705)
    at sun.security.x509.X509CertInfo.<init>(X509CertInfo.java:169)
    at sun.security.x509.X509CertImpl.parse(X509CertImpl.java:1747)
    at sun.security.x509.X509CertImpl.<init>(X509CertImpl.java:196)
    at sun.security.provider.X509Factory.engineGenerateCertificate(X509Factory.java:107)
    at java.security.cert.CertificateFactory.generateCertificate(CertificateFactory.java:322)
    at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:763)
    at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:55)
    at java.security.KeyStore.load(KeyStore.java:1201)
    at com.google.appengine.api.urlfetch.dev.LocalURLFetchService.getTrustStore(LocalURLFetchService.java:190)
    at com.google.appengine.api.urlfetch.dev.LocalURLFetchService.createValidatingScheme(LocalURLFetchService.java:206)
    at com.google.appengine.api.urlfetch.dev.LocalURLFetchService.createHttpClient(LocalURLFetchService.java:252)
    at com.google.appengine.api.urlfetch.dev.LocalURLFetchService.init(LocalURLFetchService.java:298)
    at com.google.appengine.tools.development.ApiProxyLocalImpl.startServices(ApiProxyLocalImpl.java:581)
    at com.google.appengine.tools.development.ApiProxyLocalImpl.access$700(ApiProxyLocalImpl.java:46)
    at com.google.appengine.tools.development.ApiProxyLocalImpl$2.run(ApiProxyLocalImpl.java:564)
    at com.google.appengine.tools.development.ApiProxyLocalImpl$2.run(ApiProxyLocalImpl.java:562)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.google.appengine.tools.development.ApiProxyLocalImpl.getService(ApiProxyLocalImpl.java:561)
    at com.google.appengine.tools.development.ApiProxyLocalImpl.resolveDeadline(ApiProxyLocalImpl.java:233)
    at com.google.appengine.tools.development.ApiProxyLocalImpl.doAsyncCall(ApiProxyLocalImpl.java:214)
    at com.google.appengine.tools.development.ApiProxyLocalImpl.makeSyncCall(ApiProxyLocalImpl.java:147)
    at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:105)
    at com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchServiceImpl.java:37)
    at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.fetchResponse(URLFetchServiceStreamHandler.java:418)
    at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.getInputStream(URLFetchServiceStreamHandler.java:297)
    at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.getResponseCode(URLFetchServiceStreamHandler.java:150)
    at com.google.api.client.http.javanet.NetHttpResponse.<init>(NetHttpResponse.java:37)
    at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:89)
    at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:814)
    at com.google.cloud.sql.jdbc.internal.googleapi.RpcGoogleApi$DefaultGoogleApi.execImpl(RpcGoogleApi.java:346)
    at com.google.cloud.sql.jdbc.internal.googleapi.RpcGoogleApi$DefaultGoogleApi.exec(RpcGoogleApi.java:322)
    at com.google.cloud.sql.jdbc.internal.googleapi.RpcGoogleApi.openConnection(RpcGoogleApi.java:100)
    at com.google.appengine.api.rdbms.dev.LocalRdbmsServiceRemoteDriver.openConnection(LocalRdbmsServiceRemoteDriver.java:206)
    at com.google.appengine.api.rdbms.dev.LocalRdbmsService.openConnection(LocalRdbmsService.java:119)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.callInternal(ApiProxyLocalImpl.java:498)
    ... 10 more

and here are my connection parameters in the Eclipse run configuration, after adding in GWT:

    -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -codeServerPort 9997 -war /home/eric/workspace/jpatest/war -server com.google.appengine.tools.development.gwt.AppEngineLauncher -port 8888 com.myproject.jpatest
Just JPA: --port=8888 /home/eric/workspace/jpatest/war


VM
-Drdbms.password= -Drdbms.user= -Drdbms.database=compass -Drdbms.hosted.instance=ejahn.net:openciss:compasslight -Drdbms.server=hosted -Xmx512m -javaagent:/home/eric/eclipse/appengine-java-sdk-1.6.5/lib/agent/appengine-agent.jar

Thanks in advance for any insight. I'll try to share this with Google as well, since I think it is something they ultimately need to be aware of.

4

1 回答 1

0

我终于让它工作了。我实际上不确定最终修复是什么,但确保我的驱动程序在 Eclipse 的数据库开发透视图中都连接良好,确保我的 persistence.xml 没有从原始(下)更改,删除任何 IDE投诉/错误/警告,并确保我的持久性单元被正确定义就可以了。很多活动部件......感谢您的鼓励和想法,jonasr!

<property name="javax.persistence.jdbc.driver" value="com.google.appengine.api.rdbms.AppEngineDriver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:google:rdbms://mydomain.net:myappengine:myinstance/mydb"/>
<property name="javax.persistence.jdbc.user" value=""/>
<property name="javax.persistence.jdbc.password" value=""/> 
于 2012-06-14T13:51:54.187 回答