2012-03-13 20 views
1

GWT + hibernate4 + Apache Tomcatを使用して簡単なWebアプリケーションを開発しようとしています。 今私は(最初にデフォルトのApp Engineサーバーを使用して)休止状態GWT &と私のシンプルなクラスを書かれているが、サーバーにデータを送信しながら、私はエラーを取得し、クラスにJava + Hibernate4 + GWT + App Engine = InitialContextエラー

public class HibernateUtil { 
private static SessionFactory sessionFactory; 
private static ServiceRegistry serviceRegistry; 

static SessionFactory getSessionFactory() throws HibernateException { 
    Configuration configuration = new Configuration(); 
    configuration.configure(); 
    serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();   
    sessionFactory = configuration.buildSessionFactory(serviceRegistry); 
    return sessionFactory; 
} 

}

をarrises whch

行のsessionFactory = configuration.buildSessionFactory(serviceRegistry); ここでスタックトレース

java.lang.NoClassDefFoundError: javax.naming.InitialContext is a restricted class. Please see the Google App Engine developer's guide for more details. 
    at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51) 
at org.hibernate.service.jndi.internal.JndiServiceImpl.buildInitialContext(JndiServiceImpl.java:77) 
at org.hibernate.service.jndi.internal.JndiServiceImpl.bind(JndiServiceImpl.java:107) 
at org.hibernate.internal.SessionFactoryRegistry.addSessionFactory(SessionFactoryRegistry.java:79) 
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:440) 
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737) 
at ru.leti.alexeeva.server.HibernateUtil.getSessionFactory(HibernateUtil.java:17) 

はラウンドどのような方法がありますか?何が起こっている

答えて

1

は、それが言うまさにです:

「java.lang.NoClassDefFoundErrorが:。のjavax.naming.InitialContextが制限されたクラスです詳細はGoogleのApp Engineの開発者ガイドを参照してください。」

Google App EngineのJREホワイトリストのため、あなたのコードはそのままですぐに実行されることはありません。つまり、Tomcatのような「スタンドアロン」のJavaアプリケーションサーバーを実行できるすべてのJavaクラスとライブラリを使用することはできません。

http://code.google.com/appengine/docs/java/jrewhitelist.html

+0

ので:

は、Javaクラスは、GoogleのApp Engine上で動作するアプリケーションで使用することが許可されているの正確なリストを参照してください?解決策は何ですか?どのようにしてgae + cloudsqlでhibernateを使用することができますか? @FabioB。 –

+1

http://blog.essaytagger.com/2011/11/spring-hibernate-on-google-app-engines.html – alex

+0

解決方法がこの質問に行くことがわかっているのでhttp://stackoverflow.com/questions/9783773/spring -autowiring-stopped-working-on-gaeと完全な答えで私の50の賞金ポイントを取る! :D –

関連する問題