ode-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Håkon Sagehaug" <Hakon.Sageh...@bccs.uib.no>
Subject Re: Configure hibernate in tomcat
Date Mon, 03 Nov 2008 17:53:14 GMT
hi

the configuration is done inside a web service running inside axis2 1.3 in
tomcat

Håkon

2008/11/3 Håkon Sagehaug <Hakon.Sagehaug@bccs.uib.no>

> Hi
>
> More non ode question, fine if you don't answer, but cant debug this issue
>
> I shifted to use openjpa instead, since i noticed that ode used it and saw
> that this was a good thing. But now may problem is that when trying to
> configure a DataSource I always get
>
> javax.naming.NameNotFoundException: Name java: is not bound in this Context
>
> back, the configuration looks like this
> Context initCtx = null;
>
>     DataSource ds = null;
>     try {
>         initCtx = new InitialContext();
>         // envCtx = (Context) initCtx.lookup("java:/comp/env");
>         ds = (DataSource) initCtx.lookup("java:/comp/env/jdbc/workflowdb");
>     } catch (NamingException e) {
>         // TODO Auto-generated catch block
>         e.printStackTrace();
>     }
>
> propMap.put("openjpa.ConnectionFactory", ds);
>     propMap.put("openjpa.ConnectionFactoryMode", "managed");
>     propMap.put("openjpa.FlushBeforeQueries", "false");
>
>     EntityManagerFactory emf = Persistence.createEntityManagerFactory(
>         "MyOpenJPa", propMap);
>
>     EntityManager em = emf.createEntityManager();
>
> In the service.xml I've got this
>  <Context path="/axis2" docBase="axis2" debug="5" reloadable="true"
> crossContext="true">
>  <Resource name="jdbc/workflowdb" auth="Container"
> type="javax.sql.DataSource"
>                  maxActive="5" maxIdle="5" maxWait="10000"
>                  username="user" password="password"
> driverClassName="org.postgresql.Driver"
>                  url="jdbc:postgresql://hostname/db/>
>  </Context>
>
> I've looked at the ode jpa code and figured out you are doing something
> similar. I've seen that this error can come up when different versions of
> serlvet-api.jar is loaded but only got the one in tomcat/commons/lib
>
> any tips
>
>
> cheers, Håkon
>
> 2008/10/27 Matthieu Riou <matthieu@offthelip.org>
>
> On Mon, Oct 27, 2008 at 2:45 AM, Håkon Sagehaug
>> <Hakon.Sagehaug@bccs.uib.no>wrote:
>>
>> > Hi
>> >
>> > I know this is not a ode question, but noticed that you use hibernate
>> and
>> > tomcat together and was wondering how you are configuring it, by using a
>> > tomcat jndi or pools like c3p0, what is the best?
>> >
>>
>> When configured with an external datasource, we rely on a datasource and
>> connection pool provided by Tomcat that we lookup form the JNDI. I think
>> Tomcat uses DBCP by default. We then provide that to Hibernate:
>>
>>
>> http://svn.apache.org/repos/asf/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/DataSourceConnectionProvider.java
>>
>> Cheers,
>> Matthieu
>>
>>
>> >
>> > I've not found an answer searching or ansking the hibernate forum, any
>> tips
>> >
>> > cheers, håkon
>> >
>> > --
>> > Håkon Sagehaug, Software Developer
>> > Parallab, Bergen Center for Computational Science (BCCS)
>> > UNIFOB AS (University of Bergen Research Company)
>> >
>>
>
>
>
> --
> Håkon Sagehaug, Software Developer
> Parallab, Bergen Center for Computational Science (BCCS)
> UNIFOB AS (University of Bergen Research Company)
>



-- 
Håkon Sagehaug, Software Developer
Parallab, Bergen Center for Computational Science (BCCS)
UNIFOB AS (University of Bergen Research Company)

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message