hivemind-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Bulling <s...@phoenix.hadiko.de>
Subject Hivetranse/Hibernate/Tapestry troubles
Date Wed, 22 Feb 2006 11:30:48 GMT
Hi everybody,

after trying to get Hivetranse/Hibernate/Tapestry to work for days
I'm in great despair now because it just doesn't work :(

As the subject says I want to use Hivetranse with Hibernate and
Tapestry as frontend but I wasn't able to find any document describing
this setup. So I hope somebody on this list can help me - Thanks in
advance!

What I did so far:

I followed the descriptions on the Hivetranse site to setup Hibernate3
(http://hivetranse.sourceforge.net/quickstart.html#start.config.hibernate3)

I've put several POJOs and corresponding DAO classes in hivemodule.xml.
For example:
---
<service-point id="PersonDao" interface="de.test.plattform.dao.PersonDao">
    <invoke-factory>
		<construct class="de.test.plattform.dao.PersonDaoImpl">
			<set-service property="session" service-id="hibernateSession" />
		</construct>
    </invoke-factory>
    <interceptor service-id="hivetranse.core.TransactionInterceptor"/>
</service-point>
---

I also want to have one "operations" class which makes use of all the different
DAOs, so I added:
---
<service-point id="Operations" interface="de.test.plattform.dao.Operations">
    <invoke-factory>
		<construct class="de.test.plattform.dao.OperationsImpl">
			<set-service property="personDao" service-id="PersonDao" />
			...
        </construct>
    </invoke-factory>
    <interceptor service-id="hivetranse.core.TransactionInterceptor"/>
</service-point>
---
The first problem was, that the <service> element mentioned in the document
didn't seem to work that's why you can see all these <set-service> elements.

1) What's the difference between <service> and <set-service> and can I
add serveral <service> element below the <construct> element?

Another problem was autowiring. First I got errors that 
---
Exception invoking listener method attemptLogin of component Login: Unable
to 
construct service plattform.Operations: Error building service 
plattform.Operations: Unable to find constructor applicable for autowiring. 
Use explicit constructor parameters.
---

2) But I didn't set the constructor method by purpose, autowiring should
be used by default, shouldn't it? What do I need to use autowiring?
My DAO classes have corresponding setter methods (setSession() and
setPersonDao() in operations)

3) Putting hivemodule.xml in META-INF yields the following error:
---
javax.servlet.ServletException: Unable to initialize application servlet: Error at jar:file:/home/andreas/workspace/plattform/context/WEB-INF/lib/hivetranse.core.jar!/META-INF/hivemodule.xml,
line 20, column 59: Configuration point hivetranse.core.TransactionDefaults contains no contributions
but expects exactly one contribution.
	org.apache.tapestry.ApplicationServlet.init(ApplicationServlet.java:206)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
	org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
	org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
	org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
	java.lang.Thread.run(Thread.java:595)
---

So I've put it in WEB-INF but then I have to set config-file to:
---
<service-point id="hibernateSession" interface="org.hibernate.Session">
    <invoke-factory service-id="hivetranse.hibernate3.SessionFactory" model="singleton">
    	<config file="../META-INF/hibernate.cfg.xml">
	        <property name="hibernate.connection.driver_class" value="org.gjt.mm.mysql.Driver"
/>
		<property name="hibernate.connection.password" value="password" />
	        <property name="hibernate.connection.url" value="jdbc:mysql://localhost/plattform"
/>
	        <property name="hibernate.connection.username" value="plattform" />
	        <property name="dialect" value="org.hibernate.dialect.MySQLDialect" />
	        <property name="show_sql" value="false" />
	        <property name="hbm2ddl.auto" value="create" />
        </config>
    </invoke-factory>
</service-point>
---

This works but then I get
---
Unable to construct service plattform.hibernateSession: Could not build SessionFactory
---

4) What's wrong here?

Thanks a lot in advance for any help!
Sincerly,
  Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Mime
View raw message