使用Eclipse GPE添加GWT Breaks Cloud SQL JPA

时间:2012-06-13 17:34:44

标签: gwt eclipse-plugin jpa-2.0 google-apps google-cloud-sql

我已经多次测试了Google Plugin for Eclipse(GPE)展示的一些奇怪的行为,这些行为同时运行了一个持久存在Google Cloud SQL和GWT的JPA方面。我正在使用Eclipse 3.7 Indigo,AppEngine 1.6.5,EclipseLink 2.3 JPA和GWT 2.4.0。

我在directions之后使用GPE成功设置了JPA 2.0。然后,一旦它工作,我然后尝试检查项目的GPE“Google”菜单中的“使用GWT”。在那一点上,JPA对Google Cloud SQL的持久性打破了。幸运的是,取消选中“使用GWT”是可逆的。我正在使用Cloud SQL进行开发,而不是使用本地MySQL。我想测试下一步。

这是我检查“使用GWT”后弹出的连接错误的堆栈跟踪。缺点是:“java.lang.NoClassDefFoundError:无法初始化类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

这是我在Eclipse运行配置中的连接参数,在添加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

提前感谢任何见解。我也会尝试与谷歌分享这个,因为我认为这是他们最终需要注意的事情。

1 个答案:

答案 0 :(得分: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=""/>