axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Wheeler <rwhee...@artifact-software.com>
Subject Re: Axis2, Hibernate, and configuration files...
Date Tue, 15 Mar 2011 02:33:02 GMT
On 14/03/2011 9:38 PM, Jacques Poulin wrote:
>
> Hi,
>
> I have a regular java project containing code used by many other 
> projects.  Call it project "SharedProject".
>
> SharedProject has a class which initializes a Hibernate session in its 
> constructor.  Call it ParentClass.
>
> In order to test that project inside Eclipse, I put a 
> hibernate.cfg.xml file in its "src" folder.
>
> Now, I have a web service project, WSProject, which "uses" 
> SharedProject.  In Eclipse terminology, SharedProject shows up in the 
> properties for WSProject, Projects tab.
>
> WSProject has a java class which extends ParentClass, so that when 
> it's constructed (when the service is called for the first time), the 
> Hibernate initialization happens.
>
> In WSProject's ant build file, I include SharedProject's classes, so 
> that they end up in the final .aar file as .class files...
>
> What I want to do is figure out how to make the web service 
> (WSProject) use an EXTERNAL hibernate.cfg.xml file once deployed on a 
> tomcat server.  The reason is that I'll have multiple such web 
> services, and I want them all to use the same configuration file, 
> instead of having each web service having its own hibernate config file...
>
> I tried putting the hibernate.cfg.xml file in the 
> $TOMCAT_HOME/webapps/axis2/WEB-INF directory, but when I start Tomcat, 
> the service gets deployed but it can't find the config file...
>

We built a library that includes the code required to support the 
database and Hibernate access and made all the war projects depend on 
that library.
You still get multiple copies of the cfg file but at least they are all 
the same.

> I also have the <parameter name="ServiceTCCL">composite</parameter> in 
> the services.xml...
>
> Also, as a side question, I would like to be able to use a centralized 
> generic config file (that has nothing to do with Hibernate), again to 
> be used by all web services...  Some kind of properties file, for 
> example config.properties...  Is that possible, and if so, where do I 
> put it ?
>
Are you aware of JNDI? It might help you solve a few of these problems. 
http://blog.artifact-software.com/tech/?p=58


Ron

> Thanks.
>


Mime
View raw message