-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 posts ] 
Author Message
 Post subject: AnnotationConfiguration problems using eclipse wtp
PostPosted: Tue May 26, 2009 4:58 am 
Newbie

Joined: Wed Mar 11, 2009 1:04 pm
Posts: 9
I'm having troubles creating a console configuration for my project using the eclipse hibernate tools. The project is a WebToolsProject in eclipse, using spring and hibernate. My hibernate configuration is Annotation Based, so i've chosen "Annotations" in the new console configuration wizard. Also, i've added the WEB-INF/classes folder (which holds my classes) to the classpath in the wizard. However, i keep getting a "ClassNotFoundException" when i finish the console configuration wizard (the classes which can't be found are my entity beans defined in the hibernate.cfg.xml).

Is there anything else i need to do to make hibernate tools find my classes in the classpath ?

thanks !


Top
 Profile  
 
 Post subject: Re: AnnotationConfiguration problems using eclipse wtp
PostPosted: Tue May 26, 2009 5:01 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Editing the classpath of the Console Configuration is the last resort - just set the related project to the project of your entities and it should work.( remember to reset the classpath if you change it on a CC you already changed)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re: AnnotationConfiguration problems using eclipse wtp
PostPosted: Tue May 26, 2009 6:21 am 
Newbie

Joined: Wed Mar 11, 2009 1:04 pm
Posts: 9
All my classes are in the same project, i've already set the Project in the CC, if that's what you mean, but i'm not quite sure if i understand you right where to set the related project.


Top
 Profile  
 
 Post subject: Re: AnnotationConfiguration problems using eclipse wtp
PostPosted: Tue May 26, 2009 7:47 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Console Configuration have a project field on the first page.

if you dont see that then you might be using a *very* old version of the plugin (i.e. 2+ years :)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re: AnnotationConfiguration problems using eclipse wtp
PostPosted: Tue May 26, 2009 8:09 am 
Newbie

Joined: Wed Mar 11, 2009 1:04 pm
Posts: 9
i have set the Project field in the first page of the wizard to the my project of course ;)

the update site from which i've installed the plugin is the following:

http://download.jboss.org/jbosstools/updates/stable/

All i did is to set the Project in the first page of the wizard, then i've set an existing hibernate config file:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.password">password</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost/testDB</property>
        <property name="hibernate.connection.username">user</property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
       
        <mapping class="com.example.model.Entity1/>
        <!-- further mapping classes ... -->
    </session-factory>
</hibernate-configuration>


Plus i've set the Type to "Annotations (jdk 1.5+)"

The exact type of the eclipse project is a combined Java/Flex project using WTP (Adobe Flex Builder 3).

Some weeks ago i have already had a working CC for this type of project, but it did not use Annotations but Mapping files.

No idea why the plugin won't find my classes though.


Top
 Profile  
 
 Post subject: Re: AnnotationConfiguration problems using eclipse wtp
PostPosted: Thu May 28, 2009 4:42 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Any errors in Error log or ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re: AnnotationConfiguration problems using eclipse wtp
PostPosted: Thu May 28, 2009 5:50 am 
Newbie

Joined: Wed Mar 11, 2009 1:04 pm
Posts: 9
This is what i get inside eclipse when i rebuild the configuration:

Code:
org.hibernate.console.HibernateConsoleRuntimeException: Could not load AnnotationConfiguration
Could not load AnnotationConfiguration
  org.hibernate.MappingException: Unable to load class declared as <mapping class="net.dubture.model.Album"/> in the configuration:
  Unable to load class declared as <mapping class="net.dubture.model.Album"/> in the configuration:
    org.hibernate.MappingException: Unable to load class declared as <mapping class="net.dubture.model.Album"/> in the configuration:
    Unable to load class declared as <mapping class="net.dubture.model.Album"/> in the configuration:
    java.lang.ClassNotFoundException: net.dubture.model.Album
    net.dubture.model.Album


And this is from the eclipse log file (which is pretty much the same i think):

Code:
org.hibernate.console.HibernateConsoleRuntimeException: Could not load AnnotationConfiguration
        at org.hibernate.console.ConsoleConfiguration.buildConfiguration(ConsoleConfiguration.java:630)
        at org.hibernate.console.ConsoleConfiguration.access$0(ConsoleConfiguration.java:619)
        at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:287)
        at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:64)
        at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:269)
        at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:112)
        at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:40)
        at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:99)
        at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:105)
        at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:234)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.hibernate.MappingException: Unable to load class declared as <mapping class="net.dubture.model.Album"/> in the configuration:
        at org.hibernate.cfg.AnnotationConfiguration.parseMappingElement(AnnotationConfiguration.java:602)
        at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1555)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1534)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1508)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1462)
        at org.hibernate.console.ConsoleConfiguration.loadConfigurationXML(ConsoleConfiguration.java:405)
        at org.hibernate.console.ConsoleConfiguration.configureStandardConfiguration(ConsoleConfiguration.java:672)
        at org.hibernate.console.ConsoleConfiguration.buildConfiguration(ConsoleConfiguration.java:624)
        ... 10 more
Caused by: java.lang.ClassNotFoundException: net.dubture.model.Album
        at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:483)
        at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:399)
        at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:387)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:87)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:164)
        at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:100)
        at org.hibernate.cfg.AnnotationConfiguration.parseMappingElement(AnnotationConfiguration.java:599)
        ... 17 more


Top
 Profile  
 
 Post subject: Re: AnnotationConfiguration problems using eclipse wtp
PostPosted: Fri Jun 05, 2009 2:36 pm 
Newbie

Joined: Fri Jun 05, 2009 2:28 pm
Posts: 1
I have the exact same problem. I had annotations (jdk 1.5+) choosen, my projects and configuration are defined. Click rebuild configuration and throw this error. I am using a mac, not sure if that matters.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory name="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
       <property name="hibernate.connection.url">jdbc:mysql://example/development</property>
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>       
        <property name="hibernate.connection.password">******</property>
        <property name="hibernate.connection.username">username</property>
        <property name="hibernate.default_schema">development</property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
       
        <property name="hibernate.show_sql">true</property>
   
        <mapping class="x.y.pojo.common.UserProfile" />
             
    </session-factory>
</hibernate-configuration>

org.hibernate.console.HibernateConsoleRuntimeException: Could not load AnnotationConfiguration
   at org.hibernate.console.ConsoleConfiguration.buildConfiguration(ConsoleConfiguration.java:533)
   at org.hibernate.console.ConsoleConfiguration.access$0(ConsoleConfiguration.java:522)
   at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:218)
   at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:64)
   at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:200)
   at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:111)
   at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:40)
   at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:99)
   at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:105)
   at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:234)
   at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.hibernate.MappingException: Unable to load class declared as <mapping class="x.y.pojo.common.UserProfile"/> in the configuration:
   at org.hibernate.cfg.AnnotationConfiguration.parseMappingElement(AnnotationConfiguration.java:602)
   at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1555)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1534)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1508)
   at org.hibernate.cfg.Configuration.configure(Configuration.java:1462)
   at org.hibernate.console.ConsoleConfiguration.loadConfigurationXML(ConsoleConfiguration.java:331)
   at org.hibernate.console.ConsoleConfiguration.configureStandardConfiguration(ConsoleConfiguration.java:575)
   at org.hibernate.console.ConsoleConfiguration.buildConfiguration(ConsoleConfiguration.java:527)
   ... 10 more
Caused by: java.lang.ClassNotFoundException: x.y.pojo.common.UserProfile
   at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:483)
   at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:399)
   at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:387)
   at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:87)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:164)
   at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:100)
   at org.hibernate.cfg.AnnotationConfiguration.parseMappingElement(AnnotationConfiguration.java:599)
   ... 17 more


Top
 Profile  
 
 Post subject: Re: AnnotationConfiguration problems using eclipse wtp
PostPosted: Mon Jun 08, 2009 8:33 am 
Newbie

Joined: Wed Mar 11, 2009 1:04 pm
Posts: 9
i'm using a mac too, guess this could narrow down the issue a bit.


Top
 Profile  
 
 Post subject: Re: AnnotationConfiguration problems using eclipse wtp
PostPosted: Tue Jun 09, 2009 4:30 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
is the class actually built ?

is the classpath correct ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re: AnnotationConfiguration problems using eclipse wtp
PostPosted: Thu Jul 02, 2009 5:38 am 
Newbie

Joined: Thu Jul 02, 2009 5:28 am
Posts: 1
I had had exactly the same problem. It turned out that I had eclipse run with 1.5 jre. but my project was compiled with compiler compliance level equal to 1.6. I solved the problem by running eclipse on jre 1.6. Hope it helps somebody.


Top
 Profile  
 
 Post subject: Re: AnnotationConfiguration problems using eclipse wtp
PostPosted: Thu Jul 02, 2009 2:29 pm 
Newbie

Joined: Thu Jul 02, 2009 2:19 pm
Posts: 1
akh wrote:
I had had exactly the same problem. It turned out that I had eclipse run with 1.5 jre. but my project was compiled with compiler compliance level equal to 1.6. I solved the problem by running eclipse on jre 1.6. Hope it helps somebody.


It seems that if the mapping classes are compiled in a newer JVM than the eclipse's one, the CC throws the ClassNotFoundException. I solved the problem as akh did, putting the same JVM to the eclipse and the eclipse's java compiler. Hope it helps


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.