-->
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.  [ 11 posts ] 
Author Message
 Post subject: ArrayIndexOutOfBoundsException thrown while building session
PostPosted: Wed Oct 22, 2003 4:15 pm 
Beginner
Beginner

Joined: Wed Oct 22, 2003 11:26 am
Posts: 31
A ProfitCenter.class when added to configuration() thorws the following stack trace :

[10/22/03 16:08:01:308 EDT] d782284 SystemErr R java.lang.ArrayIndexOutOfBoundsException: 1
[10/22/03 16:08:01:308 EDT] d782284 SystemErr R at net.sf.hibernate.persister.EntityPersister.initPropertyPaths(EntityPersister.java:918)
[10/22/03 16:08:01:308 EDT] d782284 SystemErr R at net.sf.hibernate.persister.EntityPersister.initPropertyPaths(EntityPersister.java:892)
[10/22/03 16:08:01:308 EDT] d782284 SystemErr R at net.sf.hibernate.persister.EntityPersister.postInstantiate(EntityPersister.java:113)
[10/22/03 16:08:01:339 EDT] d782284 SystemErr R at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:223)
[10/22/03 16:08:01:339 EDT] d782284 SystemErr R at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:627)
[10/22/03 16:08:01:339 EDT] d782284 SystemErr R at com.bunge.bgm.contract.business.domain.user.UserMain.configure(UserMain.java:28)
[10/22/03 16:08:01:339 EDT] d782284 SystemErr R at com.ep.TestServlet.doGet(TestServlet.java:61)
[10/22/03 16:08:01:339 EDT] d782284 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
[10/22/03 16:08:01:339 EDT] d782284 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
[10/22/03 16:08:01:339 EDT] d782284 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
[10/22/03 16:08:01:339 EDT] d782284 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
[10/22/03 16:08:01:355 EDT] d782284 SystemErr R at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
[10/22/03 16:08:01:355 EDT] d782284 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
[10/22/03 16:08:01:355 EDT] d782284 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
[10/22/03 16:08:01:355 EDT] d782284 SystemErr R at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
[10/22/03 16:08:01:355 EDT] d782284 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
[10/22/03 16:08:01:355 EDT] d782284 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:948)
[10/22/03 16:08:01:355 EDT] d782284 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:530)
[10/22/03 16:08:01:355 EDT] d782284 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
[10/22/03 16:08:01:355 EDT] d782284 SystemErr R at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
[10/22/03 16:08:01:355 EDT] d782284 SystemErr R at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:201)
[10/22/03 16:08:01:355 EDT] d782284 SystemErr R at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
[10/22/03 16:08:01:355 EDT] d782284 SystemErr R at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
[10/22/03 16:08:01:355 EDT] d782284 SystemErr R at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
[10/22/03 16:08:01:355 EDT] d782284 SystemErr R at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
[10/22/03 16:08:01:355 EDT] d782284 SystemErr R at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
[10/22/03 16:08:01:355 EDT] d782284 SystemErr R at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:431)
[10/22/03 16:08:01:355 EDT] d782284 SystemErr R at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)


The ProfitCenter.hbm.xml is :
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping schema="BGM_COMPONENTS">
<class name="com.bunge.bgm.common.domain.profitcenter.ProfitCenter" table="T_PROFIT_CENTER">
<id name="_id" column="ID">
<generator class="assigned"/>
</id>

<property name="_locationId" column="LOCATION_ID"/>
<property name="_commodityGroupId" column="COMMODITYGROUP_ID"/>
<property name="_companyId" column="COMPANY_ID"/>

<property name="_shortName" column="SHORTNAME"/>
<property name="_longName" column="LONGNAME"/>
<property name="_active" column="ACTIVE"/>
<property name="_comments" column="COMMENTS"/>

<property name="_createdBy" column="CREATED_BY"/>
<property name="_createdOn" column="CREATED_ON"/>
<property name="_updatedBy" column="UPDATED_BY"/>
<property name="_updatedOn" column="UPDATED_ON"/>



</class>

</hibernate-mapping>
<!-- parsed in 0ms -->

the configure() method is :
public void configure() throws HibernateException {
_sessions = new Configuration().addClass(ProfitCenter.class).buildSessionFactory();
}



I have tried to test many other classes but only ProfitCenter is failing and i am not able to figure out the reason. Can anyone please help. Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 22, 2003 11:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Do you really have methods like get_id() and get_locationId()? Those name attributes of the property elements need to reference the JavaBean-style property names for you class


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 23, 2003 7:57 am 
Beginner
Beginner

Joined: Wed Oct 22, 2003 11:26 am
Posts: 31
yes those methoda are there......
here is the ProfitCenter.java

package com.bunge.bgm.common.domain.profitcenter;

import com.bunge.bgm.common.domain.BGMCoreEntity;
import com.bunge.bgm.common.domain.commodity.CommodityGroup;

public class ProfitCenter extends BGMCoreEntity
{
private String _commodityGroupId;
private String _companyId;
private String _locationId;
private String _longName;
private String _active;
private String _comments;

public ProfitCenter()
{

}

public Object get_id() {
return _id;
}

public void set_id(Object a_id) {
_id = a_id;
}

public String get_commodityGroupId()
{
return _commodityGroupId;
}
public String get_updatedBy() {
return _updatedBy;
}

public void set_updatedBy(String a_updatedBy) {
_updatedBy = a_updatedBy;
}
public Date get_updatedOn() {
return _updatedOn;
}

public void set_updatedOn(Date a_updatedOn) {
_updatedOn = a_updatedOn;
}

public String get_createdBy() {
return _createdBy;
}

public void set_createdBy(String a_createdBy) {
_createdBy = a_createdBy;
}

public Date get_createdOn() {
return _createdOn;
}

public void set_createdOn(Date a_createdOn) {
_createdOn = a_createdOn;
}

public void set_commodityGroupId(String a_commodityGroupId)
{
_commodityGroupId = a_commodityGroupId;
}

public String get_longName()
{
return _longName;
}

public void set_longName(String a_longName)
{
_longName = a_longName;
}

public String get_active() {
return _active;
}
public void set_active(String a_active) {
_active = a_active;
}
public String get_comments() {
return _comments;
}
public void set_comments(String a_comments) {
_comments = a_comments;
}

public String get_companyId()
{
return _companyId;
}

public void set_companyId(String a_companyId)
{
_companyId = a_companyId;
}

public String get_locationId()
{
return _locationId;
}

public void set_locationId(String a_locationId)
{
_locationId = a_locationId;
}
}


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 23, 2003 7:58 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
What is the reason for that strange (but funny) naming convention?

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 23, 2003 8:00 am 
Beginner
Beginner

Joined: Wed Oct 22, 2003 11:26 am
Posts: 31
it was generated by Rational Rose.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 23, 2003 9:12 am 
Beginner
Beginner

Joined: Wed Oct 22, 2003 11:26 am
Posts: 31
Someone please help. This issue is really bugging and i need to get this done for a delivery. Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 23, 2003 9:18 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Remove the underscores and make real property accessors: "get" or "set", followed by first letter uppercase, then lowercase. Your code is broken, not only visually. Don't use underscores for private scoped members (better) or get Rational Rose not to generate accessors with underscores.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 23, 2003 9:29 am 
Beginner
Beginner

Joined: Wed Oct 22, 2003 11:26 am
Posts: 31
Christian i have no problem in changing the naming convention but i have at least 10 classes with the same convention and only this one is failing and it forced me to think in other directions. But still no success, other classes i have tested and they all work fine but this one is not even allowing me to add to configuration() method.
Whenever i say addClass(ProfitCenter.class) to build session factory it doesnt even allow me to build the session factory. i dont know what to do.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 23, 2003 9:34 am 
Beginner
Beginner

Joined: Wed Oct 22, 2003 11:26 am
Posts: 31
Christian, How can i get all the debug statements in the log file ? I tried configuring log4j.properties in hibernate2.jar and recreated the jar. But it didnt create hibernate.log file. Is there any other way i can drill down to the issue i am facing ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 23, 2003 9:41 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Look, most developers have a procedure they call "finding an error". This involves isolating the problem. Does it fail if you only map the class without any properties? If you then add each property step by step, when does it fail? Once you have the property isolated, what can be wrong with that particular property?

All of this takes about 5 minutes. The reason why you don't get an answer on the forum is simply that it would take me (or anyone else) much longer (the error is propably not in the code you have shown and we don't have the rest of your project) and, frankly, there is no reason why we should do your work.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 23, 2003 9:43 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Put a log4j.properties in your classpath and check your System.out:

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern= %5p - %C{1} - %m%n

log4j.rootLogger=info, stdout
log4j.logger.net.sf.hibernate=debug

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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