-->
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: Hibernate lazy instantiation problem
PostPosted: Fri Nov 05, 2004 6:35 pm 
Newbie

Joined: Fri Nov 05, 2004 4:29 pm
Posts: 6
Hibernat 2.1.6+Jboss 3.2.5:

I made a hibernate Mbean of jboss. It's sar, not har. I failed to make a call from a client app. to a session bean which uses the Hibernate Mbean by the Lazy instantiation problem at last. Looking at the steps I passed, there are some info. usful to you guys to help me go out the problem. Thanks ahead

The Mban was deployed with two possible problems ( marked in red color) as follows:
-----------------------------------------------------------------------------------------------------------
2004-11-04 18:35:45,286 INFO [net.sf.hibernate.util.NamingHelper] JNDI InitialContext properties:{}
2004-11-04 18:35:45,287 DEBUG [net.sf.hibernate.impl.SessionFactoryObjectFactory] JNDI lookup: GmmsHibernateFactory
2004-11-04 18:35:45,287 DEBUG [net.sf.hibernate.impl.SessionFactoryObjectFactory] lookup: uid=402882950005557f010005557f280000
2004-11-04 18:35:45,903 INFO [net.sf.hibernate.jmx.HibernateServiceMBean] starting service at JNDI name: GmmsHibernateFactory
2004-11-04 18:35:45,904 INFO [net.sf.hibernate.jmx.HibernateServiceMBean] service properties: {hibernate.session_factory_name=GmmsHibernateFactory, hibernate.transaction.manager_lookup_class=net.sf.hibernate.transaction.JBossTransactionManagerLookup, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.show_sql=true, hibernate.transaction.factory_class=net.sf.hibernate.transaction.JTATransactionFactory, hibernate.connection.datasource=java:/MySqlDS, jta.UserTransaction=UserTransaction}
2004-11-04 18:35:45,921 INFO [net.sf.hibernate.cfg.Environment] Hibernate 2.1.6
2004-11-04 18:35:45,923 INFO [net.sf.hibernate.cfg.Environment] loaded properties from resource hibernate.properties: {hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=net.sf.hibernate.cache.EhCacheProvider, hibernate.cache.use_query_cache=true, hibernate.max_fetch_depth=1, hibernate.jdbc.use_streams_for_binary=true, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.jdbc.batch_size=0, hibernate.proxool.pool_alias=pool1, hibernate.cache.region_prefix=hibernate.test, hibernate.jdbc.batch_versioned_data=true, hibernate.connection.pool_size=1}
2004-11-04 18:35:45,926 INFO [net.sf.hibernate.cfg.Environment] using java.io streams to persist binary types
2004-11-04 18:35:45,926 INFO [net.sf.hibernate.cfg.Environment] using CGLIB reflection optimizer
2004-11-04 18:35:45,935 INFO [net.sf.hibernate.cfg.Configuration] Mapping resource: com/gmms/hibernate/Route.hbm.xml
2004-11-04 18:35:46,536 DEBUG [net.sf.hibernate.util.DTDEntityResolver] trying to locate http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/

.............

2004-11-04 18:35:55,870 DEBUG [net.sf.hibernate.cfg.Configuration] resolving reference to class: com.gmms.hibernate.NotificationScheme
2004-11-04 18:35:55,874 INFO [net.sf.hibernate.jmx.HibernateServiceMBean] Could not build SessionFactory using the MBean classpath - will try again using client classpath: property mapping has wrong number of columns: com.gmms.hibernate.ActionPanicHistory.subscriberId type: object
2004-11-04 18:35:55,875 DEBUG [net.sf.hibernate.jmx.HibernateServiceMBean] Error was
net.sf.hibernate.MappingException: property mapping has wrong number of columns: com.gmms.hibernate.ActionPanicHistory.subscriberId type: object
at net.sf.hibernate.mapping.PersistentClass.validate(PersistentClass.java:269)
at net.sf.hibernate.mapping.RootClass.validate(RootClass.java:169)
at net.sf.hibernate.cfg.Configuration.validate(Configuration.java:619)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:785)
at net.sf.hibernate.jmx.HibernateService.buildSessionFactory(HibernateService.java:163)
at net.sf.hibernate.jmx.HibernateService.start(HibernateService.java:130)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:849)
at $Proxy52.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:367)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
at $Proxy4.start(Unknown Source)
at org.jboss.deployment.SARDeployer.start(SARDeployer.java:251)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:836)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:645)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:608)
at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
at $Proxy51.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:304)
at org.jboss.ha.framework.server.FarmMemberService.deploy(FarmMemberService.java:374)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:460)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:201)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:212)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDep
loymentScanner.java:191)
2004-11-04 18:35:56,476 DEBUG [net.sf.hibernate.impl.SessionFactoryObjectFactory] initializing class SessionFactoryObjectFactory
2004-11-04 18:35:56,480 DEBUG [net.sf.hibernate.impl.SessionFactoryObjectFactory] registered: 40288295000696880100069688b80000 (GmmsHibernateFactory)
2004-11-04 18:35:56,480 INFO [net.sf.hibernate.impl.SessionFactoryObjectFactory] Factory name: GmmsHibernateFactory
2004-11-04 18:35:56,483 INFO [net.sf.hibernate.util.NamingHelper] JNDI InitialContext properties:{}
2004-11-04 18:35:56,527 DEBUG [net.sf.hibernate.util.NamingHelper] binding: GmmsHibernateFactory
2004-11-04 18:35:56,527 DEBUG [net.sf.hibernate.util.NamingHelper] Bound name: GmmsHibernateFactory
2004-11-04 18:35:56,527 INFO [net.sf.hibernate.impl.SessionFactoryObjectFactory] Bound factory to JNDI name: GmmsHibernateFactory
2004-11-04 18:35:56,528 WARN [net.sf.hibernate.impl.SessionFactoryObjectFactory] InitialContext did not implement EventContext


I don't know if the two red errors are fatal for my next step to use the Mbean.

the jboss-service.xml is like this:
----------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE server>

<!-- Generated file - Do not edit! -->

<server>
<mbean code="net.sf.hibernate.jmx.HibernateService" name="jboss.jca:service=GmmsHibernate">
<depends>jboss.jca:service=RARDeployer</depends>
<depends>jboss.jca:service=LocalTxCM,name=MySqlDS</depends>
<attribute name="MapResources">com/gmms/hibernate/Route.hbm.xml,com/gmms/hibernate/BwpPlan.hbm.xml,com/gmms/hibernate/Stepp1.hbm.xml,com/gmms/hibernate/JmsRole.hbm.xml,com/gmms/hibernate/SmsAudit.hbm.xml,com/gmms/hibernate/ActionAwpHistory.hbm.xml,com/gmms/hibernate/Daylightsaving.hbm.xml,com/gmms/hibernate/Caretaker.hbm.xml,com/gmms/hibernate/Customer.hbm.xml,com/gmms/hibernate/ScheduleOnetime.hbm.xml,com/gmms/hibernate/AirceptDataAudit.hbm.xml,com/gmms/hibernate/ScheduleOnetimeHistory.hbm.xml,com/gmms/hibernate/ActionHonkhornHistory.hbm.xml,com/gmms/hibernate/Timezone.hbm.xml,com/gmms/hibernate/AlarmQueue.hbm.xml,com/gmms/hibernate/KoreSim.hbm.xml,com/gmms/hibernate/EventImpact.hbm.xml,com/gmms/hibernate/EventPowercut.hbm.xml,com/gmms/hibernate/EventLocation.hbm.xml,com/gmms/hibernate/Subscriber.hbm.xml,com/gmms/hibernate/Icon.hbm.xml,com/gmms/hibernate/ActionTrackFreqHistory.hbm.xml,com/gmms/hibernate/ActionZoneCircleHistory.hbm.xml,com/gmms/hibernate/ScheduleMonthly.hbm.xml,com/gmms/hibernate/ActionTrackNoFreq.hbm.xml,com/gmms/hibernate/ActionSm.hbm.xml,com/gmms/hibernate/Picture.hbm.xml,com/gmms/hibernate/EventIndex.hbm.xml,com/gmms/hibernate/EventIgnition.hbm.xml,com/gmms/hibernate/AlarmQueueHistory.hbm.xml,com/gmms/hibernate/DisallowedFeature.hbm.xml,com/gmms/hibernate/DependentHistory.hbm.xml,com/gmms/hibernate/ActionVoicecall.hbm.xml,com/gmms/hibernate/CustomerBmodelBwp.hbm.xml,com/gmms/hibernate/EventVoltchange.hbm.xml,com/gmms/hibernate/JmsTransaction.hbm.xml,com/gmms/hibernate/ActionAuxalarmHistory.hbm.xml,com/gmms/hibernate/Asset.hbm.xml,com/gmms/hibernate/ActionZoneRectHistory.hbm.xml,com/gmms/hibernate/CustomerHistory.hbm.xml,com/gmms/hibernate/ActionDoorunlockHistory.hbm.xml,com/gmms/hibernate/Beacon.hbm.xml,com/gmms/hibernate/NotificationScheme.hbm.xml,com/gmms/hibernate/ConflictFeature.hbm.xml,com/gmms/hibernate/ActionVoltageHistory.hbm.xml,com/gmms/hibernate/IncidentOperatorNote.hbm.xml,com/gmms/hibernate/Followit.hbm.xml,com/gmms/hibernate/Scenario.hbm.xml,com/gmms/hibernate/Skypatrol.hbm.xml,com/gmms/hibernate/Iden.hbm.xml,com/gmms/hibernate/ActionSpeedThresholdHistory.hbm.xml,com/gmms/hibernate/ZoneMonitoringAudit.hbm.xml,com/gmms/hibernate/TrackingLocate.hbm.xml,com/gmms/hibernate/JmsMessage.hbm.xml,com/gmms/hibernate/ActionAlarmcall.hbm.xml,com/gmms/hibernate/ActionVoicecallHistory.hbm.xml,com/gmms/hibernate/LoginAudit.hbm.xml,com/gmms/hibernate/ActionZoneCircle.hbm.xml,com/gmms/hibernate/BeaconAudit.hbm.xml,com/gmms/hibernate/UserPrivilege.hbm.xml,com/gmms/hibernate/Beaconmodel.hbm.xml,com/gmms/hibernate/ActionDoorunlock.hbm.xml,com/gmms/hibernate/ScenarioSchemeHistory.hbm.xml,com/gmms/hibernate/LoginHistory.hbm.xml,com/gmms/hibernate/ActionTrackFreq.hbm.xml,com/gmms/hibernate/EventMaxspdexceeded.hbm.xml,com/gmms/hibernate/ActionIgnition.hbm.xml,com/gmms/hibernate/JmsUser.hbm.xml,com/gmms/hibernate/ScenarioHistory.hbm.xml,com/gmms/hibernate/ActionPowercutHistory.hbm.xml,com/gmms/hibernate/AirceptPageRequest.hbm.xml,com/gmms/hibernate/ActionSpeedThreshold.hbm.xml,com/gmms/hibernate/ActionDoorlockHistory.hbm.xml,com/gmms/hibernate/EventPanic.hbm.xml,com/gmms/hibernate/CustomerPlanHistory.hbm.xml,com/gmms/hibernate/ZoneMonitoring.hbm.xml,com/gmms/hibernate/RoutePoint.hbm.xml,com/gmms/hibernate/PlanAudit.hbm.xml,com/gmms/hibernate/Sentrigger.hbm.xml,com/gmms/hibernate/ActionIgnitionHistory.hbm.xml,com/gmms/hibernate/EventAuxalarm.hbm.xml,com/gmms/hibernate/SpeedMonitoring.hbm.xml,com/gmms/hibernate/ActionAlarmcallHistory.hbm.xml,com/gmms/hibernate/EventZone.hbm.xml,com/gmms/hibernate/AssetAudit.hbm.xml,com/gmms/hibernate/CustomerBmodelBwpHistory.hbm.xml,com/gmms/hibernate/GuardianHistory.hbm.xml,com/gmms/hibernate/QuartzJobState.hbm.xml,com/gmms/hibernate/IncidentLoginAudit.hbm.xml,com/gmms/hibernate/ActionPowercut.hbm.xml,com/gmms/hibernate/Phone.hbm.xml,com/gmms/hibernate/NotificationActionHistory.hbm.xml,com/gmms/hibernate/ScheduleAlltime.hbm.xml,com/gmms/hibernate/Email.hbm.xml,com/gmms/hibernate/Guardian.hbm.xml,com/gmms/hibernate/ActionSmsHistory.hbm.xml,com/gmms/hibernate/Session.hbm.xml,com/gmms/hibernate/Sen.hbm.xml,com/gmms/hibernate/ActionMaxspdexceedHistory.hbm.xml,com/gmms/hibernate/ActionArrive.hbm.xml,com/gmms/hibernate/ActionInit.hbm.xml,com/gmms/hibernate/PlanHistory.hbm.xml,com/gmms/hibernate/BeaconInventoryAudit.hbm.xml,com/gmms/hibernate/TrackerSequence.hbm.xml,com/gmms/hibernate/ActionDepartHistory.hbm.xml,com/gmms/hibernate/Login.hbm.xml,com/gmms/hibernate/AssetHistory.hbm.xml,com/gmms/hibernate/OrganizationHistory.hbm.xml,com/gmms/hibernate/Incident.hbm.xml,com/gmms/hibernate/ScheduleWeekly.hbm.xml,com/gmms/hibernate/IdenMessageAudit.hbm.xml,com/gmms/hibernate/Tipoftheday.hbm.xml,com/gmms/hibernate/AirceptPageAudit.hbm.xml,com/gmms/hibernate/IdenCommand.hbm.xml,com/gmms/hibernate/ActionPanic.hbm.xml,com/gmms/hibernate/Sendum.hbm.xml,com/gmms/hibernate/SenEvent.hbm.xml,com/gmms/hibernate/ActionVoltage.hbm.xml,com/gmms/hibernate/ScheduleWeeklyHistory.hbm.xml,com/gmms/hibernate/EventAirbag.hbm.xml,com/gmms/hibernate/EventArrivelocate.hbm.xml,com/gmms/hibernate/ScheduleAlltimeHistory.hbm.xml,com/gmms/hibernate/EventSpeed.hbm.xml,com/gmms/hibernate/MasterUser.hbm.xml,com/gmms/hibernate/DependentAudit.hbm.xml,com/gmms/hibernate/User.hbm.xml,com/gmms/hibernate/ScenarioAction.hbm.xml,com/gmms/hibernate/InvalidLoginAudit.hbm.xml,com/gmms/hibernate/ActionInitHistory.hbm.xml,com/gmms/hibernate/ActionMonStn.hbm.xml,com/gmms/hibernate/IdenMessage.hbm.xml,com/gmms/hibernate/AuthAudit.hbm.xml,com/gmms/hibernate/ScenarioActionHistory.hbm.xml,com/gmms/hibernate/ActionMonStnHistory.hbm.xml,com/gmms/hibernate/IncidentAudit.hbm.xml,com/gmms/hibernate/Plan.hbm.xml,com/gmms/hibernate/SubscriberHistory.hbm.xml,com/gmms/hibernate/Country.hbm.xml,com/gmms/hibernate/NotificationSchemeHistory.hbm.xml,com/gmms/hibernate/SpeedMonitoringAudit.hbm.xml,com/gmms/hibernate/ActionAwp.hbm.xml,com/gmms/hibernate/ViolationAudit.hbm.xml,com/gmms/hibernate/UserHistory.hbm.xml,com/gmms/hibernate/ActionIndex.hbm.xml,com/gmms/hibernate/ActionEmail.hbm.xml,com/gmms/hibernate/ActionMaxspdexceed.hbm.xml,com/gmms/hibernate/NotificationAction.hbm.xml,com/gmms/hibernate/Locate.hbm.xml,com/gmms/hibernate/Feature.hbm.xml,com/gmms/hibernate/ActionDoorlock.hbm.xml,com/gmms/hibernate/EventTrunkopened.hbm.xml,com/gmms/hibernate/Privilege.hbm.xml,com/gmms/hibernate/ScheduleHistory.hbm.xml,com/gmms/hibernate/BwpPlanHistory.hbm.xml,com/gmms/hibernate/Dependent.hbm.xml,com/gmms/hibernate/Schedule.hbm.xml,com/gmms/hibernate/Tracking.hbm.xml,com/gmms/hibernate/ActionArriveHistory.hbm.xml,com/gmms/hibernate/EventAwp.hbm.xml,com/gmms/hibernate/ActionTrackNoFreqHistory.hbm.xml,com/gmms/hibernate/Organization.hbm.xml,com/gmms/hibernate/EventDooropened.hbm.xml,com/gmms/hibernate/New.hbm.xml,com/gmms/hibernate/StateProvince.hbm.xml,com/gmms/hibernate/JmsSubscription.hbm.xml,com/gmms/hibernate/ActionEvent.hbm.xml,com/gmms/hibernate/SenHistory.hbm.xml,com/gmms/hibernate/PointLocate.hbm.xml,com/gmms/hibernate/ActionZoneRect.hbm.xml,com/gmms/hibernate/ActionAuxalarm.hbm.xml,com/gmms/hibernate/Aircept.hbm.xml,com/gmms/hibernate/SkypatrolMessageAudit.hbm.xml,com/gmms/hibernate/SenEventHistory.hbm.xml,com/gmms/hibernate/ActionHonkhorn.hbm.xml,com/gmms/hibernate/BeaconStateAudit.hbm.xml,com/gmms/hibernate/ScheduleDaily.hbm.xml,com/gmms/hibernate/CustomerPlan.hbm.xml,com/gmms/hibernate/ActionEmailHistory.hbm.xml,com/gmms/hibernate/AerisMin.hbm.xml,com/gmms/hibernate/Stepp2.hbm.xml,com/gmms/hibernate/ScenarioScheme.hbm.xml,com/gmms/hibernate/ScheduleMonthlyHistory.hbm.xml,com/gmms/hibernate/ActionPanicHistory.hbm.xml,com/gmms/hibernate/ScheduleDailyHistory.hbm.xml,com/gmms/hibernate/SkypatrolMessage.hbm.xml,com/gmms/hibernate/ActionDepart.hbm.xml,com/gmms/hibernate/EventDepartlocate.hbm.xml</attribute>
<attribute name="JndiName">GmmsHibernateFactory</attribute>
<attribute name="Datasource">java:/MySqlDS</attribute>
<attribute name="Dialect">net.sf.hibernate.dialect.MySQLDialect</attribute>
<attribute name="ShowSql">true</attribute>
<attribute name="UserTransactionName">UserTransaction</attribute>
<attribute name="TransactionStrategy">net.sf.hibernate.transaction.JTATransactionFactory</attribute>
<attribute name="TransactionManagerLookupStrategy">net.sf.hibernate.transaction.JBossTransactionManagerLookup</attribute>
</mbean>

</server>
---------------------------------------------


When I make a call from the client app. to a session bean, using code like this:
try {
com.gmms.ee.session.HibernateTest myBean = getHome().create();

System.out.println("1. create bean");

Sen sen = (Sen)myBean.load(Sen.class, new Long(166));
System.out.println("2 find Sen");
String str = sen.getStatus();
System.out.println("3 call Sen.get(.)");
System.out.println("Sen status="+sen.getName());
....

------------
The session bean is like this:

public void ejbCreate() throws javax.ejb.CreateException
{
}


private SessionFactory getSessionFactory() throws NamingException
{
if( _sessionFactory == null )
{
InitialContext initialContext = new InitialContext();
Object factoryRef = initialContext.lookup("GmmsHibernateFactory");

_sessionFactory = ( SessionFactory) PortableRemoteObject.narrow( factoryRef, SessionFactory.class );
}
return _sessionFactory;
}

/**
* @return
* @exception java.sql.SQLException
* @exception NamingException
*/
private Session getSession() throws HibernateException,NamingException
{
return getSessionFactory().openSession();
}

/**
* comment of the fuction.
*
* @ejb.interface-method
* tview-type="remote"
*/
public Object load( Class c, Serializable id )
{
Object ret = null;

logger.debug( "loading object by identity" );

try
{
Session sess = getSession();

ret = sess.load( c, id, LockMode.NONE );
sess.close();
}
catch( Exception ex )
{
logger.error( "load failed " + ex );
}

return ret;
}
------------------------------------- end of session bean ----

At last when I make a call from the client app. the the session bean, The Mbean shows errors like this:

-----------------------------------------------
2004-11-05 14:15:18,204 DEBUG [HibernateTestBean] loading object by identity
2004-11-05 14:15:18,204 INFO [net.sf.hibernate.jmx.HibernateServiceMBean] starting service at JNDI name: GmmsHibernateFactory
2004-11-05 14:15:18,204 INFO [net.sf.hibernate.jmx.HibernateServiceMBean] service properties: {hibernate.session_factory_name=GmmsHibernateFactory, hibernate.transaction.manager_lookup_class=net.sf.hibernate.transaction.JBossTransactionManagerLookup, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.show_sql=true, hibernate.transaction.factory_class=net.sf.hibernate.transaction.JTATransactionFactory, hibernate.connection.datasource=java:/MySqlDS, jta.UserTransaction=UserTransaction}
2004-11-05 14:15:18,205 INFO [net.sf.hibernate.cfg.Configuration] Mapping resource: com/gmms/hibernate/Route.hbm.xml
2004-11-05 14:15:18,210 DEBUG [net.sf.hibernate.util.DTDEntityResolver] trying to locate http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
2004-11-05 14:15:18,210 DEBUG [net.sf.hibernate.util.DTDEntityResolver] found http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
2004-11-05 14:15:18,215 INFO [net.sf.hibernate.cfg.Binder] Mapping class: com.gmms.hibernate.Route -> ROUTE
....

2004-11-05 14:15:22,655 DEBUG [net.sf.hibernate.cfg.Configuration] resolving reference to class: com.gmms.hibernate.Beacon
2004-11-05 14:15:22,655 DEBUG [net.sf.hibernate.cfg.Configuration] resolving reference to class: com.gmms.hibernate.NotificationScheme
2004-11-05 14:15:22,655 ERROR [HibernateTestBean] load failed net.sf.hibernate.LazyInitializationException: Hibernate lazy instantiation problem


--------

The client app log is as bellow:
------------
1. create bean
2 find Sen
Exception in thread "main" java.lang.NullPointerException
at com.gmms.ee.client.HibernateTestClient.testBean(HibernateTestClient.java:55)
at com.gmms.ee.client.HibernateTestClient.main(HibernateTestClient.java:79)

-------------------
logs of both sides show the there is no problem on the topics published on Hibernate and Jboss web site. --> The session bean get the JNDI of the mbean and even get the object of the table row. Unfortunately, When the session really retrieve the data properties of the class, the Hibernate is broken.


Another peice info may be usful: for The SEN table is the test, there is a CMP bean is deployed in the JBoss server. Does it matter? CMP and Hibernate share one DS?

Any idea is appreciated.


Charles Wang


Top
 Profile  
 
 Post subject: additional infomation for the thread
PostPosted: Fri Nov 05, 2004 6:44 pm 
Newbie

Joined: Fri Nov 05, 2004 4:29 pm
Posts: 6
Another piece info. may be usful: for The SEN table in the test, there is a CMP bean SenBean is deployed in the JBoss server. Does it matter? CMP and Hibernate share one DS?

Thanks.


Top
 Profile  
 
 Post subject: furthermore info.
PostPosted: Fri Nov 05, 2004 8:41 pm 
Newbie

Joined: Fri Nov 05, 2004 4:29 pm
Posts: 6
Now I'm sure that CMP is not related this problem. I did a demo in which the Hibernate Mbean points to another Mysql DB which there is no CMP beans point to the DB. The problem still be there.
-----------------
Another problem I mete is about my middletgen 2.1. I use it to read my Mysql database with targets to [middlegen]->hbm.xml, [hbm2java]->java class, [hibernatedoclet]->files for my Mbean sar. I had exception at [hibernatedoclet] step. Fortunately, the jboss-service.xml is still generated anyway. So, I made a little changes in the jboss-service.xml and go on to make the sar.

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

middlegen:
[mkdir] Created dir: /gmms_dev/workspace/monsoon_2_ee/middlegen-2.1/monsoon_2/build/gen-src
[middlegen] Database URL:jdbc:mysql://192.168.2.21/demo
[middlegen] No <table> elements specified. Reading all tables. This might take a while...
[middlegen] ********************************************************
[middlegen] * CTRL-Click relations to modify their cardinality *
[middlegen] * SHIFT-Click relations to modify their directionality *
[middlegen] ********************************************************
[middlegen] Extracting foreign keys for table : USER
[middlegen] -- USER-has-CUSTOMER
[middlegen] Extracting foreign keys for table : CUSTOMER
[middlegen] Updated preferences in /gmms_dev/workspace/monsoon_2_ee/middlegen-2.1/monsoon_2/src/com.gmms-prefs.properties

[mkdir] Created dir: /gmms_dev/workspace/monsoon_2_ee/middlegen-2.1/monsoon_2/build/classes


hbm2java:
[hbm2java] Processing 2 files.
[hbm2java] Building hibernate objects

hibernatedoclet:
[hibernatedoclet] Generating jboss service descriptor
[hibernatedoclet] Generating mapping file for com.gmms.hibernate.User.
[hibernatedoclet] com.gmms.hibernate.User
[hibernatedoclet] Generating mapping file for com.gmms.hibernate.Customer.
[hibernatedoclet] com.gmms.hibernate.Customer
[hibernatedoclet] 2004-11-05 16:15:10,139 ERROR [xdoclet.XDocletMain.start] Running XDoclet failed.
[hibernatedoclet] 2004-11-05 16:15:10,140 ERROR [xdoclet.XDocletMain.start] <<Composite ID property of type java.lang.Object is invalid. It has to be serializable and reimplement equals(Object)>>
[hibernatedoclet] /gmms_dev/workspace/monsoon_2_ee/middlegen-2.1/monsoon_2/build.xml:814: XDoclet failed.
[hibernatedoclet] at xdoclet.DocletTask.start(DocletTask.java:471)
[hibernatedoclet] at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:110)
[hibernatedoclet] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[hibernatedoclet] at org.apache.tools.ant.Task.perform(Task.java:364)
[hibernatedoclet] at org.apache.tools.ant.Target.execute(Target.java:341)
[hibernatedoclet] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[hibernatedoclet] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
[hibernatedoclet] at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
[hibernatedoclet] at org.apache.tools.ant.Main.runBuild(Main.java:673)
[hibernatedoclet] at org.apache.tools.ant.Main.startAnt(Main.java:188)
[hibernatedoclet] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
[hibernatedoclet] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
[hibernatedoclet] Caused by: xdoclet.XDocletException: Composite ID property of type java.lang.Object is invalid. It has to be serializable and reimplement equals(Object)
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateTagsHandler.hasCompositeId_Impl(HibernateTagsHandler.java:727)
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateTagsHandler.ifHasCompositeId(HibernateTagsHandler.java:199)
[hibernatedoclet] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[hibernatedoclet] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[hibernatedoclet] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[hibernatedoclet] at java.lang.reflect.Method.invoke(Method.java:324)
[hibernatedoclet] at xdoclet.template.TemplateEngine.invoke(TemplateEngine.java:638)
[hibernatedoclet] at xdoclet.template.TemplateEngine.invokeMethod(TemplateEngine.java:564)
[hibernatedoclet] at xdoclet.template.TemplateEngine.invokeBlockMethod(TemplateEngine.java:962)
[hibernatedoclet] at xdoclet.template.TemplateEngine.handleBlockTag(TemplateEngine.java:929)
[hibernatedoclet] at xdoclet.template.TemplateEngine.handleTag(TemplateEngine.java:469)
[hibernatedoclet] at xdoclet.template.TemplateEngine.generate(TemplateEngine.java:347)
[hibernatedoclet] at xdoclet.template.TemplateEngine.start(TemplateEngine.java:414)
[hibernatedoclet] at xdoclet.TemplateSubTask.startEngine(TemplateSubTask.java:561)
[hibernatedoclet] at xdoclet.TemplateSubTask.generateForClass(TemplateSubTask.java:778)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcessPerClass(TemplateSubTask.java:678)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcess(TemplateSubTask.java:595)
[hibernatedoclet] at xdoclet.XmlSubTask.startProcess(XmlSubTask.java:198)
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateSubTask.execute(HibernateSubTask.java:123)
[hibernatedoclet] at xdoclet.XDocletMain.start(XDocletMain.java:48)
[hibernatedoclet] at xdoclet.DocletTask.start(DocletTask.java:468)
[hibernatedoclet] ... 11 more
[hibernatedoclet] --- Nested Exception ---
[hibernatedoclet] xdoclet.XDocletException: Composite ID property of type java.lang.Object is invalid. It has to be serializable and reimplement equals(Object)
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateTagsHandler.hasCompositeId_Impl(HibernateTagsHandler.java:727)
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateTagsHandler.ifHasCompositeId(HibernateTagsHandler.java:199)
[hibernatedoclet] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[hibernatedoclet] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[hibernatedoclet] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[hibernatedoclet] at java.lang.reflect.Method.invoke(Method.java:324)
[hibernatedoclet] at xdoclet.template.TemplateEngine.invoke(TemplateEngine.java:638)
[hibernatedoclet] at xdoclet.template.TemplateEngine.invokeMethod(TemplateEngine.java:564)
[hibernatedoclet] at xdoclet.template.TemplateEngine.invokeBlockMethod(TemplateEngine.java:962)
[hibernatedoclet] at xdoclet.template.TemplateEngine.handleBlockTag(TemplateEngine.java:929)
[hibernatedoclet] at xdoclet.template.TemplateEngine.handleTag(TemplateEngine.java:469)
[hibernatedoclet] at xdoclet.template.TemplateEngine.generate(TemplateEngine.java:347)
[hibernatedoclet] at xdoclet.template.TemplateEngine.start(TemplateEngine.java:414)
[hibernatedoclet] at xdoclet.TemplateSubTask.startEngine(TemplateSubTask.java:561)
[hibernatedoclet] at xdoclet.TemplateSubTask.generateForClass(TemplateSubTask.java:778)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcessPerClass(TemplateSubTask.java:678)
[hibernatedoclet] at xdoclet.TemplateSubTask.startProcess(TemplateSubTask.java:595)
[hibernatedoclet] at xdoclet.XmlSubTask.startProcess(XmlSubTask.java:198)
[hibernatedoclet] at xdoclet.modules.hibernate.HibernateSubTask.execute(HibernateSubTask.java:123)
[hibernatedoclet] at xdoclet.XDocletMain.start(XDocletMain.java:48)
[hibernatedoclet] at xdoclet.DocletTask.start(DocletTask.java:468)
[hibernatedoclet] at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:110)
[hibernatedoclet] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[hibernatedoclet] at org.apache.tools.ant.Task.perform(Task.java:364)
[hibernatedoclet] at org.apache.tools.ant.Target.execute(Target.java:341)
[hibernatedoclet] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[hibernatedoclet] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
[hibernatedoclet] at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
[hibernatedoclet] at org.apache.tools.ant.Main.runBuild(Main.java:673)
[hibernatedoclet] at org.apache.tools.ant.Main.startAnt(Main.java:188)
[hibernatedoclet] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
[hibernatedoclet] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)

BUILD FAILED
/gmms_dev/workspace/monsoon_2_ee/middlegen-2.1/monsoon_2/build.xml:814: Unexpected error

Total time: 12 seconds




What does the exception "<Composite ID property of type java.lang.Object is invalid. It has to be serializable and reimplement equals(Object)>>" mean? Does this cause the later Lazy problem at run time??

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

I did another simple test for only two tables, one - many. Shows, I get session, but I can't test to load the Customer with a existing id in database.

at client side log shows:

1. create bean
Customer Load failed!

at jboss mbean server side: log showes:

2004-11-05 16:02:33,145 DEBUG [net.sf.hibernate.cfg.Configuration] resolving reference to class: com.gmms.hibernate.Customer
2004-11-05 16:02:33,146 ERROR [HibernateTestBean] load failed net.sf.hibernate.LazyInitializationException: Hibernate lazy instantiation problem

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

That's all of the story of the Hibernate Lazy problem


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 05, 2004 8:50 pm 
Newbie

Joined: Fri Nov 05, 2004 4:29 pm
Posts: 6
I was wrong at the first post about "I even got the bb table row by the id number. Actually, The Hibernate Mbean didn't.


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.