带有Hibernate的Google App Engine java.security.AccessControlException:访问被拒绝(“java.lang.RuntimePermission”“modifyThreadGroup”)

时间:2014-02-16 12:14:23

标签: java eclipse hibernate google-app-engine

所以从这里的其他主题和谷歌开发网站我把以下内容放在一起 - 启用了Google App Engine - 检查SQL云 - 设置我的开发人员实例以指向MySQL - 将mysql-connector-java-5.1.0-bin.jar添加到\ eclipse \ plugins \ com.google.appengine.eclipse.sdkbundle_1.8.9 \ appengine-java-sdk-1.8.9 \ lib \ impl文件夹

这为Googles rdbms

创建了以下VM Args
-Drdbms.url=jdbc:mysql://localhost:3306/rent1?user=APP_WEB_RENT1 
-Drdbms.driver=com.mysql.jdbc.Driver 
-Drdbms.server=local -Drdbms.password="" 
-Drdbms.user="APP_WEB_RENT1" 
-Drdbms.database="rent1" 
-javaagent:C:\Tools\eclipse\plugins\com.google.appengine.eclipse.sdkbundle_1.8.9\appengine-java-sdk-1.8.9\lib\agent\appengine-agent.jar 
-Ddatastore.default_high_rep_job_policy_unapplied_job_pct=50 
-Xmx512m 
-XX:-UseSplitVerifier

所以在hibernate.cfg.xml中我使用了RDBMS驱动程序

<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.google.appengine.api.rdbms.AppEngineDriver</property>

        <!-- Connect to rent1 -->
<property name="hibernate.connection.url">jdbc:google:rdbms://localhost:3306/rent1</property>
<property name="hibernate.connection.username">APP_WEB_RENT1</property>
<property name="hibernate.connection.password"></property>

因此Google应用引擎驱动程序现在应该采用此方法并根据我的开发实例I设置加载MySQL驱动程序。通过我在谷歌和其他网站上阅读的内容,这应该有效。但是会出现以下错误,

答案did not fix the issue

  

java.security.AccessControlException:访问被拒绝   (&#34; java.lang.RuntimePermission&#34;&#34; modifyThreadGroup&#34;)at   java.security.AccessControlContext.checkPermission(AccessControlContext.java:366)     在   java.security.AccessController.checkPermission(AccessController.java:560)     在   java.lang.SecurityManager.checkPermission(SecurityManager.java:549)     在   com.google.appengine.tools.development.DevAppServerFactory $ CustomSecurityManager.checkPermission(DevAppServerFactory.java:431)     在   com.google.appengine.tools.development.DevAppServerFactory $ CustomSecurityManager.checkAccess(DevAppServerFactory.java:456)     在java.lang.ThreadGroup.checkAccess(ThreadGroup.java:315)at   java.lang.Thread.init(Thread.java:376)at   java.lang.Thread。(Thread.java:652)at   java.util.concurrent.Executors $ DefaultThreadFactory.newThread(Executors.java:572)     在   java.util.concurrent.ThreadPoolExecutor中的$工人。(ThreadPoolExecutor.java:610)     在   java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:924)     在   java.util.concurrent.ThreadPoolExecutor.ensurePrestart(ThreadPoolExecutor.java:1590)     在   java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:333)     在   java.util.concurrent.ScheduledThreadPoolExecutor.scheduleWithFixedDelay(ScheduledThreadPoolExecutor.java:594)     在   java.util.concurrent.Executors $ DelegatedScheduledExecutorService.scheduleWithFixedDelay(Executors.java:698)     在   org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:110)     在   org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:89)     在   org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:206)     在   org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:178)     在   org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:260)     在   org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:94)     在   org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:89)     在   org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:206)     在   org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:178)     在   org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1885)     在   org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1843)     在   org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1928)     在   com.rent1.utils.HibernateUtil.getSessionFactory(HibernateUtil.java:29)     在com.rent1.utils.HibernateUtil。(HibernateUtil.java:14)at   com.rent1.utils.HibernateUtil.getInstance(HibernateUtil.java:19)at   com.rent1.Rent1Servlet.doGet(Rent1Servlet.java:28)at   javax.servlet.http.HttpServlet.service(HttpServlet.java:617)at at   javax.servlet.http.HttpServlet.service(HttpServlet.java:717)at at   org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)     在   org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1166)     在   com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74)     在   org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)     在   com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:123)     在   org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)     在   com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)     在   org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)     在   com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)     在   org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)     在   com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)     在   org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)     在   com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125)     在   org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)     在   com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366)     在   com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349)     在   com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116)     在   org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)     在   org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)     在   org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)     在   org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)     在   org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)     在   org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)     在   com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:97)     在   org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)     在   com.google.appengine.tools.development.JettyContainerService $ ApiProxyHandler.handle(JettyContainerService.java:487)     在   org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)     在org.mortbay.jetty.Server.handle(Server.java:326)处   org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)     在   org.mortbay.jetty.HttpConnection $ RequestHandler.headerComplete(HttpConnection.java:923)     在org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)at at   org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)at at   org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)at at   org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)     在   org.mortbay.thread.QueuedThreadPool $ PoolThread.run(QueuedThreadPool.java:582)

1 个答案:

答案 0 :(得分:0)

将此添加到您的web.xml:

<context-param>
  <param-name>com.sun.faces.enableThreading</param-name>
  <param-value>false</param-value>
</context-param>