-->
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.  [ 19 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: SerssionFactory Problem
PostPosted: Fri Nov 18, 2005 6:08 am 
Beginner
Beginner

Joined: Fri Nov 18, 2005 5:49 am
Posts: 23
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

[b]Hibernate version:[/b]

[b]Mapping documents:[/b]

[b]Code between sessionFactory.openSession() and session.close():[/b]

[b]Full stack trace of any exception that occurs:[/b]

[b]Name and version of the database you are using:[/b]

[b]The generated SQL (show_sql=true):[/b]

[b]Debug level Hibernate log excerpt:[/b]

I am using Hibernate 3.0 with Weblogic 9.0. I have deployed a session bean successfully. This session bean tries to obtain a hibernate session factory. But to my surpisre, nothing is happening.

Hibernate works fine, if it is a plain java application. The problem is from an EJB application.

Could any one help me in this regard


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 18, 2005 8:20 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
Do you have a stacktrace ?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 18, 2005 8:53 am 
Beginner
Beginner

Joined: Fri Nov 18, 2005 5:49 am
Posts: 23
steckemetz wrote:
Do you have a stacktrace ?


Thank u very much

I dont have a stack trace

Even though logging is enabled. Nothing shows up on the console.

No error is thrown.



For example

System.out.Println("Before") ;

SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();

System.out.Println("After") ;


It only prints Before on the console. Afterwards it is blank


Top
 Profile  
 
 Post subject: Very critical for us. we are not able to proceed further
PostPosted: Fri Nov 18, 2005 9:09 am 
Beginner
Beginner

Joined: Fri Nov 18, 2005 5:49 am
Posts: 23
SESHADRIMK wrote:
steckemetz wrote:
Do you have a stacktrace ?


Thank u very much

I dont have a stack trace

Even though logging is enabled. Nothing shows up on the console.

No error is thrown.



For example

System.out.Println("Before") ;

SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();

System.out.Println("After") ;


It only prints Before on the console. Afterwards it is blank


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 18, 2005 10:00 am 
Newbie

Joined: Thu Nov 17, 2005 12:59 pm
Posts: 18
Quote:
new Configuration().configure().buildSessionFactory();


I think it will be right to configure SessionFactory as JNDI resource and obtain factory throught JNDI. See documentation for details


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 21, 2005 1:12 am 
Beginner
Beginner

Joined: Fri Nov 18, 2005 5:49 am
Posts: 23
bilyush wrote:
Quote:
new Configuration().configure().buildSessionFactory();


I think it will be right to configure SessionFactory as JNDI resource and obtain factory throught JNDI. See documentation for details



I have defined a JNDI for Datasource in the Weblogic administrator . This I am able to access externally also by lookup. This JNDI datasource is being referred in hibernate.cfg.xml file.

But, new Configuration().configure().buildSessionFactory(); is not working properly.

I have seen the documentation. I am not able to figure out what is the problem. This is very critical for us to proceed further.

Pl help us in solving the problem.

Meanwhile I will also try my best to figure out the solution.

Regards

Seshadri


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 21, 2005 3:28 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
The no args Configuration().configure() call only works if the main conf file is named exactly hibernate.cfg.xml and it is in the classpath ... you have this?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 21, 2005 3:30 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
what happens if you try to build the configuration manually ... or explicitly tell it where the file is with .configure(new File("/some/path/file.xml")) ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 21, 2005 4:31 am 
Beginner
Beginner

Joined: Fri Nov 18, 2005 5:49 am
Posts: 23
dennisbyrne wrote:
what happens if you try to build the configuration manually ... or explicitly tell it where the file is with .configure(new File("/some/path/file.xml")) ?



Thank you for ur continuous response on this issue.

I have tried giving the name of the config file. i.e hibernate.cfg.xml

I have tried placing the file in the root and also in a separate directory (in this case i specified the path also).

Nothing has worked out for me..

Alos I want to bring this point to your notice.

I tired the following code

Configuration cfg ;

System.out.println("Before cfg");
cfg = new Configuration() ;
System.out.println("After cfg");

Here also i get the message "Before cfg" on the console. After that the console is blank. I dont get the message "After cfg"

Regards

Seshadri (Bangalore , India)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 21, 2005 11:31 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
SESHADRIMK wrote:
Configuration cfg ;

System.out.println("Before cfg");
cfg = new Configuration() ;
System.out.println("After cfg");


Uhm, so what happens when you call the the various overloaded versions of the configure method, as in my example?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 21, 2005 11:38 am 
Beginner
Beginner

Joined: Thu Aug 11, 2005 5:19 am
Posts: 29
Well I supose it sure means, that you are having some kind of exception on calling

cfg = new Configuration() ;

Most probably your application can't find some libraries. You have to find out, how to see this exception.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 2:14 am 
Beginner
Beginner

Joined: Fri Nov 18, 2005 5:49 am
Posts: 23
dennisbyrne wrote:
SESHADRIMK wrote:
Configuration cfg ;

System.out.println("Before cfg");
cfg = new Configuration() ;
System.out.println("After cfg");


Uhm, so what happens when you call the the various overloaded versions of the configure method, as in my example?



Same old story. This problem occurs only when hibernate is called from a session bean.

Regards

Seshadri


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 2:16 am 
Beginner
Beginner

Joined: Fri Nov 18, 2005 5:49 am
Posts: 23
Danny L. wrote:
Well I supose it sure means, that you are having some kind of exception on calling

cfg = new Configuration() ;

Most probably your application can't find some libraries. You have to find out, how to see this exception.


Thanks for ur responce.

This problem occurs only when hibernate is called from a session bean.

Regards

Seshadri


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 2:22 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
what happens if you try programmatic configuration? http://www.hibernate.org/hib_docs/v3/re ... ation.html


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 4:02 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
can you try something like:
Code:
try {

cfg = new Configuration();

catch( Throwable t ) {
t.printStacktrace();
}



Usually throwable should not be catched I think.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 19 posts ]  Go to page 1, 2  Next

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.