0

Hibernate Exception after restarting Tomcat need redeploying

asked 2009-05-08 20:05:04 +0800

bob007 gravatar image bob007
384 3 4

updated 2009-05-25 18:20:17 +0800

***SOLVED***

Hi,

When I deploy our application on Apache Tomcat, the application work well.
But if I stop/start or restart the Apache Tomcat service. At one of page I get this error. Then the only thing I could do to stop getting this error is redeploy again.

What is causing that ? ZK ? Hibernate ? Why ?
Is there another way to avoid redeploying after this error ?
What can I do to avoid that error?

I use Tomcat 5.5 and ZK 3.6.1

Thank you for your help


org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of actifs.Actif.noActif
	org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:195)
	org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:206)
	org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3619)
	org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:3335)
	org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:204)
	org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:241)
	org.hibernate.type.EntityType.getIdentifier(EntityType.java:430)
	org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:265)
	org.hibernate.type.TypeFactory.findDirty(TypeFactory.java:619)
	org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:3151)
	org.hibernate.event.def.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:501)
	org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:227)
	org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:150)
	org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)
	org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)
	org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:58)
	org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:996)
	org.hibernate.impl.SessionImpl.list(SessionImpl.java:1589)
	org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306)
	bonDeTravails.BonDeTravailDAO.findNextNoBon(BonDeTravailDAO.java:54)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	java.lang.reflect.Method.invoke(Unknown Source)
	bsh.Reflect.invokeMethod(Unknown Source)
	bsh.Reflect.invokeObjectMethod(Unknown Source)
	bsh.Name.invokeMethod(Unknown Source)
	bsh.BSHMethodInvocation.eval(Unknown Source)
	bsh.BSHPrimaryExpression.eval(Unknown Source)
	bsh.BSHPrimaryExpression.eval(Unknown Source)
	bsh.BSHArguments.getArguments(Unknown Source)
	bsh.BSHMethodInvocation.eval(Unknown Source)
	bsh.BSHPrimaryExpression.eval(Unknown Source)
	bsh.BSHPrimaryExpression.eval(Unknown Source)
	bsh.BSHBlock.evalBlock(Unknown Source)
	bsh.BSHBlock.eval(Unknown Source)
	bsh.BshMethod.invokeImpl(Unknown Source)
	bsh.BshMethod.invoke(Unknown Source)
	bsh.BshMethod.invoke(Unknown Source)
	bsh.Name.invokeLocalMethod(Unknown Source)
	bsh.Name.invokeMethod(Unknown Source)
	bsh.BSHMethodInvocation.eval(Unknown Source)
	bsh.BSHPrimaryExpression.eval(Unknown Source)
	bsh.BSHPrimaryExpression.eval(Unknown Source)
	bsh.BSHBlock.evalBlock(Unknown Source)
	bsh.BSHBlock.eval(Unknown Source)
	bsh.BSHBlock.eval(Unknown Source)
	bsh.BSHIfStatement.eval(Unknown Source)
	bsh.BSHBlock.evalBlock(Unknown Source)
	bsh.BSHBlock.eval(Unknown Source)
	bsh.BshMethod.invokeImpl(Unknown Source)
	bsh.BshMethod.invoke(Unknown Source)
	bsh.BshMethod.invoke(Unknown Source)
	bsh.Name.invokeLocalMethod(Unknown Source)
	bsh.Name.invokeMethod(Unknown Source)
	bsh.BSHMethodInvocation.eval(Unknown Source)
	bsh.BSHPrimaryExpression.eval(Unknown Source)
	bsh.BSHPrimaryExpression.eval(Unknown Source)
	bsh.Interpreter.eval(Unknown Source)
	bsh.Interpreter.eval(Unknown Source)
	org.zkoss.zk.scripting.bsh.BSHInterpreter.exec(BSHInterpreter.java:108)
	org.zkoss.zk.scripting.util.GenericInterpreter.interpret(GenericInterpreter.java:310)
	org.zkoss.zk.ui.impl.PageImpl.interpret(PageImpl.java:771)
	org.zkoss.zk.ui.impl.UiEngineImpl.execNonComponent(UiEngineImpl.java:730)
	org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:549)
	org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:559)
	org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:527)
	org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:494)
	org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:375)
	org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:296)
	org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:229)
	org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:166)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

delete flag offensive retag edit

7 Replies

Sort by ยป oldest newest

answered 2009-05-11 08:04:31 +0800

jumperchen gravatar image jumperchen
3909 2 8
http://jumperchen.blogspo... ZK Team

Hi,

Have you tried to google it with "IllegalArgumentException occurred calling getter..."?
Because there are too many unpredictable issue.
From the error log, I suppose it is not a ZK issue.

/Jumper

link publish delete flag offensive edit

answered 2009-05-11 14:51:53 +0800

bob007 gravatar image bob007
384 3 4

updated 2009-05-11 15:36:11 +0800

I got this explication on the web...

public class PropertyAccessException extends HibernateException

A problem occurred accessing a property of an instance of a persistent class by reflection, or via CGLIB. There are a number of possible underlying causes, including 

failure of a security check 
an exception occurring inside the getter or setter method 
a nullable database column was mapped to a primitive-type property 
the Hibernate type was not castable to the property type (or vice-versa) 

http://www.hibernate.org/hib_docs/v3/api/org/hibernate/PropertyAccessException.html


But I don't understand why it's doing this only after restarting tomcat service on server.

I mean something is corrupted by the restarting of tomcat maybe an object created by the application and mapped by hibernate, but how it can corrupted by the restarting ? I mean a restarting of Tomcat should be like a new deploy isnt ? How it can keep in memory the new mapped objects after a restarting ?

Can it be related to the Hibernate connection ?


Thank you for your help

link publish delete flag offensive edit

answered 2009-05-11 15:11:10 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

Hmmmmm,

i can see that after a re-publish in my eclipse environment i need not to logged in new. So it seems that the sessionId it's the same as before new starting??

Hmmm, what do you do on starting that there are BeanShell-Logs?
...
bsh.BSHAssignment.eval(Unknown Source)
...

Stephan

PS: Search the forum for Desktop cleaning. It's a zk.xml listener.

link publish delete flag offensive edit

answered 2009-05-11 15:31:31 +0800

bob007 gravatar image bob007
384 3 4

updated 2009-05-11 17:14:49 +0800

Thank you Stephan,

I don't know what do "bsh.BSHAssignment.eval(Unknown Source)", so I can't help you about that, its maybe some zscript evaluation.

The only thing I do in all the stack exception is calling this method
bonDeTravails.BonDeTravailDAO.findNextNoBon(BonDeTravailDAO.java:54)

	public String findNextNoBon( String debutNo ){
		String nouveauNo;
		Session sess = currentSession();
		Criteria criteria = sess.createCriteria(BonDeTravail.class);
		criteria.add(Restrictions.like("noBon", debutNo+"%"));
		criteria.addOrder(Order.desc("noBon"));
		if (criteria.list().size() != 0){
			String noDernierBonStr = ((BonDeTravail)criteria.list().get(0)).getNoBon();         //   <--- line 54
			int noDernierBonint = Integer.parseInt(noDernierBonStr.substring(debutNo.length()+1));
			DecimalFormat df = new DecimalFormat("0000");	
			nouveauNo = debutNo + df.format(noDernierBonint+1);
		}
		else
			nouveauNo = debutNo + "0001";
		return (nouveauNo);		
	}

Basicly what that method is doing is searching for the next home made id available, this will be an id for an object of the class BonDeTravail.

Unfortunatly, after searchs on forum about Desktop cleaning I didn't find anything only a small post (here) talking about ZK HttpSessionListener, nothing helping me.

Regards,

link publish delete flag offensive edit

answered 2009-05-11 17:59:23 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2009-05-11 18:01:38 +0800

Hi,

what is this for a class: actifs.Actif.noActif
--> Seems that the getter is missing. getNoActif
Please show us the Modelclasses.

Have you set a breakpoint in the getNoBon and debug it?

here are the code from the sessionCleaning:

web.xml

  ...
	<!--  ZKoss -->
	<listener>
		<description>Used to cleanup when a session is destroyed</description>
		<display-name>ZK Session Cleaner</display-name>
		<listener-class>org.zkoss.zk.ui.http.HttpSessionListener</listener-class>
	</listener>

  ...

Stephan

link publish delete flag offensive edit

answered 2009-05-11 18:22:13 +0800

bob007 gravatar image bob007
384 3 4

updated 2009-05-11 19:08:29 +0800

The getter isn't missing and the application work well until I restart the Tomcat service on the server.

For the breakpoint I don't know how to do since this exception happen only on the deployed application never in eclipse.

I will try with the sessionCleaning code.

Thank you,

link publish delete flag offensive edit

answered 2009-05-12 03:41:30 +0800

dennis gravatar image dennis
3679 1 6
http://www.javaworld.com....

updated 2009-05-12 03:43:04 +0800

it looks like hibernate issue ,
IllegalArgumentException means wrong argument when calling this method (Actif.getNoActif)

org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of actifs.Actif.noActif
org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:195)
	org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:206)

but I am wondering why this line didn't throw exception,

if (criteria.list().size() != 0){

but this line throws
String noDernierBonStr = ((BonDeTravail)criteria.list().get(0)).getNoBon();         //   <--- line 54

criteria.list() be called twice, maybe you can keep the list() only once to see if it still happen or not.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-05-08 20:05:04 +0800

Seen: 437 times

Last updated: May 12 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More