[jbosstools-issues] [JBoss JIRA] (JBIDE-18575) Unable to generate entities when JPA 2.0 is used

Jiri Peterka (JIRA) issues at jboss.org
Fri Oct 10 09:51:11 EDT 2014


    [ https://issues.jboss.org/browse/JBIDE-18575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13010667#comment-13010667 ] 

Jiri Peterka commented on JBIDE-18575:
--------------------------------------

As this issue needs after all these additional prerequisite steps to be replicated:

Steps:
* create new workspace
* create new maven project
* select 'Create a simple project'
* after it's created, paste the project data from my comment in the pom.xml, but comment out the logging dependencies
* update the Maven project configuration (select the project the project explorer and ALT + F5)
* convert project to faceted form
* enable the JPA facet (2.1)
* click the 'further configuration required' link
* select Hibernate (JPA 2.1) for Platform
* select 'Disable Library Configuration' for Type in JPA implementation
* select 'Add connection...'
* create new sakila connection 
* select 'Discover annotated classes automatically'
* (no persistence.xml manually created, just the Eclipse generated one)
{code}
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
	<persistence-unit name="JBIDE-14305">
	</persistence-unit>
</persistence>
{code}
* open the Hibernate configurations view
* right click, select add new configuration
* in the main tab, select JPA, Hibernate version 4.3, our project, the previously defined db connection and the 'JBIDE-14305' persistence unit, finish
* expand the new hibernate config, expand database, the databases should be visible
* in pom.xml enable the logging deps
* clean/build project
* rebuild the hibernate config
* right click on the project, select 'Generate entities from tables' from JPA tools (select the hibernate config)

So far it should work thanks to last fixes

Now change the project to JPA 2.0 
* Facets to JPA 2.0 (Platform to JPA 2.0) 
* Hibernate configuration to Hibernate 4.0
* pom.xml to JPA 2.0 (Hibernate ORM to 4.0.0.Final, JPA 2.1 -> 2.0)
* Update maven project, clean the project
* right click on the project, select 'Generate entities from tables' from JPA tools (select the hibernate config)

You should see NoClassDefFoundError error

Then you will be unable to generate code until you restart IDE

{code}
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>sample</groupId>
	<artifactId>JBIDE-14305</artifactId>
	<version>0.0.1-SNAPSHOT</version>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

		<slf4j.version>1.7.7</slf4j.version>

		<hibernate-orm.version>4.3.5.Final</hibernate-orm.version>
	</properties>

	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<artifactId>maven-compiler-plugin</artifactId>
					<version>3.1</version>
					<configuration>
						<source>1.7</source>
						<target>1.7</target>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>

	<dependencies>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-entitymanager</artifactId>
			<version>${hibernate-orm.version}</version>
			<scope>runtime</scope>
			<exclusions>
				<exclusion>
					<groupId>xml-apis</groupId>
					<artifactId>xml-apis</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.javassist</groupId>
			<artifactId>javassist</artifactId>
			<version>3.18.2-GA</version>
		</dependency>
		<dependency>
			<groupId>org.hibernate.javax.persistence</groupId>
			<artifactId>hibernate-jpa-2.1-api</artifactId>
			<version>1.0.0.Final</version>
		</dependency>
		<!-- logging -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>${slf4j.version}</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>jcl-over-slf4j</artifactId>
			<version>${slf4j.version}</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>${slf4j.version}</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.17</version>
			<scope>runtime</scope>
		</dependency>
	</dependencies>
</project>
{code}

> Unable to generate entities when JPA 2.0 is used
> ------------------------------------------------
>
>                 Key: JBIDE-18575
>                 URL: https://issues.jboss.org/browse/JBIDE-18575
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: hibernate
>    Affects Versions: 4.2.0.CR2
>         Environment: JBDS 8.0.0.CR2
>            Reporter: Jiri Peterka
>              Labels: respin-a
>             Fix For: 4.2.0.CR2
>
>
> org.hibernate.console.HibernateConsoleRuntimeException: Received a NoClassDefFoundError, probably the console configuration classpath is incomplete or contains conflicting versions of the same class
> Received a NoClassDefFoundError, probably the console configuration classpath is incomplete or contains conflicting versions of the same class
> org.hibernate.console.HibernateConsoleRuntimeException: Received a NoClassDefFoundError, probably the console configuration classpath is incomplete or contains conflicting versions of the same class
> Received a NoClassDefFoundError, probably the console configuration classpath is incomplete or contains conflicting versions of the same class
> java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.tool.Version
> Could not initialize class org.hibernate.tool.Version



--
This message was sent by Atlassian JIRA
(v6.3.1#6329)


More information about the jbosstools-issues mailing list