You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by george georgovassilis <ge...@open.gr> on 2004/12/03 17:55:52 UTC

Hibernate and Cocoon database pool question

Hello List

I am happily using hibernate with cocoon, though through its (that is 
hibernate's) connection pooling, I'd like it now to use cocoon's, run 
into trouble and would as always apreciate your help. I've read through 
http://wiki.apache.org/cocoon/CocoonAndHibernateTutorial and managed to 
have hibernate use the session factory supplied there.

However, when I try to read an hibernated object (here: my.test.Mutex) 
from the database I get an exception (shown below). The class in 
question does reside in the WEB-INF/classes and when using hibernate's 
build in connection pooling it is loaded properly.

A nice weekend everybody
G.




Original Exception: my.test.exceptions.SwiftException: 
my.test.exceptions.SwiftException: my.test.exceptions.SwiftException: 
net.sf.hibernate.MappingException: Unknown entity class: my.test.Mutex
    at my.test.SessionManager.enterTask(SessionManager.java:197)
    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.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:230)
    at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
    at 
org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:1134)
    at 
org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:190)
    at 
org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:138)
    at 
org.mozilla.javascript.continuations.InterpretedFunctionImpl.call(InterpretedFunctionImpl.java:121)
    at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
    at 
org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.callFunction(FOM_JavaScriptInterpreter.java:702)
    at 
org.apache.cocoon.components.treeprocessor.sitemap.CallFunctionNode.invoke(CallFunctionNode.java:130)
    at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:49)
    at 
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
    at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
    at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:126)
    at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
    at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:101)
    at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:336)
    at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:277)
    at 
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:103)
    at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:49)
    at 
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
    at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
    at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:126)
    at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
    at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:101)
    at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:336)
    at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:277)
    at org.apache.cocoon.Cocoon.process(Cocoon.java:639)
    at 
org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1098)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at 
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:354)
    at 
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294)
    at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
    at org.mortbay.http.HttpContext.handle(HttpContext.java:1808)
    at 
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:525)
    at org.mortbay.http.HttpContext.handle(HttpContext.java:1758)
    at org.mortbay.http.HttpServer.service(HttpServer.java:879)
    at org.mortbay.http.HttpConnection.service(HttpConnection.java:790)
    at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:952)
    at org.mortbay.http.HttpConnection.handle(HttpConnection.java:807)
    at 
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:197)
    at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
    at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:501)
Caused by: my.test.exceptions.SwiftException: 
my.test.exceptions.SwiftException: net.sf.hibernate.MappingException: 
Unknown entity class: my.test.Mutex
    at my.test.SessionManager.lockDB(SessionManager.java:227)
    at my.test.SessionManager.enterTask(SessionManager.java:193)
    ... 46 more
Caused by: my.test.exceptions.SwiftException: 
net.sf.hibernate.MappingException: Unknown entity class: my.test.Mutex
    at my.test.SessionManager.loadDBMutex(SessionManager.java:161)
    at my.test.SessionManager.lockDB(SessionManager.java:221)
    ... 47 more
Caused by: net.sf.hibernate.MappingException: Unknown entity class: 
my.test.Mutex
    at 
net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:347)
    at 
net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionImpl.java:2710)
    at 
net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1997)
    at net.sf.hibernate.impl.SessionImpl.get(SessionImpl.java:1936)
    at my.test.SessionManager.loadDBMutex(SessionManager.java:154)


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: [CLOSED] Hibernate and Cocoon database pool question

Posted by Johannes Textor <jc...@gmx.de>.
ok, next time I will read more thoroughly :)

You needed to call configure() because you are using the 
hibernate.cfg.xml file,
as opposed to hibernate.properties used by me and in the tutorial, which 
is read
automatically when the session is created.

I will add this information to the page. thank you for bringing this up :)

regards,
johannes

george georgovassilis wrote:

>> strange, the code in the page works for me and also for some people 
>> who have
>> tested the page. just out of curiosity: which version of Hibernate 
>> are you using ?
>
>
> Yep, that is strange. But I really couldn't get it otherwise to work. 
> I'm doing this on plain cocoon (no tomcat or other app server) with 
> hibernate 2.1.7
> g.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: [CLOSED] Hibernate and Cocoon database pool question

Posted by george georgovassilis <ge...@open.gr>.
> strange, the code in the page works for me and also for some people 
> who have
> tested the page. just out of curiosity: which version of Hibernate are 
> you using ?

Yep, that is strange. But I really couldn't get it otherwise to work. 
I'm doing this on plain cocoon (no tomcat or other app server) with 
hibernate 2.1.7
g.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: [CLOSED] Hibernate and Cocoon database pool question

Posted by Johannes Textor <jc...@gmx.de>.
Hi again George,

strange, the code in the page works for me and also for some people who 
have
tested the page. just out of curiosity: which version of Hibernate are 
you using ?

Regards,
Johannes

george georgovassilis wrote:

> Guten Morgen Johannes
>
> Thank you very much for your help. Your mentioning the Configuration 
> class led me on the right track. One has to 
> cfg.configure().buildSessionFactory() instead of
> cfg.buildSessionFactory() which was practiced in the tutorial. When I 
> changed the code accordingly it also started reading the 
> hibernate.cfg.xml and mapped my classes correctly :-)
>
> Best regards
> G.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


[CLOSED] Hibernate and Cocoon database pool question

Posted by george georgovassilis <ge...@open.gr>.
Guten Morgen Johannes

Thank you very much for your help. Your mentioning the Configuration 
class led me on the right track. One has to 
cfg.configure().buildSessionFactory() instead of
cfg.buildSessionFactory() which was practiced in the tutorial. When I 
changed the code accordingly it also started reading the 
hibernate.cfg.xml and mapped my classes correctly :-)

Best regards
G.


> hi george,
>
> I just started last week to write the below mentioned tutorial and it 
> is not finished yet.
>
> net.sf.hibernate.MappingException: Unknown entity class: my.test.Mutex
>
> I would say that this happens because you did not add the class 
> my.test.Mutex to your
> Hibernate configuration. Can you post the source code of your 
> HibernateFactory class ?
>
> Did you add a statement like the following;
>
> cfg.addClass(my.test.Mutex) ?
>
> How did you add your classes to the hibernate configuration before ?
>
> Regards,
> Johannes
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Hibernate and Cocoon database pool question

Posted by Johannes Textor <jc...@gmx.de>.
hi george,

I just started last week to write the below mentioned tutorial and it is 
not finished yet.

net.sf.hibernate.MappingException: Unknown entity class: my.test.Mutex

I would say that this happens because you did not add the class 
my.test.Mutex to your
Hibernate configuration. Can you post the source code of your 
HibernateFactory class ?

Did you add a statement like the following;

cfg.addClass(my.test.Mutex) ?

How did you add your classes to the hibernate configuration before ?

Regards,
Johannes



george georgovassilis wrote:

> Hello List
>
> I am happily using hibernate with cocoon, though through its (that is 
> hibernate's) connection pooling, I'd like it now to use cocoon's, run 
> into trouble and would as always apreciate your help. I've read 
> through http://wiki.apache.org/cocoon/CocoonAndHibernateTutorial and 
> managed to have hibernate use the session factory supplied there.
>
> However, when I try to read an hibernated object (here: my.test.Mutex) 
> from the database I get an exception (shown below). The class in 
> question does reside in the WEB-INF/classes and when using hibernate's 
> build in connection pooling it is loaded properly.
>
> A nice weekend everybody
> G.
>
>
>
>
> Original Exception: my.test.exceptions.SwiftException: 
> my.test.exceptions.SwiftException: my.test.exceptions.SwiftException: 
> net.sf.hibernate.MappingException: Unknown entity class: my.test.Mutex
>    at my.test.SessionManager.enterTask(SessionManager.java:197)
>    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.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:230)
>    at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
>    at 
> org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:1134) 
>
>    at 
> org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:190) 
>
>    at 
> org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:138) 
>
>    at 
> org.mozilla.javascript.continuations.InterpretedFunctionImpl.call(InterpretedFunctionImpl.java:121) 
>
>    at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
>    at 
> org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.callFunction(FOM_JavaScriptInterpreter.java:702) 
>
>    at 
> org.apache.cocoon.components.treeprocessor.sitemap.CallFunctionNode.invoke(CallFunctionNode.java:130) 
>
>    at 
> org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:49) 
>
>    at 
> org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130) 
>
>    at 
> org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72) 
>
>    at 
> org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:126) 
>
>    at 
> org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72) 
>
>    at 
> org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:101) 
>
>    at 
> org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:336) 
>
>    at 
> org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:277) 
>
>    at 
> org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:103) 
>
>    at 
> org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:49) 
>
>    at 
> org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130) 
>
>    at 
> org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72) 
>
>    at 
> org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:126) 
>
>    at 
> org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72) 
>
>    at 
> org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:101) 
>
>    at 
> org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:336) 
>
>    at 
> org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:277) 
>
>    at org.apache.cocoon.Cocoon.process(Cocoon.java:639)
>    at 
> org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1098)
>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>    at 
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:354)
>    at 
> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294) 
>
>    at 
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
>    at org.mortbay.http.HttpContext.handle(HttpContext.java:1808)
>    at 
> org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:525) 
>
>    at org.mortbay.http.HttpContext.handle(HttpContext.java:1758)
>    at org.mortbay.http.HttpServer.service(HttpServer.java:879)
>    at org.mortbay.http.HttpConnection.service(HttpConnection.java:790)
>    at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:952)
>    at org.mortbay.http.HttpConnection.handle(HttpConnection.java:807)
>    at 
> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:197)
>    at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
>    at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:501)
> Caused by: my.test.exceptions.SwiftException: 
> my.test.exceptions.SwiftException: net.sf.hibernate.MappingException: 
> Unknown entity class: my.test.Mutex
>    at my.test.SessionManager.lockDB(SessionManager.java:227)
>    at my.test.SessionManager.enterTask(SessionManager.java:193)
>    ... 46 more
> Caused by: my.test.exceptions.SwiftException: 
> net.sf.hibernate.MappingException: Unknown entity class: my.test.Mutex
>    at my.test.SessionManager.loadDBMutex(SessionManager.java:161)
>    at my.test.SessionManager.lockDB(SessionManager.java:221)
>    ... 47 more
> Caused by: net.sf.hibernate.MappingException: Unknown entity class: 
> my.test.Mutex
>    at 
> net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:347) 
>
>    at 
> net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionImpl.java:2710) 
>
>    at 
> net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1997)
>    at net.sf.hibernate.impl.SessionImpl.get(SessionImpl.java:1936)
>    at my.test.SessionManager.loadDBMutex(SessionManager.java:154)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org