-->
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.  [ 14 posts ] 
Author Message
 Post subject: session.load() and joined-subclass error
PostPosted: Mon Jul 19, 2004 9:52 am 
Newbie

Joined: Wed Jun 16, 2004 8:26 am
Posts: 19
Hi all,

i need some explanation of the following error:
Code:
IllegalArgumentException occurred calling getter of com.tecdoc.db_update.hibernate.Bean_Update_Installation.idInstall
and
java.lang.IllegalArgumentException: object is not an instance of declaring class


This error occurs when i call this method:
Code:
    public static Bean_Update_Installation loadInstall(Integer id)
            throws IOException, ServletException, HibernateException {

        Session hibernate_session = HibernateUtil.currentSession();
        Transaction tx = hibernate_session.beginTransaction();
        Bean_Update_Installation inst = new Bean_Update_Installation();

        try {
            tx = hibernate_session.beginTransaction();

            inst = (Bean_Update_Installation) hibernate_session.load(
                    Bean_Update_Installation.class, id);
            tx.commit();

        } catch (Exception e) {
            e.printStackTrace(System.err);
            if (tx != null)
                tx.rollback();
        } finally {
            HibernateUtil.closeSession();
        }
        return inst;
    }


The mapping is:
Code:
<hibernate-mapping>
    <class name="com.tecdoc.db_update.hibernate.Bean_Update_Installation"
        table="t_Update_Installation">
        <id name="idInstall" column="idInstall"
            type="integer">
            <generator class="identity">
            </generator>
        </id>
        <property name="installDatum" column="installDatum"
            type="java.lang.String"/>
        <property name="installVon" column="installVon"
            type="java.lang.String"/>
        <property name="installBemerkung" column="installBemerkung"
            type="java.lang.String"/>
        <many-to-one name="teilUpdate"
            class="com.tecdoc.db_update.hibernate.Bean_Update" not-null="true"/>

        <joined-subclass name="com.tecdoc.db_update.hibernate.Bean_Datenbank"
            table="t_Datenbank">
            <key column="idDb"/>
            <many-to-one name="server"
                class="com.tecdoc.db_update.hibernate.Bean_Server"
                not-null="true"/>
            <many-to-one name="sid"
                class="com.tecdoc.db_update.hibernate.Bean_SID"
                not-null="true"/>
        </joined-subclass>
   
        <joined-subclass name="com.tecdoc.db_update.hibernate.Bean_Applikation"
            table="t_Applikation">
            <key column="idApplikation"/>
            <many-to-one name="app"
                class="com.tecdoc.db_update.hibernate.Bean_App" not-null="true"/>
        </joined-subclass>
    </class>
</hibernate-mapping>


Thanks in advance.

_________________
Have Fun!

Torsten


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 19, 2004 3:35 pm 
Regular
Regular

Joined: Tue Oct 28, 2003 8:25 am
Posts: 72
Location: Belgium
What is the java code of class Bean_Update_Installation ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 20, 2004 2:04 am 
Newbie

Joined: Wed Jun 16, 2004 8:26 am
Posts: 19
Code for Bean_Update_Installation:
[code]
public class Bean_Update_Installation implements Serializable {

public Bean_Update_Installation() {
}

private Integer idInstall;
private String installDatum;
private String installVon; // Werte in (Ressin, Wollschl

_________________
Have Fun!

Torsten


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 20, 2004 3:45 am 
Regular
Regular

Joined: Tue Oct 28, 2003 8:25 am
Posts: 72
Location: Belgium
I can't see any problem.

Could you try to provide more data about the problem ? Full stack trace ? Debug level Hibernate log ?

Please provide as much as you can.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 20, 2004 4:00 am 
Newbie

Joined: Wed Jun 16, 2004 8:26 am
Posts: 19
Code:
net.sf.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of com.tecdoc.db_update.hibernate.Bean_Update_Installation.idInstall
   at net.sf.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:110)
   at net.sf.hibernate.persister.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:307)
   at net.sf.hibernate.proxy.HibernateProxyHelper.getIdentifier(HibernateProxyHelper.java:50)
   at net.sf.hibernate.type.EntityType.toString(EntityType.java:84)
   at net.sf.hibernate.type.PersistentCollectionType.toString(PersistentCollectionType.java:82)
   at net.sf.hibernate.impl.Printer.toString(Printer.java:49)
   at net.sf.hibernate.impl.Printer.toString(Printer.java:82)
   at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2245)
   at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2203)
   at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
   at com.tecdoc.db_update.utils.HibernateQueryUtil.getAppCollection(HibernateQueryUtil.java:458)
   at com.tecdoc.db_update.struts.actions.Action_new_update_install.execute(Action_new_update_install.java:63)
   at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
   at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
   at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
   at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
   at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732)
   at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
   at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at net.sf.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:96)
   ... 41 more


this error occurs always when i try to select or load some data of type update_installation.

by the way how can i get more debug-information?

_________________
Have Fun!

Torsten


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 20, 2004 4:40 am 
Regular
Regular

Joined: Tue Oct 28, 2003 8:25 am
Posts: 72
Location: Belgium
As far as I can see, you already have enabled debug logs. Have a look at the log4j (or whatever other logging framework you are using) doc for more details.

If I'm not mistaken, you can workaround this problem by disabling logs.

This problem *could* be a bug in Hibernate. I'd be interrested to debug through it.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 20, 2004 5:24 am 
Newbie

Joined: Wed Jun 16, 2004 8:26 am
Posts: 19
first, thanks for your reply!

i commented out the hibernate-lines in the log4j.properties but it has no effect on the console-output and the error still occurs.

i think i have to try a different mapping-solution.

working on it.

_________________
Have Fun!

Torsten


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 20, 2004 11:01 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Explicitly set

log4j.logger.net.sf.hibernate=info

and see if the problem goes away.

The exception is occurring in Hibernate's logging code.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 20, 2004 11:19 am 
Newbie

Joined: Wed Jun 16, 2004 8:26 am
Posts: 19
unfortunately it's the same error after setting

log4j.logger.net.sf.hibernate=info

hmmm.

_________________
Have Fun!

Torsten


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 20, 2004 11:22 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Sorry, I don't believe you. Printer is only called is logging is enabled.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 21, 2004 2:47 am 
Newbie

Joined: Wed Jun 16, 2004 8:26 am
Posts: 19
i think you're right gavin but what can i do to swith logging off?

i use eclipse 3.0 tomcat projekt.

i only have one log4j.properties file and it looks like this (also compiled in the 'classes' directory):
Code:
### direct log messages to stdout ###
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=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.appender.stdout=org.apache.catalina.session.ManagerBase

### direct messages to file hibernate.log ###
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=hibernate.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

### set log levels - for more verbose logging change 'info' to 'debug' ###

log4j.rootLogger=warn, stdout

log4j.logger.net.sf.hibernate=info

### log just the SQL
log4j.logger.net.sf.hibernate.SQL=info

### log JDBC bind parameters ###
log4j.logger.net.sf.hibernate.type=info

### log schema export/update ###
#log4j.logger.net.sf.hibernate.tool.hbm2ddl=debug

### log cache activity ###
#log4j.logger.net.sf.hibernate.cache=debug

### enable the following line if you want to track down connection ###
### leakages when using DriverManagerConnectionProvider ###
#log4j.logger.net.sf.hibernate.connection.DriverManagerConnectionProvider=trace


but i get the same error-msg:
Code:
net.sf.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of com.tecdoc.db_update.hibernate.Bean_Update_Installation.idInstall
   at net.sf.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:110)
   at net.sf.hibernate.persister.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:307)
   at net.sf.hibernate.proxy.HibernateProxyHelper.getIdentifier(HibernateProxyHelper.java:50)
   at net.sf.hibernate.type.EntityType.toString(EntityType.java:84)
   at net.sf.hibernate.type.PersistentCollectionType.toString(PersistentCollectionType.java:82)
   at net.sf.hibernate.impl.Printer.toString(Printer.java:49)
...


i have no idea, why!

_________________
Have Fun!

Torsten


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 21, 2004 10:18 am 
Newbie

Joined: Wed Jun 16, 2004 8:26 am
Posts: 19
i have commons-logging and log4j jars in my classpath of my eclipse-project.

but i can't find any properties-file for the commons-logging.

may that's a reason for the logging not to disappear when i change the log4j.properties ?

_________________
Have Fun!

Torsten


Top
 Profile  
 
 Post subject: log4j configuration
PostPosted: Thu Jul 22, 2004 7:36 am 
Newbie

Joined: Thu Jul 22, 2004 7:24 am
Posts: 10
tortenegger wrote:
may that's a reason for the logging not to disappear when i change the log4j.properties ?


Looks like your log4j.properties is not accessible. I had a similar problem.

Found that commons-logging-1.0.3.jar referred to a log4j.jar in it's manifest:
Class-Path: log4j.jar log4j-core.jar.

So for log4j to work correctly, the log4j.jar file should be available in the same directory as the commons-logging file.

After that you still need to provide the switch in your application startup:
-Dlog4j.configuration=file:/path/to/log4j.properties

I got log4j to work with these changes.

Hope this helps.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 22, 2004 7:45 am 
Newbie

Joined: Wed Jun 16, 2004 8:26 am
Posts: 19
thx spartacus,

i recognized what was wrong:

my log4j.properties was in the struts-'resources' folder from the struts framework by default.

i put it into the src-root and than log4j was able to detect it and now my changes take effect!

by the way the error mentioned above disappeared :)

so i'm able to step deeper into my first hibernate-application.

thx

PS:
right now, i'm dealing with another error (WrongClassException of a collection) but i will see if i can manage it by myself (i hope so)

_________________
Have Fun!

Torsten


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