-->
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.  [ 4 posts ] 
Author Message
 Post subject: Fehler beim schreiben in DB
PostPosted: Tue Oct 02, 2007 12:26 pm 
Newbie

Joined: Tue Oct 02, 2007 12:19 pm
Posts: 7
Hallo! Ich habe ein JSF-Formular. Die eingegebenen Daten sollen gespeichert werden. Dabei treten leider folgende Fehler auf. Ich hoffe hier kann mir jemand helfen.

java.lang.ExceptionInInitializerError
beans.UserHandler.processAction(UserHandler.java:32)
javax.faces.event.ActionEvent.processListener(ActionEvent.java:51)
javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:487)
javax.faces.component.UICommand.broadcast(UICommand.java:78)
javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)

org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.Log4JLogger does not implement Log
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:532)
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:272)
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:246)
org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395)
org.hibernate.cfg.Configuration.<clinit>(Configuration.java:120)
beans.UserHandler.processAction(UserHandler.java:32)
javax.faces.event.ActionEvent.processListener(ActionEvent.java:51)
javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:487)
javax.faces.component.UICommand.broadcast(UICommand.java:78)
javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)

Meine action-methode wo der das speichern geschehe soll sieht so aus:
public void processAction(ActionEvent ae) throws AbortProcessingException {
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
Transaction trans = session.beginTransaction();
session.save(user);
trans.commit();
session.close();
}

wer kann mir helfen?
was bedeuten die fehlermeldungen genau?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 05, 2007 6:21 am 
Newbie

Joined: Tue Oct 02, 2007 12:19 pm
Posts: 7
habe jetzt mittlerweile eine andere fehlermeldung....
vielleicht kann mir da ja jemadn bei helfen...

Code:
exception

javax.servlet.ServletException: could not insert: [beans.Maschinendaten]
   javax.faces.webapp.FacesServlet.service(FacesServlet.java:154)


root cause

org.hibernate.exception.ConstraintViolationException: could not insert: [beans.Maschinendaten]
   org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
   org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:40)
   org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2158)
   org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2638)
   org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48)
   org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
   org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:298)
   org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
   org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
   org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
   org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
   org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:94)
   org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
   org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
   org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
   org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:495)
   beans.MaschinendatenHandler.processAction(MaschinendatenHandler.java:34)
   javax.faces.event.ActionEvent.processListener(ActionEvent.java:51)
   javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:487)
   javax.faces.component.UICommand.broadcast(UICommand.java:78)
   javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
   javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
   org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
   org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
   org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
   javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)


root cause

com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Column 'betriebsmittel' cannot be null
   com.mysql.jdbc.SQLError.createSQLException(SQLError.java:931)
   com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
   com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
   com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
   com.mysql.jdbc.Connection.execSQL(Connection.java:3256)
   com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1313)
   com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1585)
   com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1500)
   com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1485)
   org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:33)
   org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2158)
   org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2638)
   org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48)
   org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
   org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:298)
   org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
   org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
   org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
   org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
   org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:94)
   org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
   org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
   org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
   org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:495)
   beans.MaschinendatenHandler.processAction(MaschinendatenHandler.java:34)
   javax.faces.event.ActionEvent.processListener(ActionEvent.java:51)
   javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:487)
   javax.faces.component.UICommand.broadcast(UICommand.java:78)
   javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
   javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
   org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
   org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
   org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
   javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)



ich habe eine SQL-DB angelegt. Die Spalten der Tabelle sond so eingestellt, das sie nicht null sein können. Wenn ich not null rausnehme, dann wird in alle Spalten der Tabelle der wert null eingetragen....

beim mappen dürfte eigentlich kein fehler aufgetereten sein. constarint hat ja eigentlich was mit wertebeschränkung zu tun. Da steht ja column betriebsmittel cannot be null. soll sie ja auch nicht...

kann da jemand was zu sagen?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 08, 2007 3:44 pm 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
Das Objekt der Klasse, die Du speicherst hat Null in den Attributen stehen.

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 09, 2007 3:11 am 
Newbie

Joined: Tue Oct 02, 2007 12:19 pm
Posts: 7
Jo ich weiß. Mittlerweile habe ich es auch gelöst. Hatte mit JSF zu tun...


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