-->
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.  [ 8 posts ] 
Author Message
 Post subject: At my wits end.....Log4j
PostPosted: Fri Oct 10, 2003 2:01 pm 
Beginner
Beginner

Joined: Sun Oct 05, 2003 9:02 pm
Posts: 27
Location: New York, NY
Ok, this should have been relatively simple, but it hasn't been. I'm simply trying to get Log4J logging to work with Hibernate 2.0.3. The following describes my situation:

--Using Websphere Studio Developer 5.0
--Hibernate is being called from a Stateless Session Bean
--All library JAR files are packaged under the Utility JAR's folder (EAR root directory)
--This include log4j.jar and commons-logging.jar
--I tried placed the sample log4j.properties file everywhere at one point or other, but it never makes a difference (and have set it to debug)
--given that commons-logging.jar is found, having log4j.jar and log4j.properties there should work, but it doesn't.
-- there aren't any other log4j.properties laying around


I do see some logging in the console from Hibernate during configuration, but it only shows messages at the INFO level (and it only shows an 'I', not info.) I don't know where this formatting is coming from....

Any suggestions on what the problem could be would be greatly appreciated. It's very difficult to use the tool without adequate logging...

Thanks,
Brandon


Top
 Profile  
 
 Post subject: more info
PostPosted: Fri Oct 10, 2003 2:13 pm 
Beginner
Beginner

Joined: Sun Oct 05, 2003 9:02 pm
Posts: 27
Location: New York, NY
basically, if i completely remove log4j.jar and log4j.properties from the project, it makes no difference anyway...so obviously they aren't being recognized.

The questions is, in an EAR file, where should they be located and how are they referenced?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 10, 2003 2:19 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Hibernate only calls commons-logging without any special settings. What you experience is the magic of broken Java classloaders and its interpretation by the Jakarta folks. Good luck :)

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


Top
 Profile  
 
 Post subject: How to lose two days and a lot of hair....
PostPosted: Fri Oct 10, 2003 4:00 pm 
Beginner
Beginner

Joined: Sun Oct 05, 2003 9:02 pm
Posts: 27
Location: New York, NY
Apparently, Websphere implements its own specialized version of commons-logging (known as ws-commons-logging.jar)....


IT's not obvious nor easy to find, and it overrides anything you might do in your application....

I ripped it completely out and replaced it with commons-logging and log4j, and that did the trick...

who knows what the consequences will be.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 10, 2003 4:07 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
That made my day :) Thank you :)

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


Top
 Profile  
 
 Post subject: Error on Save: Identifier of an instance altered
PostPosted: Fri Oct 10, 2003 4:36 pm 
Beginner
Beginner

Joined: Sun Oct 05, 2003 9:02 pm
Posts: 27
Location: New York, NY
I have a pretty straight forward one-to-many relationship modeled, and I keep receiving the following error:

CMSProcessor::processAddition--Update Failed net.sf.hibernate.HibernateException: identifier of an instance of forecastingModel.Tunnel altered from 21 to 21

(where 19 is the generated sequence number).


In this scenario, I'm simply creating one new parent and one new child object, adding the child to the parents collection, and then calling session.save(parent).


Here's the segment from my log file, and the mappings for parent and child are below that.

Thanks for any help,
Brandon


16:33:21,304 DEBUG BatcherImpl:166 - about to open: 0 open PreparedStatements, 0 open ResultSets
16:33:21,304 DEBUG SessionFactoryImpl:526 - prepared statement get: select hibernate_sequence.nextval from dual
16:33:21,366 DEBUG SequenceGenerator:70 - Sequence identifier generated: 21
16:33:21,366 DEBUG BatcherImpl:173 - done closing: 0 open PreparedStatements, 0 open ResultSets
16:33:21,382 DEBUG SessionImpl:656 - saving [forecastingModel.Tunnel#21]
16:33:21,398 DEBUG SessionImpl:2520 - Wrapped collection in role: forecastingModel.Tunnel.genericUsages
CMSProcessor::processAddition--save usage
[10/10/03 16:33:21:413 EDT] 4c98f36c SystemOut O CMSProcessor::processAddition--save tunnel 21
[10/10/03 16:33:21:413 EDT] 4c98f36c SystemOut O 16:33:21,413 DEBUG JDBCTransaction:54 - commit
16:33:21,413 DEBUG SessionImpl:2011 - flushing session
16:33:21,429 DEBUG SessionImpl:2113 - Flushing entities and processing referenced collections
16:33:21,429 DEBUG SessionImpl:447 - transaction completion
CMSProcessor::processAddition--Update Failed net.sf.hibernate.HibernateException: identifier of an instance of forecastingModel.Tunnel altered from 21 to 21
[10/10/03 16:33:21:429 EDT] 4c98f36c SystemOut O 16:33:21,429 DEBUG JDBCTransaction:77 - rollback
16:33:21,444 DEBUG SessionImpl:447 - transaction completion
16:33:21,444 DEBUG SessionImpl:435 - closing session
16:33:21,444 DEBUG SessionImpl:2930 - disconnecting session
16:33:21,444 DEBUG DriverManagerConnectionProvider:117 - returning connection to pool, pool size: 1
16:33:21,444 DEBUG SessionImpl:447 - transaction completion



<hibernate-mapping>
<class name="forecastingModel.Tunnel" table="tunnel">
<id
name="tunnelID"
column="tunnel_ID" type="integer">
<generator class="native"/>
</id>


<property name="materialNumber" column="material_number" type="string" length="25"/>
<property name="forecastKey" column="forecast_key" type="string" length="50"/>
<property name="marketType" column="market_type" type="string" length="10"/>
<property name="distributionChannel" column="distribution_channel" type="string" length="10"/>
<property name="clubCode" column="club_code" type="string" length="4"/>
<property name="componentType" column="component_type" type="string" length="10"/>
<property name="usageType" column="usage_type" type="string" length="10"/>
<property name="contentCode" column="content_code" type="string" length="10"/>
<property name="lastMailDate" column="last_mail_date" type="date"/>
<many-to-one name="theAttritionCurve"/>
<many-to-one name="theAutoshipmentCurve"/>
<many-to-one name="theAutoshipmentReturnCurve"/>
<many-to-one name="theAutoReturnInfo"/>
<many-to-one name="theCutoverIndicator"/>
<many-to-one name="thePriceChangeFactor"/>
<many-to-one name="theResponseCurve"/>
<many-to-one name="theSizeChangeFactor"/>
<many-to-one name="theNewMemberGroupingGrid"/>


<list
name="genericUsages"
lazy="true"
inverse="true">
<key column="theTunnel"/>
<index column="sequence_number"/>
<one-to-many class="forecastingModel.GenericUsage"/>
</list>


</class>

</hibernate-mapping>


/*child mapping*/
<hibernate-mapping>
<class name="forecastingModel.GenericUsage" table="generic_usage" discriminator-value="G">

<id name="usageId" column="usage_ID" length="10" type="string">
<generator class="assigned"/>
</id>
<discriminator column="usagetype" type="character"/>
<property name="actualPullRate" column="actual_pull_rate" type="long"/>
<property name="attritionRate" column="attrition_rate" type="long"/>
<property name="cmsPullRate" column="cms_pull_rate" type="long"/>
<property name="componentProductId" column="component_prod_id" type="string" length="10"/>
<property name="cutoverDate" column="cutover_date" type="date"/>
<property name="forecastedDemand" column="forecasted_demand" type="integer"/>
<property name="forecastingPullRate" column="forecasting_pull_rate" type="long"/>
<property name="labelRunDate" column="label_run_date" type="date"/>
<property name="mailDate" column="mail_date" type="date"/>
<property name="materialNumber" column="material_number" type="string" length="10"/>
<property name="membersAddressed" column="members_addressed" type="integer" length="10"/>
<property name="overridePullRate" column="override_pull_rate" type="long"/>
<property name="pageSize" column="page_size" type="long"/>
<property name="pageSizeChangeFactor" column="pagesize_change_factor" type="long"/>
<property name="partialMatchSourceID" column="partial_match_source_id" type="string" length="10"/>
<property name="price" type="long"/>
<property name="priceChangeFactor" column="price_change_factor" type="long"/>

<property name="salesToDate" column="sales_to_date" type="integer"/>
<property name="sequenceNumber" column="sequence_number" type="integer"/>
<property name="channel" type="string" length="10"/>
<property name="clubPrice" column="club_price" type="long"/>
<property name="componentId" column="component_id" type="string" length="10"/>
<property name="componentType" column="component_type" type="string" length="10"/>
<property name="contentCode" column="content_code" type="string" length="10"/>
<property name="countAs" column="count_as" type="integer"/>
<property name="marketType" column="market_type" type="string" length="10"/>
<property name="negativePullRate" column="negative_pull_rate" type="long"/>
<property name="packageId" column="package_id" type="string" length="10"/>
<property name="percentOfPage" column="percent_of_page" type="long"/>
<property name="promoPeriodId" column="promo_period_id" type="string" length="4"/>
<property name="promoScheduleId" column="promo_schedule_id" type="string" length="4"/>
<property name="pullRate" column="pull_rate" type="long"/>
<property name="usageType" column="usage_type" type="string" length="10"/>
<property name="clubCode" column="club_code" type="string" length="4"/>





<subclass name="forecastingModel.CurrentMemberUsage" discriminator-value="C">
<property name="refusalToDate" column="refusal_to_date" type="integer"/>
<many-to-one name="theAutoshipment" class="forecastingModel.Autoshipment"/>
</subclass>

<subclass name="forecastingModel.NewMemberUsage" discriminator-value="N">
<property name="enrollToDate" column="enroll_to_date" type="integer"/>
</subclass>
</class>

</hibernate-mapping>


Top
 Profile  
 
 Post subject: new topic
PostPosted: Fri Oct 10, 2003 4:49 pm 
Beginner
Beginner

Joined: Sun Oct 05, 2003 9:02 pm
Posts: 27
Location: New York, NY
oops, meant to post under a new topic...will move it.

thnx


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 10, 2003 5:22 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Quote:
The questions is, in an EAR file, where should they be located and how are they referenced?


They should be placed in the root of the ear file. Trick is, however, that you must then also modify the manifest file for the ejb jar files inside that ear to include a "manifest classpath" entry of '.'

HTH


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