Hi Julia,
seems like a bug in OJB.
When do database.open(...) OJB
try to lookup a JTA transaction but can not
found.
Could you try start a UserTransaction before
open the database to verify this.
With UserTransaction your test should pass.
> logger.info(THIS_CLASS + "Found odmg factory: " + factory + " and get
> Implementation instance: " + odmg);
>
> Database db = odmg.newDatabase();
> try
> {
userTx.begin();
> db.open("default", Database.OPEN_READ_WRITE);
userTx.commit();
> }
> catch (ODMGException e)
regards,
Armin
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 23, 2003 3:13 PM
Subject: AW: Newbie: JBoss + MySQL
> Hello again,
>
> I'm answering myself .. can anybody help me please?
>
> As I mentioned I have JBoss 3.0.6 and I try to open the database (no
metter
> if with or without the preconfigured and running Datasource). But I
get this
> confusing errors (see stack trace below).
>
> I'm trying to open the Database in Servlet that is in a war-Archive
and not
> in an EJB environment! Is that the reason why I'm getting the errors
with
> the transaction? And as I mentioned I have followed the steps on how
to
> deploy OJB on JBoss. I didn't follow the instructions on how to deploy
in an
> servlet environment because I wanted to able to use my already
configured
> Datasources.
>
> Please help a newbie!!
>
> Julia.
>
> [STDOUT] [org.apache.ojb.broker.core.NamingLocator] INFO:
> [STDOUT] Init NamingLocator
> [STDOUT] [org.apache.ojb.broker.core.NamingLocator] INFO:
> [STDOUT] Properties for creating the initial context: null
> [STDOUT] [org.apache.ojb.odmg.JTATxManager] ERROR:
> [STDOUT] Cannot get the external transaction from the external TM
> [jbossweb] Stopped
>
WebApplicationContext[/monitoring,jar:file:/home/wink05/jboss-3.0.6/serv
er/d
>
efault/tmp/deploy/server/default/deploy/dev-monitoring.war/38.dev-monito
ring
> .war!/]
> 14:55:03,263 INFO [jbossweb] Deregister
> jboss.web:Jetty=0,JBossWebApplicationContext=3,context=/monitoring
> 14:55:03,267 INFO [jbossweb] Successfully undeployed
>
file:/home/wink05/jboss-3.0.6/server/default/tmp/deploy/server/default/d
eplo
> y/dev-monitoring.war/38.dev-monitoring.war
> 14:55:08,927 ERROR [MainDeployer] could not start deployment:
> file:/home/wink05/jboss-3.0.6/server/default/deploy/dev-monitoring.war
> org.jboss.deployment.DeploymentException: No external transaction
found; -
> nested throwable: (org.odmg.TransactionNotInProgressException: No
external
> transaction found)
> at org.jboss.jetty.Jetty.deploy(Jetty.java:390)
> at
org.jboss.jetty.JettyService.performDeploy(JettyService.java:249)
> at
>
org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:300)
> at
org.jboss.deployment.MainDeployer.start(MainDeployer.java:814)
> at
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:627)
> at
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:591)
> at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
> at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl
> .java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at
>
org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDi
spat
> cher.java:284)
> at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
> at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
> at $Proxy3.deploy(Unknown Source)
> at
>
org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentSc
anne
> r.java:435)
> at
>
org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDeplo
ymen
> tScanner.java:656)
> at
>
org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScan
ner.
> java:507)
> at
>
org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(Abst
ract
> DeploymentScanner.java:261)
> at
>
org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:165)
> at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
> at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl
> .java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at
>
org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDi
spat
> cher.java:284)
> at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
> at
>
org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController
.jav
> a:1003)
> at $Proxy0.start(Unknown Source)
> at
> org.jboss.system.ServiceController.start(ServiceController.java:413)
> at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
> at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl
> .java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at
>
org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDi
spat
> cher.java:284)
> at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
> at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
> at $Proxy2.start(Unknown Source)
> at
org.jboss.deployment.SARDeployer.start(SARDeployer.java:230)
> at
org.jboss.deployment.MainDeployer.start(MainDeployer.java:814)
> at
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:627)
> at
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:591)
> at
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:575)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39
> )
> at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl
> .java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at
>
org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDi
spat
> cher.java:284)
> at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
> at
org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:325)
> at
org.jboss.system.server.ServerImpl.start(ServerImpl.java:222)
> at org.jboss.Main.boot(Main.java:148)
> at org.jboss.Main$1.run(Main.java:381)
> at java.lang.Thread.run(Thread.java:536)
> Caused by: org.odmg.TransactionNotInProgressException: No external
> transaction found
>
> -----Urspr�ngliche Nachricht-----
> Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
> Gesendet: Montag, 23. Juni 2003 12:17
> An: [EMAIL PROTECTED]
> Betreff: Newbie: JBoss + MySQL
>
>
> Hello,
>
> I have some big newbie problems. Maybe anybody can help! I'm trying to
use
> the OJB ODMG API with a MySQL Database and JBoss (3.0.6). I have
followed
> the steps necessary for deploying OJB on JBoss. That means I created
the
> ojb.sar folder in the deploy folder an included the necessary files.
My
> repository_database.xml file contains the following entry:
>
> <jdbc-connection-descriptor
> jcd-alias="default"
> default-connection="true"
> platform="MySQL"
> jdbc-level="2.0"
> jndi-datasource-name="java:DefaultDS"
> driver="org.gjt.mm.mysql.Driver"
> protocol="jdbc"
> subprotocol="mysql"
> dbalias="//localhost:3306/Monitoring"
> username="monitor"
> password="password"
> eager-release="true"
> batch-mode="false"
> useAutoCommit="0"
> ignoreAutoCommitExceptions="false"
> >
> <connection-pool
> maxActive="21"
> validationQuery="" />
>
> <sequence-manager
>
className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImp
l">
> <attribute attribute-name="grabSize" attribute-value="20"/>
> <attribute attribute-name="autoNaming" attribute-value="true
"/>
> <attribute attribute-name="globalSequenceId"
> attribute-value="false"/>
> <attribute attribute-name="globalSequenceStart"
> attribute-value="10000"/>
> </sequence-manager>
> </jdbc-connection-descriptor>
>
> The ODMG Factory gets started:
>
> [PBFactory] Starting
> [PBFactory] PBFactory: org.apache.ojb.jboss.PBFactory /
> DefaultDomain:service=PBAPI,name=ojb/PBAPI
> [PBFactory] Lookup PBFactory via 'java:/ojb/PBAPI'
> [PBFactory] Started
> [ODMGFactory] Starting
> [STDOUT] ** OJB-ODMG MBean integration
> [STDOUT] ** ODMGFactory: org.apache.ojb.jboss.ODMGFactory /
> DefaultDomain:service=ODMG,name=ojb/defaultODMG
> [STDOUT] ** Use ODMGFactory via lookup:
> [STDOUT] ** ODMGFactory factory = (ODMGFactory)
> ctx.lookup(java:/ojb/defaultODMG)
> [STDOUT] ** Implementation odmg = factory.getInstance();
> [ODMGFactory] Started
>
> The Datasource is also bound:
> [DefaultDS] Bound connection factory for resource adapter 'JBoss
> LocalTransaction JDBC Wrapper' to JNDI name 'java:/DefaultDS'
>
> I have written a web application, that I deploy on JBoss. It contains
a
> Servlet which is loaded on start up with the following init() methode
(just
> to test the connection):
>
>
>
***********************init-Methode*************************************
****
> *******
> Context context = null;
> try
> {
> context = new InitialContext();
> }
> catch (NamingException e)
> {
> logger.error(THIS_CLASS + "Could not instantiate InitialContext",
e);
> throw new OJBRuntimeException("Could not instantiate
InitialContext", e);
> }
>
> ODMGFactory factory = null;
> try
> {
> factory = (ODMGFactory) context.lookup("java:/ojb/defaultODMG");
> }
> catch (NamingException e)
> {
> logger.error(THIS_CLASS + "ctx.lookup(java:/ojb/defaultODMG)
failed", e);
> throw new OJBRuntimeException("Could not lookup ODMG factory
instance",
> e);
> }
>
> Implementation odmg = factory.getInstance();
> logger.info(THIS_CLASS + "Found odmg factory: " + factory + " and get
> Implementation instance: " + odmg);
>
> Database db = odmg.newDatabase();
> try
> {
> db.open("default", Database.OPEN_READ_WRITE);
> }
> catch (ODMGException e)
> {
> logger.error(THIS_CLASS + "Database open failed", e);
> throw new OJBRuntimeException("Unable to open database using ODMG
api",
> e);
> }
> ***********************init-Methode
> END************************************************
>
> But when starting my JBoss this Servlet-init() methode never seems to
get
> reached. Instead I get the following errors:
>
> [STDOUT] [org.apache.ojb.broker.core.NamingLocator] INFO:
> [STDOUT] Init NamingLocator
> [STDOUT] [org.apache.ojb.broker.core.NamingLocator] INFO:
> [STDOUT] Properties for creating the initial context: null
> [STDOUT] [org.apache.ojb.odmg.JTATxManager] ERROR:
> [STDOUT] Cannot get the external transaction from the external TM
> [jbossweb] Stopped
>
WebApplicationContext[/monitoring,jar:file:/home/wink05/jboss-3.0.6/serv
er/d
>
efault/tmp/deploy/server/default/deploy/dev-monitoring.war/38.dev-monito
ring
> .war!/]
> .....
> ...
>
>
>
> So what am I doing wrong??
>
> Thanks in advance, Julia.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]