-->
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.  [ 3 posts ] 
Author Message
 Post subject: java.lang.NoSuchMethodError: javax.persistence.Table.indexes
PostPosted: Wed Jul 23, 2014 7:15 am 
Newbie

Joined: Wed Jul 23, 2014 6:28 am
Posts: 1
Hi Team,

I am trying to use hibernate 4 and jpa 2.1 for connecting oracle database through weblogic JNDI in a standalone application and i face the below issue.

-------------------------------------------------------------------------------
Jul 23, 2014 3:56:16 PM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [
name: JPASamplesPU
...]
Jul 23, 2014 3:56:16 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.3.6.Final}
Jul 23, 2014 3:56:16 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Jul 23, 2014 3:56:16 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Jul 23, 2014 3:56:16 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.4.Final}
Jul 23, 2014 3:56:23 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
Exception in thread "main" java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
at org.hibernate.cfg.annotations.EntityBinder.processComplementaryTableDefinitions(EntityBinder.java:936)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:824)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3788)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3742)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1410)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1844)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:843)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:842)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:75)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
at test.JPATest.main(JPATest.java:39)

---------------------------------------------------------------------------------

Jars used:
dom4j-1.6.1.jar
hibernate-commons-annotations-4.0.4.jar
hibernate-core-4.3.6.jar
hibernate-entitymanager-4.3.6.jar
hibernate-jpa-2.1-api.jar
jandex1.1.0.jar
javaassist-3.18.1.jar
jboss-logging-3.1.3.jar
ojdbc6.jar
weblogic.jar

java: 1.6

Persistence.xml
---------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="JPASamplesPU" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.dialect"
value="org.hibernate.dialect.Oracle10gDialect" />
<property name="hibernate.connection.datasource"
value="MPAYUBIAPI" />
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.WeblogicTransactionManagerLookup" />

<property name="hibernate.transaction.jta.platform"
value="org.hibernate.service.jta.platform.internal.WeblogicJtaPlatform" />
<property name="hibernate.transaction.factory.class"
value="org.hibernate.transaction.JTATransactionFactory" />
<property name="hibernate.hibernate.session_factory_name"
value="session_factory" />

<property name="hibernate.jndi.class"
value="weblogic.jndi.WLInitialContextFactory" />

<property name="hibernate.jndi.url"
value="t3://10.44.66.121:7010" />

<property name="hibernate.current_session_context_class"
value="jta" />

<property name="hibernate.jta.UserTransaction"
value="weblogic.transaction.UserTransaction" />

<property name="hibernate.generate_statistics"
value="false" />

<property name="hibernate.connection.release_mode"
value="auto" />

</properties>
</persistence-unit>
</persistence>

---------------------------------------------
Pojo:

package com.test.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;


@Entity
@Table(name = "ACC_TYPE")
public class AccType {

private String accType;
private String accTypeDesc;

/**
* @return the accType
*/
@Id
@Column(name = "ACC_TYPE")
public String getAccType() {
return accType;
}
/**
* @param accType the accType to set
*/
public void setAccType(String accType) {
this.accType = accType;
}
/**
* @return the accTypeDesc
*/
@Column(name = "ACC_TYPE_DESC")
public String getAccTypeDesc() {
return accTypeDesc;
}
/**
* @param accTypeDesc the accTypeDesc to set
*/
public void setAccTypeDesc(String accTypeDesc) {
this.accTypeDesc = accTypeDesc;
}
}

Request your help in resolving the issue.


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchMethodError: javax.persistence.Table.indexes
PostPosted: Wed Jul 30, 2014 7:45 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Is it possible this version of WebLogic doesn't support the JPA 2.1 API ?

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchMethodError: javax.persistence.Table.indexes
PostPosted: Tue Aug 19, 2014 4:32 pm 
Newbie

Joined: Tue Aug 19, 2014 4:14 pm
Posts: 2
I am guessing WebLogic has JPA 2.0 classes somewhere in the classpath already which supersede the 2.1 jar you are including. I had the same problem with Resin. That error is definitely a method added in 2.1 since 2.0.

To fix this in Resin, I edited the j2ee.jar that came with Resin to remove the javax.persistence package.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.