You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Marco Schulze <Ma...@NightLabs.de> on 2004/02/11 14:09:51 UTC

JDO in JBoss?

Hello!

I'm new to Apache OJB and I've the following problem: I'd like to use 
the JDO-API of OJB in EJBs within a JBoss-Server. Unfortunately, only 
two of the three supported APIs are registered in the JNDI:

- ojb/PBAPI
- ojb/defaultODMG

JDO is not registered in JNDI. Thus, I can't look it up. What do I have 
to do?

Anyway I tried to get JDO running within an EJB (stateful SessionBean) 
with the following code:

    Product product = new Product();
    product.setProductName("Notebook Fujitsu-Siemens");
    product.setPrice(1333.99f);
    PersistenceManager pm = pmFactory.getPersistenceManager();
    Transaction tx = pm.currentTransaction();
    tx.begin();
    pm.makePersistent(product);
    tx.commit();
    pm.close();

The tx.begin() causes a java.lang.UnsupportedOperationException: Not 
supported in managed environment

If I don't do a tx.begin(), pm.makePersistent(...) causes a 
javax.jdo.JDOUserException: Transaction is not active.

Can you please help me with a simple example bean and a short howto to 
register JDO in JNDI with JBoss?

Thousand thanks in advance!!!

Best regards, Marco ;-)

-- 
No software patents in Europe!!! Logic
patents are weapons in the hand of big
companies to destroy smaller competitors,
that can't finance expensive lawsuits!
...and our company will surely die, too,
if software patents become reality here!
...and don't forget that all software
will get much more expensive to finance
patent researches.

*** http://petition.eurolinux.org/ ***
*** http://www.ffii.org/ ***



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


Re: JDO in JBoss?

Posted by A Leg <ha...@yahoo.com>.
Thank's Armin

I have been afraid for some long minutes but now it is OK. I use Pb on 
my side and it works OK.
I will ot move to JDO before JDO get stabilized on sun and ojb sides. So 
it's all good!

Best regards

Andre Legendre

Armin Waibel wrote:

> Hi Andre,
>
> A Leg wrote:
>
>> Hello
>>
>> Does that mean that it is no way to get ojb work with Jboss ?
>
>
> No, only the current JDO/Jdori based JDO-api implementation was not 
> supported.
> PB-api and ODMG-api work since 0.9x
>
>> Does that mean that it is no way to get ojb with any application 
>> server ?
>>
>
> No, don't panic! Same as above.
>
> regards,
> Armin
>
>> Excuse me with these questions but I was supposing it was working, 
>> but never try before ending my application.
>>
>> Best regards
>>
>> Andre Legendre
>>
>> Armin Waibel wrote:
>>
>>> Hi Marco,
>>>
>>> Marco Schulze wrote:
>>>
>>>> Hello!
>>>>
>>>> I'm new to Apache OJB and I've the following problem: I'd like to 
>>>> use the JDO-API of OJB in EJBs within a JBoss-Server. 
>>>> Unfortunately, only two of the three supported APIs are registered 
>>>> in the JNDI:
>>>>
>>>> - ojb/PBAPI
>>>> - ojb/defaultODMG
>>>
>>>
>>>
>>>
>>> yes, currently it's not official support
>>>
>>>>
>>>> JDO is not registered in JNDI. Thus, I can't look it up. What do I 
>>>> have to do?
>>>
>>>
>>>
>>>
>>> you can try to write a similar mbean for jdo/jdori implementation, 
>>> or you can use PM directly in code.
>>>
>>>>
>>>> Anyway I tried to get JDO running within an EJB (stateful 
>>>> SessionBean) with the following code:
>>>>
>>>> Product product = new Product();
>>>> product.setProductName("Notebook Fujitsu-Siemens");
>>>> product.setPrice(1333.99f);
>>>> PersistenceManager pm = pmFactory.getPersistenceManager();
>>>> Transaction tx = pm.currentTransaction();
>>>> tx.begin();
>>>> pm.makePersistent(product);
>>>> tx.commit();
>>>> pm.close();
>>>>
>>>> The tx.begin() causes a java.lang.UnsupportedOperationException: 
>>>> Not supported in managed environment
>>>
>>>
>>>
>>>
>>> In managed environments it's not allowed to start a local tx, only 
>>> JTA UserTransaction are allowed.
>>>
>>>>
>>>> If I don't do a tx.begin(), pm.makePersistent(...) causes a 
>>>> javax.jdo.JDOUserException: Transaction is not active.
>>>>
>>>
>>> I never tried to make to work in managed environments (e.g. 
>>> OjbStoreConnector needs modification), because current 
>>> implementation is only a prototype and we will start with the JDO 
>>> implementation immediate after 1.0 release.
>>>
>>> Thus you can use current JDO implementation only in beans without 
>>> JTA transaction (means no distributed transactions) no cm-tx. So if 
>>> you don't enable the org.apache.ojb.odmg.JTATxManager in 
>>> OJB.properties you should be able to run JDO within a bean.
>>>
>>> regards,
>>> Armin
>>>
>>>> Can you please help me with a simple example bean and a short howto 
>>>> to register JDO in JNDI with JBoss?
>>>
>>>
>>>
>>>
>>>
>>>
>>>>
>>>> Thousand thanks in advance!!!
>>>>
>>>> Best regards, Marco ;-)
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>



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


Re: JDO in JBoss?

Posted by Armin Waibel <ar...@apache.org>.
Hi Andre,

A Leg wrote:
> Hello
> 
> Does that mean that it is no way to get ojb work with Jboss ?

No, only the current JDO/Jdori based JDO-api implementation was not 
supported.
PB-api and ODMG-api work since 0.9x

> Does that mean that it is no way to get ojb with any application server ?
> 

No, don't panic! Same as above.

regards,
Armin

> Excuse me with these questions but I was supposing it was working, but 
> never try before ending my application.
> 
> Best regards
> 
> Andre Legendre
> 
> Armin Waibel wrote:
> 
>> Hi Marco,
>>
>> Marco Schulze wrote:
>>
>>> Hello!
>>>
>>> I'm new to Apache OJB and I've the following problem: I'd like to use 
>>> the JDO-API of OJB in EJBs within a JBoss-Server. Unfortunately, only 
>>> two of the three supported APIs are registered in the JNDI:
>>>
>>> - ojb/PBAPI
>>> - ojb/defaultODMG
>>
>>
>>
>> yes, currently it's not official support
>>
>>>
>>> JDO is not registered in JNDI. Thus, I can't look it up. What do I 
>>> have to do?
>>
>>
>>
>> you can try to write a similar mbean for jdo/jdori implementation, or 
>> you can use PM directly in code.
>>
>>>
>>> Anyway I tried to get JDO running within an EJB (stateful 
>>> SessionBean) with the following code:
>>>
>>> Product product = new Product();
>>> product.setProductName("Notebook Fujitsu-Siemens");
>>> product.setPrice(1333.99f);
>>> PersistenceManager pm = pmFactory.getPersistenceManager();
>>> Transaction tx = pm.currentTransaction();
>>> tx.begin();
>>> pm.makePersistent(product);
>>> tx.commit();
>>> pm.close();
>>>
>>> The tx.begin() causes a java.lang.UnsupportedOperationException: Not 
>>> supported in managed environment
>>
>>
>>
>> In managed environments it's not allowed to start a local tx, only JTA 
>> UserTransaction are allowed.
>>
>>>
>>> If I don't do a tx.begin(), pm.makePersistent(...) causes a 
>>> javax.jdo.JDOUserException: Transaction is not active.
>>>
>>
>> I never tried to make to work in managed environments (e.g. 
>> OjbStoreConnector needs modification), because current implementation 
>> is only a prototype and we will start with the JDO implementation 
>> immediate after 1.0 release.
>>
>> Thus you can use current JDO implementation only in beans without JTA 
>> transaction (means no distributed transactions) no cm-tx. So if you 
>> don't enable the org.apache.ojb.odmg.JTATxManager in OJB.properties 
>> you should be able to run JDO within a bean.
>>
>> regards,
>> Armin
>>
>>> Can you please help me with a simple example bean and a short howto 
>>> to register JDO in JNDI with JBoss?
>>
>>
>>
>>
>>
>>>
>>> Thousand thanks in advance!!!
>>>
>>> Best regards, Marco ;-)
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 

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


Re: JDO in JBoss?

Posted by A Leg <ha...@yahoo.com>.
Hello

Does that mean that it is no way to get ojb work with Jboss ?
Does that mean that it is no way to get ojb with any application server ?

Excuse me with these questions but I was supposing it was working, but 
never try before ending my application.

Best regards

Andre Legendre

Armin Waibel wrote:

> Hi Marco,
>
> Marco Schulze wrote:
>
>> Hello!
>>
>> I'm new to Apache OJB and I've the following problem: I'd like to use 
>> the JDO-API of OJB in EJBs within a JBoss-Server. Unfortunately, only 
>> two of the three supported APIs are registered in the JNDI:
>>
>> - ojb/PBAPI
>> - ojb/defaultODMG
>
>
> yes, currently it's not official support
>
>>
>> JDO is not registered in JNDI. Thus, I can't look it up. What do I 
>> have to do?
>
>
> you can try to write a similar mbean for jdo/jdori implementation, or 
> you can use PM directly in code.
>
>>
>> Anyway I tried to get JDO running within an EJB (stateful 
>> SessionBean) with the following code:
>>
>> Product product = new Product();
>> product.setProductName("Notebook Fujitsu-Siemens");
>> product.setPrice(1333.99f);
>> PersistenceManager pm = pmFactory.getPersistenceManager();
>> Transaction tx = pm.currentTransaction();
>> tx.begin();
>> pm.makePersistent(product);
>> tx.commit();
>> pm.close();
>>
>> The tx.begin() causes a java.lang.UnsupportedOperationException: Not 
>> supported in managed environment
>
>
> In managed environments it's not allowed to start a local tx, only JTA 
> UserTransaction are allowed.
>
>>
>> If I don't do a tx.begin(), pm.makePersistent(...) causes a 
>> javax.jdo.JDOUserException: Transaction is not active.
>>
>
> I never tried to make to work in managed environments (e.g. 
> OjbStoreConnector needs modification), because current implementation 
> is only a prototype and we will start with the JDO implementation 
> immediate after 1.0 release.
>
> Thus you can use current JDO implementation only in beans without JTA 
> transaction (means no distributed transactions) no cm-tx. So if you 
> don't enable the org.apache.ojb.odmg.JTATxManager in OJB.properties 
> you should be able to run JDO within a bean.
>
> regards,
> Armin
>
>> Can you please help me with a simple example bean and a short howto 
>> to register JDO in JNDI with JBoss?
>
>
>
>
>>
>> Thousand thanks in advance!!!
>>
>> Best regards, Marco ;-)
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>



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


Re: JDO in JBoss?

Posted by Armin Waibel <ar...@apache.org>.
Hi Marco,

Marco Schulze wrote:

> Hello!
> 
> I'm new to Apache OJB and I've the following problem: I'd like to use 
> the JDO-API of OJB in EJBs within a JBoss-Server. Unfortunately, only 
> two of the three supported APIs are registered in the JNDI:
> 
> - ojb/PBAPI
> - ojb/defaultODMG

yes, currently it's not official support

> 
> JDO is not registered in JNDI. Thus, I can't look it up. What do I have 
> to do?

you can try to write a similar mbean for jdo/jdori implementation, or 
you can use PM directly in code.

> 
> Anyway I tried to get JDO running within an EJB (stateful SessionBean) 
> with the following code:
> 
>    Product product = new Product();
>    product.setProductName("Notebook Fujitsu-Siemens");
>    product.setPrice(1333.99f);
>    PersistenceManager pm = pmFactory.getPersistenceManager();
>    Transaction tx = pm.currentTransaction();
>    tx.begin();
>    pm.makePersistent(product);
>    tx.commit();
>    pm.close();
> 
> The tx.begin() causes a java.lang.UnsupportedOperationException: Not 
> supported in managed environment

In managed environments it's not allowed to start a local tx, only JTA 
UserTransaction are allowed.

> 
> If I don't do a tx.begin(), pm.makePersistent(...) causes a 
> javax.jdo.JDOUserException: Transaction is not active.
> 

I never tried to make to work in managed environments (e.g. 
OjbStoreConnector needs modification), because current implementation is 
only a prototype and we will start with the JDO implementation immediate 
after 1.0 release.

Thus you can use current JDO implementation only in beans without JTA 
transaction (means no distributed transactions) no cm-tx. So if you 
don't enable the org.apache.ojb.odmg.JTATxManager in OJB.properties you 
should be able to run JDO within a bean.

regards,
Armin

> Can you please help me with a simple example bean and a short howto to 
> register JDO in JNDI with JBoss?



> 
> Thousand thanks in advance!!!
> 
> Best regards, Marco ;-)
> 

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