2011-07-11 13 views
1

JRebelを使用してEclipseからローカルTomcatにマルチモジュールMavenプロジェクトをデプロイしようとしています。プロジェクトには、以下の構造を有する:JRebelを使用してEclipseからWebプロジェクトをデプロイ

root [packaging: pom] 
| 
|--- domain [packaging: jar 
| 
|--- manager [packaging: jar] 
| 
|--- web [packaging: war] 

私は3つの各モジュールでsrc/main/resources/rebel.xmlを作成しました。 Eclipse内からWebプロジェクトをTomcatに(JRebelを使用せずに)問題なく展開できます。

しかし、I change the deployment to use JRebel場合、私は次のエラーを取得:

SEVERE: Exception sending context initialized event to listener instance 
of class com.web.listeners.WebAppListener 
java.lang.IllegalArgumentException: Unknown entity: com.model.Role 
.... 
.... 
Caused by: org.hibernate.MappingException: Unknown entity: com.model.Role 

Roleは、ドメインプロジェクトから永続(JPA/Hibernateの)クラスであるが、あるWebAppListenerでそれを参照するように見えます

public class WebAppListener implements ServletContextListener, HttpSessionListener, 
     HttpSessionAttributeListener { 

    private RoleManager roleManager; 

    @Override 
    public void contextInitialized(ServletContextEvent sce) { 
     BeanFactory beanFactory = WebApplicationContextUtils. 
        getRequiredWebApplicationContext(sce.getServletContext()); 
     this.roleManager = beanFactory.getBean(RoleManager.class); 

     saveIfAbsent("USER", "Normal User"); 
    } 

    private void saveIfAbsent(String roleName, String roleDescription) { 

     if (roleManager.getRole(roleName) == null) { 
      Role role = new Role(); 
      role.setName(roleName); 
      role.setDescription(roleDescription); 
      roleManager.saveRole(role); 
     } 
    } 
} 

このコードが実行されるとdomainクラスがロードされていないように見え、任意のアイデアはどのようにこの問題を解決するために:エラーをトリガ?

答えて

2

あなたの反逆ファイルの内容は何ですか?彼らはあなたがMavenを使用している場合、あなたはまた、関連するトピックを見てとることができ

<classpath> 
    <dir name="/absolute/path/to/projectname/target/classes"></dir> 
</classpath> 

次のようになります。Getting JRebel to work with 'mvn tomcat:run'

注:rebel.xmlものsrc /メイン/リソースへの参照が含まれている場合場合によっては がいくつかのフレームワークを混乱させることがあります。エラーが発生した場合は、すべてのrebel.xmlファイルから削除してください。たとえば、次のconfは非常に一般的ですが、常に動作しない場合があります

<classpath> 
    <dir name="/absolute/path/to/projectname/target/classes"></dir> 
    <dir name="/absolute/path/to/projectname/src/main/resources"></dir> 
</classpath> 
+0

はい、そうです。 IDE内からJRebelを実行したいので、他のトピックは関係ありません。 –

0

here

を説明するように、私は、ドメインプロジェクト内rebel.xmlファイルから

<dir name="/absolute/path/to/projectname/src/main/resources"></dir> 

を削除することで問題を修正しました

関連する問題