Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

EAServer, ClassLoader, Hibernate

12 views
Skip to first unread message

Jeffrey Voight

unread,
Oct 25, 2004, 9:39:01 AM10/25/04
to
I'm having issues getting Hibernate working inside EAServer as
instantiated from a Service.

I've implemented a Service component, and during initialization, it
calls on some hibernate classes. As hibernate starts, it grabs a
Configuration. During the Configuration initialization, Configuration
calls Thread.currentThread().getContextClassLoader().stuff.

The problem is that EAServer returns null from the
getContextClassLoader() call. More research indicated that EAServer is
allowed to return null if the class loader is the bootstrap class loader.

How can I convince EAServer (4.2.2) to utilize a different class loader?

Jeff...

Dave Wolf

unread,
Oct 25, 2004, 3:37:10 PM10/25/04
to
I am assuming the issue is that a service component is not an EJB and hence
isnt a part of the J2EE spec requirements for support of
getContextClassLoader. You should open a case with support and get Sybase's
opinion.

Dave Wolf
Cynergy Systems
http://www.cynergysystems.com


"Jeffrey Voight" <jeff....@sybase.com> wrote in message
news:417d01f5@forums-1-dub...

jeffreyvoight

unread,
Nov 2, 2004, 7:37:36 AM11/2/04
to
Well, I hacked up the Hibernate Configure.java to eliminate
getContextClassLoader and everything works fine, now.

Now, I'm up against a different hurdle: How to get hibernate
to perform the jndi lookup of the datasource. It seems to
fail. I'd like to be able to tell you the exception, but
instead, I get the '.... 9 more' message. I guess that's to
save my eyes from the horror that might be lurking there.
The final exception is a ClassCastException but I suspect
that it's actually failing the JNDI lookup instead.

In hibernate.cfg.xml, I'm limitted to a single line
connection lookup thingbob. I can't tell it my
jagadmin/passwd, give it odd contexts, or any of the stuff
that I'd normally use to start troubleshooting. Instead,
all we get is a line where we can put
java:comp/env/jdbc/connName. I'm using a copy of a
hibernate.cfg.xml that works in WebApplications, but since
I'm running my portion as a service, am I coming up against
restrictions placed there on purpose?

Also, any idea how to convince jaguar to not truncate the
exceptions?

Jeff...

Dave Wolf

unread,
Nov 2, 2004, 10:34:45 AM11/2/04
to
Its not EAS truncating the stack its the VM.

You can unwind the stack yourself pretty easily. See

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Throwable.html#getStackTrace()

My guess would be it is expecting a DataSource and getting a Connection
or vice versa.

Dave Wolf
Cynergy Systems
http://www.cynergysystems.com

Peter Abbott

unread,
Nov 2, 2004, 1:37:43 PM11/2/04
to
I am not sure that you can use jndi lookups with service components in
EAServer.

What I have found in the past is that sometimes instead of throwing an
exception to say it doesnt exist it returns a NamingContext object so
when you try to cast it as a DataSource it cant.

Pete

kishorisharan

unread,
Dec 16, 2009, 4:11:27 PM12/16/09
to
I ran into the same issue. I got two ways to fix it.
1. Tshi one is easy. We did not have hibernate.properties
file added to our EJB ajr. Adding hibernate.properties file
fixed the problem.

2. Before applying fixed as mentioned in step 1, I got rid
of exception by upzipping all hibernate classes and jarring
them with my EJB jar itself.

Thanks
Kishori

0 new messages