You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Paolo Spadafora <p....@gmail.com> on 2009/02/03 11:30:42 UTC
R: datasource problem with hibernate and oracle
Hi David,
Don't know if I answered you already, anyways...
It works with hibernate, I wanted to switch to openjpa, I made several
changes
to my pojo annotations to make it work, as a result I have a db schema very
different (seems that
Openjpa uses lookup tables even for one-to-many relationship).
Last note, is there any plan to have eclipse debug support?
To be able to work seriously I need to debug tomcat with embed openejb using
WTP,
I know how to do it with remote debugger but doesnt work well, have to
re-deploy my ejb+webapp each time.
Thank you.
bye
Paolo,
-----Messaggio originale-----
Da: David Blevins [mailto:david.blevins@visi.com]
Inviato: giovedì 29 gennaio 2009 23.31
A: users@openejb.apache.org
Oggetto: Re: datasource problem with hibernate and oracle
Hi Paulo,
Thanks for the follow up. (log was sent offline).
The log output did help quite a bit. The datasources appear to be
configured correctly, but for some reason the system was unable to
determine if they were JtaManaged or not. I was wracking my brain
when I thought of comment Jens Toerber made recently about spaces on
the end of properties getting preserved (this is what
java.util.Properties will do when loading properties files). I
tweaked my mockup of your config to add a space on the end of the
JtaManaged value so it was "true " and sure enough it caused the issue
you're seeing.
I've fixed this and logged it as a bug.
https://issues.apache.org/jira/browse/OPENEJB-995
-David
On Jan 29, 2009, at 12:12 AM, David Blevins wrote:
> Hi Paolo,
>
> I've been looking into this and have been able to reproduce the
> issue. I copied and pasted your configs into an openejb-3.1 install
> and everything configured as expected. To move things forward I've
> added more debug messages to a few key places in the persistence
> context configuration code. If you could give this snapshot of
> 3.1.1 a try and send back the log output, that would be great.
>
> To get the new messages you need to adjust the logging.properties to
> set "log4j.category.OpenEJB.startup.config" to "debug".
>
> I've uploaded a new snapshot binary here:
>
> http://people.apache.org/~dblevins/openejb-3.1.1-SNAPSHOT.zip
>
> As well as published new snapshots to the maven repo.
>
>
> -David
>
>
> On Jan 23, 2009, at 1:02 AM, Paolo Spadafora wrote:
>
>> Hi David,
>>
>> I use the same settings for managed and unmanaged datasource
>> because I got
>> an error or a warning (can't remember) if I don't put both inside the
>> persistence.xml.
>>
>> I have 2 Persistence Unit and 2 DataSource (4 DS because I declare
>> XxDS and
>> XxDSUn), one datasource refers to a schema with read/write and TX.
>> The other
>> points to another schema which is used for read only queries,
>> sometimes they
>> are in 2 different DB.
>>
>>
>>
>> <persistence-unit name="MyOrclEM" transaction-type="JTA">
>>
>> <provider>org.hibernate.ejb.HibernatePersistence</provider>
>>
>> <jta-data-source>MyOrclDS</jta-data-source>
>>
>> <non-jta-data-source>MyOrclDSUn</non-jta-data-source>
>>
>> <class>
>>
>> [pojo here]
>>
>> </class>
>>
>> <properties>
>>
>> <property name="hibernate.dialect"
>>
>>
>>
>> value="org.hibernate.dialect.Oracle10gDialect" />
>>
>> <property name="hibernate.show_sql" value="false" />
>>
>> <property name="hibernate.cache.provider_class"
>>
>>
>>
>> value="org.hibernate.cache.HashtableCacheProvider" />
>>
>> <property
>>
>> name="hibernate.transaction.manager_lookup_class"
>>
>>
>>
>> value="org.hibernate.transaction.JBossTransactionManagerLookup" />
>>
>> </properties>
>>
>> </persistence-unit>
>>
>>
>>
>> I user latest version of OpenEJB (3.1).
>>
>> I use oracle XE.
>>
>> I have to say that I am migrating from JBoss 4.x, in JBoss it works
>> perfectly.
>>
>>
>>
>> Thank you.
>>
>>
>>
>> Regards,
>>
>> Paolo
>>
>>
>> 2009/1/21 David Blevins <da...@visi.com>
>>
>>> Hi Paolo,
>>>
>>> Something interesting is going on.
>>>
>>> The openejb.xml looks great and the persistence-unit declaration
>>> for "MyEM"
>>> looks perfect. Can you post the declaration for the "MyOrclEM"
>>> persistence-unit? Even if the MyOrclEM declaration was somehow
>>> flawed I
>>> wouldn't expect the outcome you got. We've got a large amount of
>>> tests[1]
>>> for this feature. We should be able to plug your config into
>>> those tests
>>> and figure out what's going on.
>>>
>>> On a side note, it looks like the datasources "MyDS" and
>>> "MyOrclDS" are
>>> identical as are "MyDSUn" and "MyOrclDS". If you're willing to
>>> give some
>>> details on what motivates that, that'd be great. I suspect there
>>> is a
>>> feature waiting to be added there that might help you reduce
>>> redundant
>>> configuration.
>>>
>>> Also, what OpenEJB version are you using?
>>>
>>> -David
>>>
>>> [1]
>>>
http://svn.apache.org/repos/asf/openejb/tags/openejb-3.1/container/openejb-c
ore/src/test/java/org/apache/openejb/config/AutoConfigPersistenceUnitsTest.j
ava
>>>
>>>
>>> On Jan 19, 2009, at 4:19 AM, Paolo Spadafora wrote:
>>>
>>> Hello,
>>>>
>>>> I have a problem with datasource, looks like openejb is using an
>>>> hsqldb
>>>> database instead of Oracle.
>>>>
>>>>
>>>>
>>>> The error is: "table not found"
>>>>
>>>>
>>>>
>>>> INFO: building session factory
>>>>
>>>> 19-gen-2009 12.43.36 org.hibernate.impl.SessionFactoryObjectFactory
>>>> addInstance
>>>>
>>>> INFO: Not binding factory to JNDI, no JNDI name configured
>>>>
>>>> 19-gen-2009 12.43.36 org.hibernate.tool.hbm2ddl.SchemaUpdate
>>>> execute
>>>>
>>>> INFO: Running hbm2ddl schema update
>>>>
>>>> 19-gen-2009 12.43.36 org.hibernate.tool.hbm2ddl.SchemaUpdate
>>>> execute
>>>>
>>>> INFO: fetching database metadata
>>>>
>>>> 19-gen-2009 12.43.36 org.hibernate.tool.hbm2ddl.SchemaUpdate
>>>> execute
>>>>
>>>> GRAVE: could not get database metadata
>>>>
>>>> java.sql.SQLException: Tabella non trovata in statement [select
>>>> sequence_name fr
>>>>
>>>> om user_sequences]
>>>>
>>>> at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
>>>>
>>>> at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
>>>>
>>>> at org.hsqldb.jdbc.jdbcStatement.executeQuery(Unknown Source)
>>>>
>>>> at
>>>> org
>>>> .apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingSt
>>>>
>>>> atement.java:208)
>>>>
>>>> at
>>>> org
>>>> .apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingSt
>>>>
>>>> atement.java:208)
>>>>
>>>> at
>>>> org
>>>> .hibernate.tool.hbm2ddl.DatabaseMetadata.initSequences(DatabaseMet
>>>>
>>>> adata.java:128)
>>>>
>>>> at
>>>> org
>>>> .hibernate.tool.hbm2ddl.DatabaseMetadata.<init>(DatabaseMetadata.j
>>>>
>>>> ava:46)
>>>>
>>>> at
>>>> org
>>>> .hibernate.tool.hbm2ddl.DatabaseMetadata.<init>(DatabaseMetadata.j
>>>>
>>>> ava:39)
>>>>
>>>> at
>>>> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:
>>>> 129
>>>>
>>>> )
>>>>
>>>> at
>>>> org
>>>> .hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
>>>>
>>>> 314)
>>>>
>>>> at
>>>> org
>>>> .hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
>>>>
>>>> a:1300)
>>>>
>>>> at
>>>> org
>>>> .hibernate.cfg.AnnotationConfiguration.buildSessionFactory(Annotat
>>>>
>>>> ionConfiguration.java:859)
>>>>
>>>> at
>>>> org
>>>> .hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con
>>>>
>>>> figuration.java:669)
>>>>
>>>> at
>>>> org
>>>> .hibernate.ejb.HibernatePersistence.createContainerEntityManagerFa
>>>>
>>>> ctory(HibernatePersistence.java:132)
>>>>
>>>> at
>>>> org
>>>> .apache.openejb.assembler.classic.PersistenceBuilder.createEntityM
>>>>
>>>> anagerFactory(PersistenceBuilder.java:183)
>>>>
>>>> at
>>>> org
>>>> .apache.openejb.assembler.classic.Assembler.createApplication(Asse
>>>>
>>>> mbler.java:487)
>>>>
>>>> at
>>>> org
>>>> .apache.openejb.assembler.classic.Assembler.createApplication(Asse
>>>>
>>>> mbler.java:447)
>>>>
>>>> at
>>>> org
>>>> .apache.openejb.assembler.classic.Assembler.buildContainerSystem(A
>>>>
>>>> ssembler.java:365)
>>>>
>>>> at
>>>> org
>>>> .apache.openejb.assembler.classic.Assembler.build(Assembler.java:2
>>>>
>>>> 77)
>>>>
>>>> at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:150)
>>>>
>>>> at org.apache.openejb.OpenEJB.init(OpenEJB.java:299)
>>>>
>>>> at
>>>> org
>>>> .apache.openejb.tomcat.catalina.TomcatLoader.init(TomcatLoader.jav
>>>>
>>>> a:121)
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Openejb.xml:
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>
>>>> <openejb>
>>>>
>>>>
>>>>
>>>> <Container id="My CMP Container" type="CMP_ENTITY">
>>>>
>>>>
>>>>
>>>> </Container>
>>>>
>>>> <Container id="My BMP Container" type="BMP_ENTITY">
>>>>
>>>>
>>>>
>>>> PoolSize 10
>>>>
>>>>
>>>>
>>>> </Container>
>>>>
>>>> <Container id="My Stateful Container" type="STATEFUL">
>>>>
>>>> Passivator org.apache.openejb.core.stateful.SimplePassivater
>>>>
>>>>
>>>>
>>>> TimeOut 20
>>>>
>>>>
>>>>
>>>> Capacity 1000
>>>>
>>>>
>>>>
>>>> BulkPassivate 100
>>>>
>>>>
>>>>
>>>> </Container>
>>>>
>>>>
>>>>
>>>> <Container id="My Stateless Container" type="STATELESS">
>>>>
>>>> TimeOut 0
>>>>
>>>>
>>>>
>>>> PoolSize 10
>>>>
>>>>
>>>>
>>>> StrictPooling true
>>>>
>>>> </Container>
>>>>
>>>>
>>>>
>>>> <Resource id="MyDS" type="DataSource">
>>>>
>>>> JdbcDriver oracle.jdbc.OracleDriver
>>>>
>>>> JdbcUrl jdbc:oracle:thin:@localhost:1521:XE
>>>>
>>>> UserName username
>>>>
>>>> Password password
>>>>
>>>> JtaManaged true
>>>>
>>>> </Resource>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> <Resource id="MyDSUn" type="DataSource">
>>>>
>>>> JdbcDriver oracle.jdbc.OracleDriver
>>>>
>>>> JdbcUrl jdbc:oracle:thin:@localhost:1521:XE
>>>>
>>>> UserName username
>>>>
>>>> Password password
>>>>
>>>> JtaManaged false
>>>>
>>>> </Resource>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> <Resource id="MyOrclDS" type="DataSource">
>>>>
>>>> JdbcDriver oracle.jdbc.OracleDriver
>>>>
>>>> JdbcUrl jdbc:oracle:thin:@localhost:1521:XE
>>>>
>>>> UserName username
>>>>
>>>> Password password
>>>>
>>>> JtaManaged true
>>>>
>>>> </Resource>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> <Resource id="MyOrclDSUn" type="DataSource">
>>>>
>>>> JdbcDriver oracle.jdbc.OracleDriver
>>>>
>>>> JdbcUrl jdbc:oracle:thin:@localhost:1521:XE
>>>>
>>>> UserName username
>>>>
>>>> Password password
>>>>
>>>> JtaManaged false
>>>>
>>>> </Resource>
>>>>
>>>>
>>>>
>>>> <Deployments dir="apps/" />
>>>>
>>>>
>>>>
>>>> </openejb>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Persistence.xml:
>>>>
>>>> <persistence xmlns="http://java.sun.com/xml/ns/persistence"
>>>>
>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>
>>>> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
>>>> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
>>>>
>>>> version="1.0">
>>>>
>>>> <persistence-unit name="MyEM" transaction-type="JTA" >
>>>>
>>>> <provider>org.hibernate.ejb.HibernatePersistence</provider>
>>>>
>>>> <jta-data-source>MyDS</jta-data-source>
>>>>
>>>> <non-jta-data-source>MyDSUn</non-jta-data-source>
>>>>
>>>> <class>.</class>
>>>>
>>>> [pojo classes]
>>>>
>>>>
>>>>
>>>> <exclude-unlisted-classes>false</exclude-unlisted-classes>
>>>>
>>>> <properties>
>>>>
>>>> <property name="hibernate.dialect"
>>>>
>>>>
>>>> value="org.hibernate.dialect.Oracle10gDialect" />
>>>>
>>>> <property name="hibernate.show_sql" value="true" />
>>>>
>>>> <property name="hibernate.cache.provider_class"
>>>>
>>>>
>>>> value="org.hibernate.cache.HashtableCacheProvider"
>>>> />
>>>>
>>>> <property
>>>> name="hibernate.transaction.manager_lookup_class"
>>>>
>>>>
>>>> value="org.hibernate.transaction.JBossTransactionManagerLookup" />
>>>>
>>>> <property name="hibernate.hbm2ddl.auto"
>>>> value="update" />
>>>>
>>>> <property name="hibernate.jdbc.batch_size"
>>>> value="0"/>
>>>>
>>>> </properties>
>>>>
>>>> </persistence-unit>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Openejb.log (why is openejb "Adjusting" the datasource for my EM?)
>>>>
>>>> 2009-01-19 12:43:30,217 - INFO - Configuring Service(id=Tomcat
>>>> Security
>>>> Service, type=SecurityService, provider-id=Tomcat Security Service)
>>>>
>>>> 2009-01-19 12:43:30,220 - INFO - Configuring Service(id=Default
>>>> Transaction
>>>> Manager, type=TransactionManager, provider-id=Default Transaction
>>>> Manager)
>>>>
>>>> 2009-01-19 12:43:30,222 - INFO - Configuring Service(id=MyDS,
>>>> type=Resource, provider-id=Default JDBC Database)
>>>>
>>>> 2009-01-19 12:43:30,224 - INFO - Configuring Service(id=MyDSUn,
>>>> type=Resource, provider-id=Default JDBC Database)
>>>>
>>>> 2009-01-19 12:43:30,225 - INFO - Configuring Service(id=MyOrclDS,
>>>> type=Resource, provider-id=Default JDBC Database)
>>>>
>>>> 2009-01-19 12:43:30,227 - INFO - Configuring
>>>> Service(id=MyOrclDSUn,
>>>> type=Resource, provider-id=Default JDBC Database)
>>>>
>>>> 2009-01-19 12:43:30,230 - INFO - Configuring Service(id=My CMP
>>>> Container,
>>>> type=Container, provider-id=Default CMP Container)
>>>>
>>>> 2009-01-19 12:43:30,232 - INFO - Configuring Service(id=My BMP
>>>> Container,
>>>> type=Container, provider-id=Default BMP Container)
>>>>
>>>> 2009-01-19 12:43:30,234 - INFO - Configuring Service(id=My
>>>> Stateful
>>>> Container, type=Container, provider-id=Default Stateful Container)
>>>>
>>>> 2009-01-19 12:43:30,235 - INFO - Configuring Service(id=My
>>>> Stateless
>>>> Container, type=Container, provider-id=Default Stateless Container)
>>>>
>>>> 2009-01-19 12:43:30,934 - INFO - Configuring enterprise
>>>> application:
>>>> C:\dev\apache-tomcat-6.0.18\apps\my-ejb.jar
>>>>
>>>> 2009-01-19 12:43:31,408 - INFO - Configuring
>>>> PersistenceUnit(name=MyEM,
>>>> provider=org.hibernate.ejb.HibernatePersistence)
>>>>
>>>> 2009-01-19 12:43:31,413 - INFO - Configuring Service(id=Default
>>>> JDBC
>>>> Database, type=Resource, provider-id=Default JDBC Database)
>>>>
>>>> 2009-01-19 12:43:31,415 - INFO - Configuring Service(id=Default
>>>> Unmanaged
>>>> JDBC Database, type=Resource, provider-id=Default Unmanaged JDBC
>>>> Database)
>>>>
>>>> 2009-01-19 12:43:31,416 - INFO - Auto-creating a Resource with id
>>>> 'Default
>>>> JDBC Database' of type 'DataSource for 'MyEM'.
>>>>
>>>> 2009-01-19 12:43:31,416 - INFO - Auto-creating a Resource with id
>>>> 'Default
>>>> Unmanaged JDBC Database' of type 'DataSource for 'MyEM'.
>>>>
>>>> 2009-01-19 12:43:31,416 - INFO - Configuring
>>>> PersistenceUnit(name=MyOrclEM,
>>>> provider=org.hibernate.ejb.HibernatePersistence)
>>>>
>>>> 2009-01-19 12:43:31,417 - INFO - Adjusting MyOrclEM <jta-data-
>>>> source> to
>>>> 'Default JDBC Database'
>>>>
>>>> 2009-01-19 12:43:31,418 - INFO - Adjusting MyOrclEM <non-jta-
>>>> data-source>
>>>> to 'Default Unmanaged JDBC Database'
>>>>
>>>> 2009-01-19 12:43:31,447 - INFO - Enterprise application
>>>> "C:\dev\magsuite\ms-v2\apache-tomcat-6.0.18\apps\msuite-ejb.jar"
>>>> loaded.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> All necessary jars are there: hibernates jars and oracle drivers.
>>>>
>>>>
>>>>
>>>> Thank you.
>>>>
>>>>
>>>>
>>>> Regards,
>>>>
>>>> Paolo
>>>>
>>>>
>>>
>
>
R: R: datasource problem with hibernate and oracle
Posted by Paolo Spadafora <p....@gmail.com>.
Thanks, I will try.
Would be nice if all JPA could produce the same results.
Paolo
-----Messaggio originale-----
Da: Jay D. McHugh [mailto:jay@jnwd.net]
Inviato: martedì 3 febbraio 2009 17.47
A: users@openejb.apache.org
Oggetto: Re: R: datasource problem with hibernate and oracle
Hi Paolo,
I just wanted to make a comment on the one-to-many issue that you ran
into. The JPA spec actually says that they should be annotated from the
'many' side. If you do that, you should be able to get around the
lookup tables.
Or, you could take advantage of an OpenJPA specific feature annotation -
ElementJoinColumn. Here is the syntax:
@ElementJoinColumn(name="<child table ref column>"
referencedColumnName="<parent table ref column>")
HTH,
Jay
Paolo Spadafora wrote:
> Hi David,
> Don't know if I answered you already, anyways...
> It works with hibernate, I wanted to switch to openjpa, I made several
> changes
> to my pojo annotations to make it work, as a result I have a db schema very
> different (seems that
> Openjpa uses lookup tables even for one-to-many relationship).
> Last note, is there any plan to have eclipse debug support?
> To be able to work seriously I need to debug tomcat with embed openejb using
> WTP,
> I know how to do it with remote debugger but doesn’t work well, have to
> re-deploy my ejb+webapp each time.
> Thank you.
>
> bye
>
>
>
> Paolo,
>
>
>
> -----Messaggio originale-----
> Da: David Blevins [mailto:david.blevins@visi.com]
> Inviato: giovedì 29 gennaio 2009 23.31
> A: users@openejb.apache.org
> Oggetto: Re: datasource problem with hibernate and oracle
>
> Hi Paulo,
>
> Thanks for the follow up. (log was sent offline).
>
> The log output did help quite a bit. The datasources appear to be
> configured correctly, but for some reason the system was unable to
> determine if they were JtaManaged or not. I was wracking my brain
> when I thought of comment Jens Toerber made recently about spaces on
> the end of properties getting preserved (this is what
> java.util.Properties will do when loading properties files). I
> tweaked my mockup of your config to add a space on the end of the
> JtaManaged value so it was "true " and sure enough it caused the issue
> you're seeing.
>
> I've fixed this and logged it as a bug.
>
> https://issues.apache.org/jira/browse/OPENEJB-995
>
> -David
>
> On Jan 29, 2009, at 12:12 AM, David Blevins wrote:
>
>> Hi Paolo,
>>
>> I've been looking into this and have been able to reproduce the
>> issue. I copied and pasted your configs into an openejb-3.1 install
>> and everything configured as expected. To move things forward I've
>> added more debug messages to a few key places in the persistence
>> context configuration code. If you could give this snapshot of
>> 3.1.1 a try and send back the log output, that would be great.
>>
>> To get the new messages you need to adjust the logging.properties to
>> set "log4j.category.OpenEJB.startup.config" to "debug".
>>
>> I've uploaded a new snapshot binary here:
>>
>> http://people.apache.org/~dblevins/openejb-3.1.1-SNAPSHOT.zip
>>
>> As well as published new snapshots to the maven repo.
>>
>>
>> -David
>>
>>
>> On Jan 23, 2009, at 1:02 AM, Paolo Spadafora wrote:
>>
>>> Hi David,
>>>
>>> I use the same settings for managed and unmanaged datasource
>>> because I got
>>> an error or a warning (can't remember) if I don't put both inside the
>>> persistence.xml.
>>>
>>> I have 2 Persistence Unit and 2 DataSource (4 DS because I declare
>>> XxDS and
>>> XxDSUn), one datasource refers to a schema with read/write and TX.
>>> The other
>>> points to another schema which is used for read only queries,
>>> sometimes they
>>> are in 2 different DB.
>>>
>>>
>>>
>>> <persistence-unit name="MyOrclEM" transaction-type="JTA">
>>>
>>> <provider>org.hibernate.ejb.HibernatePersistence</provider>
>>>
>>> <jta-data-source>MyOrclDS</jta-data-source>
>>>
>>> <non-jta-data-source>MyOrclDSUn</non-jta-data-source>
>>>
>>> <class>
>>>
>>> [pojo here]
>>>
>>> </class>
>>>
>>> <properties>
>>>
>>> <property name="hibernate.dialect"
>>>
>>>
>>>
>>> value="org.hibernate.dialect.Oracle10gDialect" />
>>>
>>> <property name="hibernate.show_sql" value="false" />
>>>
>>> <property name="hibernate.cache.provider_class"
>>>
>>>
>>>
>>> value="org.hibernate.cache.HashtableCacheProvider" />
>>>
>>> <property
>>>
>>> name="hibernate.transaction.manager_lookup_class"
>>>
>>>
>>>
>>> value="org.hibernate.transaction.JBossTransactionManagerLookup" />
>>>
>>> </properties>
>>>
>>> </persistence-unit>
>>>
>>>
>>>
>>> I user latest version of OpenEJB (3.1).
>>>
>>> I use oracle XE.
>>>
>>> I have to say that I am migrating from JBoss 4.x, in JBoss it works
>>> perfectly.
>>>
>>>
>>>
>>> Thank you.
>>>
>>>
>>>
>>> Regards,
>>>
>>> Paolo
>>>
>>>
>>> 2009/1/21 David Blevins <da...@visi.com>
>>>
>>>> Hi Paolo,
>>>>
>>>> Something interesting is going on.
>>>>
>>>> The openejb.xml looks great and the persistence-unit declaration
>>>> for "MyEM"
>>>> looks perfect. Can you post the declaration for the "MyOrclEM"
>>>> persistence-unit? Even if the MyOrclEM declaration was somehow
>>>> flawed I
>>>> wouldn't expect the outcome you got. We've got a large amount of
>>>> tests[1]
>>>> for this feature. We should be able to plug your config into
>>>> those tests
>>>> and figure out what's going on.
>>>>
>>>> On a side note, it looks like the datasources "MyDS" and
>>>> "MyOrclDS" are
>>>> identical as are "MyDSUn" and "MyOrclDS". If you're willing to
>>>> give some
>>>> details on what motivates that, that'd be great. I suspect there
>>>> is a
>>>> feature waiting to be added there that might help you reduce
>>>> redundant
>>>> configuration.
>>>>
>>>> Also, what OpenEJB version are you using?
>>>>
>>>> -David
>>>>
>>>> [1]
>>>>
> http://svn.apache.org/repos/asf/openejb/tags/openejb-3.1/container/openejb-c
> ore/src/test/java/org/apache/openejb/config/AutoConfigPersistenceUnitsTest.j
> ava
>>>>
>>>> On Jan 19, 2009, at 4:19 AM, Paolo Spadafora wrote:
>>>>
>>>> Hello,
>>>>> I have a problem with datasource, looks like openejb is using an
>>>>> hsqldb
>>>>> database instead of Oracle.
>>>>>
>>>>>
>>>>>
>>>>> The error is: "table not found"
>>>>>
>>>>>
>>>>>
>>>>> INFO: building session factory
>>>>>
>>>>> 19-gen-2009 12.43.36 org.hibernate.impl.SessionFactoryObjectFactory
>>>>> addInstance
>>>>>
>>>>> INFO: Not binding factory to JNDI, no JNDI name configured
>>>>>
>>>>> 19-gen-2009 12.43.36 org.hibernate.tool.hbm2ddl.SchemaUpdate
>>>>> execute
>>>>>
>>>>> INFO: Running hbm2ddl schema update
>>>>>
>>>>> 19-gen-2009 12.43.36 org.hibernate.tool.hbm2ddl.SchemaUpdate
>>>>> execute
>>>>>
>>>>> INFO: fetching database metadata
>>>>>
>>>>> 19-gen-2009 12.43.36 org.hibernate.tool.hbm2ddl.SchemaUpdate
>>>>> execute
>>>>>
>>>>> GRAVE: could not get database metadata
>>>>>
>>>>> java.sql.SQLException: Tabella non trovata in statement [select
>>>>> sequence_name fr
>>>>>
>>>>> om user_sequences]
>>>>>
>>>>> at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
>>>>>
>>>>> at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
>>>>>
>>>>> at org.hsqldb.jdbc.jdbcStatement.executeQuery(Unknown Source)
>>>>>
>>>>> at
>>>>> org
>>>>> .apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingSt
>>>>>
>>>>> atement.java:208)
>>>>>
>>>>> at
>>>>> org
>>>>> .apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingSt
>>>>>
>>>>> atement.java:208)
>>>>>
>>>>> at
>>>>> org
>>>>> .hibernate.tool.hbm2ddl.DatabaseMetadata.initSequences(DatabaseMet
>>>>>
>>>>> adata.java:128)
>>>>>
>>>>> at
>>>>> org
>>>>> .hibernate.tool.hbm2ddl.DatabaseMetadata.<init>(DatabaseMetadata.j
>>>>>
>>>>> ava:46)
>>>>>
>>>>> at
>>>>> org
>>>>> .hibernate.tool.hbm2ddl.DatabaseMetadata.<init>(DatabaseMetadata.j
>>>>>
>>>>> ava:39)
>>>>>
>>>>> at
>>>>> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:
>>>>> 129
>>>>>
>>>>> )
>>>>>
>>>>> at
>>>>> org
>>>>> .hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
>>>>>
>>>>> 314)
>>>>>
>>>>> at
>>>>> org
>>>>> .hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
>>>>>
>>>>> a:1300)
>>>>>
>>>>> at
>>>>> org
>>>>> .hibernate.cfg.AnnotationConfiguration.buildSessionFactory(Annotat
>>>>>
>>>>> ionConfiguration.java:859)
>>>>>
>>>>> at
>>>>> org
>>>>> .hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con
>>>>>
>>>>> figuration.java:669)
>>>>>
>>>>> at
>>>>> org
>>>>> .hibernate.ejb.HibernatePersistence.createContainerEntityManagerFa
>>>>>
>>>>> ctory(HibernatePersistence.java:132)
>>>>>
>>>>> at
>>>>> org
>>>>> .apache.openejb.assembler.classic.PersistenceBuilder.createEntityM
>>>>>
>>>>> anagerFactory(PersistenceBuilder.java:183)
>>>>>
>>>>> at
>>>>> org
>>>>> .apache.openejb.assembler.classic.Assembler.createApplication(Asse
>>>>>
>>>>> mbler.java:487)
>>>>>
>>>>> at
>>>>> org
>>>>> .apache.openejb.assembler.classic.Assembler.createApplication(Asse
>>>>>
>>>>> mbler.java:447)
>>>>>
>>>>> at
>>>>> org
>>>>> .apache.openejb.assembler.classic.Assembler.buildContainerSystem(A
>>>>>
>>>>> ssembler.java:365)
>>>>>
>>>>> at
>>>>> org
>>>>> .apache.openejb.assembler.classic.Assembler.build(Assembler.java:2
>>>>>
>>>>> 77)
>>>>>
>>>>> at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:150)
>>>>>
>>>>> at org.apache.openejb.OpenEJB.init(OpenEJB.java:299)
>>>>>
>>>>> at
>>>>> org
>>>>> .apache.openejb.tomcat.catalina.TomcatLoader.init(TomcatLoader.jav
>>>>>
>>>>> a:121)
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Openejb.xml:
>>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>
>>>>> <openejb>
>>>>>
>>>>>
>>>>>
>>>>> <Container id="My CMP Container" type="CMP_ENTITY">
>>>>>
>>>>>
>>>>>
>>>>> </Container>
>>>>>
>>>>> <Container id="My BMP Container" type="BMP_ENTITY">
>>>>>
>>>>>
>>>>>
>>>>> PoolSize 10
>>>>>
>>>>>
>>>>>
>>>>> </Container>
>>>>>
>>>>> <Container id="My Stateful Container" type="STATEFUL">
>>>>>
>>>>> Passivator org.apache.openejb.core.stateful.SimplePassivater
>>>>>
>>>>>
>>>>>
>>>>> TimeOut 20
>>>>>
>>>>>
>>>>>
>>>>> Capacity 1000
>>>>>
>>>>>
>>>>>
>>>>> BulkPassivate 100
>>>>>
>>>>>
>>>>>
>>>>> </Container>
>>>>>
>>>>>
>>>>>
>>>>> <Container id="My Stateless Container" type="STATELESS">
>>>>>
>>>>> TimeOut 0
>>>>>
>>>>>
>>>>>
>>>>> PoolSize 10
>>>>>
>>>>>
>>>>>
>>>>> StrictPooling true
>>>>>
>>>>> </Container>
>>>>>
>>>>>
>>>>>
>>>>> <Resource id="MyDS" type="DataSource">
>>>>>
>>>>> JdbcDriver oracle.jdbc.OracleDriver
>>>>>
>>>>> JdbcUrl jdbc:oracle:thin:@localhost:1521:XE
>>>>>
>>>>> UserName username
>>>>>
>>>>> Password password
>>>>>
>>>>> JtaManaged true
>>>>>
>>>>> </Resource>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> <Resource id="MyDSUn" type="DataSource">
>>>>>
>>>>> JdbcDriver oracle.jdbc.OracleDriver
>>>>>
>>>>> JdbcUrl jdbc:oracle:thin:@localhost:1521:XE
>>>>>
>>>>> UserName username
>>>>>
>>>>> Password password
>>>>>
>>>>> JtaManaged false
>>>>>
>>>>> </Resource>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> <Resource id="MyOrclDS" type="DataSource">
>>>>>
>>>>> JdbcDriver oracle.jdbc.OracleDriver
>>>>>
>>>>> JdbcUrl jdbc:oracle:thin:@localhost:1521:XE
>>>>>
>>>>> UserName username
>>>>>
>>>>> Password password
>>>>>
>>>>> JtaManaged true
>>>>>
>>>>> </Resource>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> <Resource id="MyOrclDSUn" type="DataSource">
>>>>>
>>>>> JdbcDriver oracle.jdbc.OracleDriver
>>>>>
>>>>> JdbcUrl jdbc:oracle:thin:@localhost:1521:XE
>>>>>
>>>>> UserName username
>>>>>
>>>>> Password password
>>>>>
>>>>> JtaManaged false
>>>>>
>>>>> </Resource>
>>>>>
>>>>>
>>>>>
>>>>> <Deployments dir="apps/" />
>>>>>
>>>>>
>>>>>
>>>>> </openejb>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Persistence.xml:
>>>>>
>>>>> <persistence xmlns="http://java.sun.com/xml/ns/persistence"
>>>>>
>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>
>>>>> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
>>>>> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
>>>>>
>>>>> version="1.0">
>>>>>
>>>>> <persistence-unit name="MyEM" transaction-type="JTA" >
>>>>>
>>>>> <provider>org.hibernate.ejb.HibernatePersistence</provider>
>>>>>
>>>>> <jta-data-source>MyDS</jta-data-source>
>>>>>
>>>>> <non-jta-data-source>MyDSUn</non-jta-data-source>
>>>>>
>>>>> <class>.</class>
>>>>>
>>>>> [pojo classes]
>>>>>
>>>>>
>>>>>
>>>>> <exclude-unlisted-classes>false</exclude-unlisted-classes>
>>>>>
>>>>> <properties>
>>>>>
>>>>> <property name="hibernate.dialect"
>>>>>
>>>>>
>>>>> value="org.hibernate.dialect.Oracle10gDialect" />
>>>>>
>>>>> <property name="hibernate.show_sql" value="true" />
>>>>>
>>>>> <property name="hibernate.cache.provider_class"
>>>>>
>>>>>
>>>>> value="org.hibernate.cache.HashtableCacheProvider"
>>>>> />
>>>>>
>>>>> <property
>>>>> name="hibernate.transaction.manager_lookup_class"
>>>>>
>>>>>
>>>>> value="org.hibernate.transaction.JBossTransactionManagerLookup" />
>>>>>
>>>>> <property name="hibernate.hbm2ddl.auto"
>>>>> value="update" />
>>>>>
>>>>> <property name="hibernate.jdbc.batch_size"
>>>>> value="0"/>
>>>>>
>>>>> </properties>
>>>>>
>>>>> </persistence-unit>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Openejb.log (why is openejb "Adjusting" the datasource for my EM?)
>>>>>
>>>>> 2009-01-19 12:43:30,217 - INFO - Configuring Service(id=Tomcat
>>>>> Security
>>>>> Service, type=SecurityService, provider-id=Tomcat Security Service)
>>>>>
>>>>> 2009-01-19 12:43:30,220 - INFO - Configuring Service(id=Default
>>>>> Transaction
>>>>> Manager, type=TransactionManager, provider-id=Default Transaction
>>>>> Manager)
>>>>>
>>>>> 2009-01-19 12:43:30,222 - INFO - Configuring Service(id=MyDS,
>>>>> type=Resource, provider-id=Default JDBC Database)
>>>>>
>>>>> 2009-01-19 12:43:30,224 - INFO - Configuring Service(id=MyDSUn,
>>>>> type=Resource, provider-id=Default JDBC Database)
>>>>>
>>>>> 2009-01-19 12:43:30,225 - INFO - Configuring Service(id=MyOrclDS,
>>>>> type=Resource, provider-id=Default JDBC Database)
>>>>>
>>>>> 2009-01-19 12:43:30,227 - INFO - Configuring
>>>>> Service(id=MyOrclDSUn,
>>>>> type=Resource, provider-id=Default JDBC Database)
>>>>>
>>>>> 2009-01-19 12:43:30,230 - INFO - Configuring Service(id=My CMP
>>>>> Container,
>>>>> type=Container, provider-id=Default CMP Container)
>>>>>
>>>>> 2009-01-19 12:43:30,232 - INFO - Configuring Service(id=My BMP
>>>>> Container,
>>>>> type=Container, provider-id=Default BMP Container)
>>>>>
>>>>> 2009-01-19 12:43:30,234 - INFO - Configuring Service(id=My
>>>>> Stateful
>>>>> Container, type=Container, provider-id=Default Stateful Container)
>>>>>
>>>>> 2009-01-19 12:43:30,235 - INFO - Configuring Service(id=My
>>>>> Stateless
>>>>> Container, type=Container, provider-id=Default Stateless Container)
>>>>>
>>>>> 2009-01-19 12:43:30,934 - INFO - Configuring enterprise
>>>>> application:
>>>>> C:\dev\apache-tomcat-6.0.18\apps\my-ejb.jar
>>>>>
>>>>> 2009-01-19 12:43:31,408 - INFO - Configuring
>>>>> PersistenceUnit(name=MyEM,
>>>>> provider=org.hibernate.ejb.HibernatePersistence)
>>>>>
>>>>> 2009-01-19 12:43:31,413 - INFO - Configuring Service(id=Default
>>>>> JDBC
>>>>> Database, type=Resource, provider-id=Default JDBC Database)
>>>>>
>>>>> 2009-01-19 12:43:31,415 - INFO - Configuring Service(id=Default
>>>>> Unmanaged
>>>>> JDBC Database, type=Resource, provider-id=Default Unmanaged JDBC
>>>>> Database)
>>>>>
>>>>> 2009-01-19 12:43:31,416 - INFO - Auto-creating a Resource with id
>>>>> 'Default
>>>>> JDBC Database' of type 'DataSource for 'MyEM'.
>>>>>
>>>>> 2009-01-19 12:43:31,416 - INFO - Auto-creating a Resource with id
>>>>> 'Default
>>>>> Unmanaged JDBC Database' of type 'DataSource for 'MyEM'.
>>>>>
>>>>> 2009-01-19 12:43:31,416 - INFO - Configuring
>>>>> PersistenceUnit(name=MyOrclEM,
>>>>> provider=org.hibernate.ejb.HibernatePersistence)
>>>>>
>>>>> 2009-01-19 12:43:31,417 - INFO - Adjusting MyOrclEM <jta-data-
>>>>> source> to
>>>>> 'Default JDBC Database'
>>>>>
>>>>> 2009-01-19 12:43:31,418 - INFO - Adjusting MyOrclEM <non-jta-
>>>>> data-source>
>>>>> to 'Default Unmanaged JDBC Database'
>>>>>
>>>>> 2009-01-19 12:43:31,447 - INFO - Enterprise application
>>>>> "C:\dev\magsuite\ms-v2\apache-tomcat-6.0.18\apps\msuite-ejb.jar"
>>>>> loaded.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> All necessary jars are there: hibernates jars and oracle drivers.
>>>>>
>>>>>
>>>>>
>>>>> Thank you.
>>>>>
>>>>>
>>>>>
>>>>> Regards,
>>>>>
>>>>> Paolo
>>>>>
>>>>>
>>
>
>
>
>
Re: R: datasource problem with hibernate and oracle
Posted by "Jay D. McHugh" <ja...@jnwd.net>.
Hi Paolo,
I just wanted to make a comment on the one-to-many issue that you ran
into. The JPA spec actually says that they should be annotated from the
'many' side. If you do that, you should be able to get around the
lookup tables.
Or, you could take advantage of an OpenJPA specific feature annotation -
ElementJoinColumn. Here is the syntax:
@ElementJoinColumn(name="<child table ref column>"
referencedColumnName="<parent table ref column>")
HTH,
Jay
Paolo Spadafora wrote:
> Hi David,
> Don't know if I answered you already, anyways...
> It works with hibernate, I wanted to switch to openjpa, I made several
> changes
> to my pojo annotations to make it work, as a result I have a db schema very
> different (seems that
> Openjpa uses lookup tables even for one-to-many relationship).
> Last note, is there any plan to have eclipse debug support?
> To be able to work seriously I need to debug tomcat with embed openejb using
> WTP,
> I know how to do it with remote debugger but doesn’t work well, have to
> re-deploy my ejb+webapp each time.
> Thank you.
>
> bye
>
>
>
> Paolo,
>
>
>
> -----Messaggio originale-----
> Da: David Blevins [mailto:david.blevins@visi.com]
> Inviato: giovedì 29 gennaio 2009 23.31
> A: users@openejb.apache.org
> Oggetto: Re: datasource problem with hibernate and oracle
>
> Hi Paulo,
>
> Thanks for the follow up. (log was sent offline).
>
> The log output did help quite a bit. The datasources appear to be
> configured correctly, but for some reason the system was unable to
> determine if they were JtaManaged or not. I was wracking my brain
> when I thought of comment Jens Toerber made recently about spaces on
> the end of properties getting preserved (this is what
> java.util.Properties will do when loading properties files). I
> tweaked my mockup of your config to add a space on the end of the
> JtaManaged value so it was "true " and sure enough it caused the issue
> you're seeing.
>
> I've fixed this and logged it as a bug.
>
> https://issues.apache.org/jira/browse/OPENEJB-995
>
> -David
>
> On Jan 29, 2009, at 12:12 AM, David Blevins wrote:
>
>> Hi Paolo,
>>
>> I've been looking into this and have been able to reproduce the
>> issue. I copied and pasted your configs into an openejb-3.1 install
>> and everything configured as expected. To move things forward I've
>> added more debug messages to a few key places in the persistence
>> context configuration code. If you could give this snapshot of
>> 3.1.1 a try and send back the log output, that would be great.
>>
>> To get the new messages you need to adjust the logging.properties to
>> set "log4j.category.OpenEJB.startup.config" to "debug".
>>
>> I've uploaded a new snapshot binary here:
>>
>> http://people.apache.org/~dblevins/openejb-3.1.1-SNAPSHOT.zip
>>
>> As well as published new snapshots to the maven repo.
>>
>>
>> -David
>>
>>
>> On Jan 23, 2009, at 1:02 AM, Paolo Spadafora wrote:
>>
>>> Hi David,
>>>
>>> I use the same settings for managed and unmanaged datasource
>>> because I got
>>> an error or a warning (can't remember) if I don't put both inside the
>>> persistence.xml.
>>>
>>> I have 2 Persistence Unit and 2 DataSource (4 DS because I declare
>>> XxDS and
>>> XxDSUn), one datasource refers to a schema with read/write and TX.
>>> The other
>>> points to another schema which is used for read only queries,
>>> sometimes they
>>> are in 2 different DB.
>>>
>>>
>>>
>>> <persistence-unit name="MyOrclEM" transaction-type="JTA">
>>>
>>> <provider>org.hibernate.ejb.HibernatePersistence</provider>
>>>
>>> <jta-data-source>MyOrclDS</jta-data-source>
>>>
>>> <non-jta-data-source>MyOrclDSUn</non-jta-data-source>
>>>
>>> <class>
>>>
>>> [pojo here]
>>>
>>> </class>
>>>
>>> <properties>
>>>
>>> <property name="hibernate.dialect"
>>>
>>>
>>>
>>> value="org.hibernate.dialect.Oracle10gDialect" />
>>>
>>> <property name="hibernate.show_sql" value="false" />
>>>
>>> <property name="hibernate.cache.provider_class"
>>>
>>>
>>>
>>> value="org.hibernate.cache.HashtableCacheProvider" />
>>>
>>> <property
>>>
>>> name="hibernate.transaction.manager_lookup_class"
>>>
>>>
>>>
>>> value="org.hibernate.transaction.JBossTransactionManagerLookup" />
>>>
>>> </properties>
>>>
>>> </persistence-unit>
>>>
>>>
>>>
>>> I user latest version of OpenEJB (3.1).
>>>
>>> I use oracle XE.
>>>
>>> I have to say that I am migrating from JBoss 4.x, in JBoss it works
>>> perfectly.
>>>
>>>
>>>
>>> Thank you.
>>>
>>>
>>>
>>> Regards,
>>>
>>> Paolo
>>>
>>>
>>> 2009/1/21 David Blevins <da...@visi.com>
>>>
>>>> Hi Paolo,
>>>>
>>>> Something interesting is going on.
>>>>
>>>> The openejb.xml looks great and the persistence-unit declaration
>>>> for "MyEM"
>>>> looks perfect. Can you post the declaration for the "MyOrclEM"
>>>> persistence-unit? Even if the MyOrclEM declaration was somehow
>>>> flawed I
>>>> wouldn't expect the outcome you got. We've got a large amount of
>>>> tests[1]
>>>> for this feature. We should be able to plug your config into
>>>> those tests
>>>> and figure out what's going on.
>>>>
>>>> On a side note, it looks like the datasources "MyDS" and
>>>> "MyOrclDS" are
>>>> identical as are "MyDSUn" and "MyOrclDS". If you're willing to
>>>> give some
>>>> details on what motivates that, that'd be great. I suspect there
>>>> is a
>>>> feature waiting to be added there that might help you reduce
>>>> redundant
>>>> configuration.
>>>>
>>>> Also, what OpenEJB version are you using?
>>>>
>>>> -David
>>>>
>>>> [1]
>>>>
> http://svn.apache.org/repos/asf/openejb/tags/openejb-3.1/container/openejb-c
> ore/src/test/java/org/apache/openejb/config/AutoConfigPersistenceUnitsTest.j
> ava
>>>>
>>>> On Jan 19, 2009, at 4:19 AM, Paolo Spadafora wrote:
>>>>
>>>> Hello,
>>>>> I have a problem with datasource, looks like openejb is using an
>>>>> hsqldb
>>>>> database instead of Oracle.
>>>>>
>>>>>
>>>>>
>>>>> The error is: "table not found"
>>>>>
>>>>>
>>>>>
>>>>> INFO: building session factory
>>>>>
>>>>> 19-gen-2009 12.43.36 org.hibernate.impl.SessionFactoryObjectFactory
>>>>> addInstance
>>>>>
>>>>> INFO: Not binding factory to JNDI, no JNDI name configured
>>>>>
>>>>> 19-gen-2009 12.43.36 org.hibernate.tool.hbm2ddl.SchemaUpdate
>>>>> execute
>>>>>
>>>>> INFO: Running hbm2ddl schema update
>>>>>
>>>>> 19-gen-2009 12.43.36 org.hibernate.tool.hbm2ddl.SchemaUpdate
>>>>> execute
>>>>>
>>>>> INFO: fetching database metadata
>>>>>
>>>>> 19-gen-2009 12.43.36 org.hibernate.tool.hbm2ddl.SchemaUpdate
>>>>> execute
>>>>>
>>>>> GRAVE: could not get database metadata
>>>>>
>>>>> java.sql.SQLException: Tabella non trovata in statement [select
>>>>> sequence_name fr
>>>>>
>>>>> om user_sequences]
>>>>>
>>>>> at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
>>>>>
>>>>> at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
>>>>>
>>>>> at org.hsqldb.jdbc.jdbcStatement.executeQuery(Unknown Source)
>>>>>
>>>>> at
>>>>> org
>>>>> .apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingSt
>>>>>
>>>>> atement.java:208)
>>>>>
>>>>> at
>>>>> org
>>>>> .apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingSt
>>>>>
>>>>> atement.java:208)
>>>>>
>>>>> at
>>>>> org
>>>>> .hibernate.tool.hbm2ddl.DatabaseMetadata.initSequences(DatabaseMet
>>>>>
>>>>> adata.java:128)
>>>>>
>>>>> at
>>>>> org
>>>>> .hibernate.tool.hbm2ddl.DatabaseMetadata.<init>(DatabaseMetadata.j
>>>>>
>>>>> ava:46)
>>>>>
>>>>> at
>>>>> org
>>>>> .hibernate.tool.hbm2ddl.DatabaseMetadata.<init>(DatabaseMetadata.j
>>>>>
>>>>> ava:39)
>>>>>
>>>>> at
>>>>> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:
>>>>> 129
>>>>>
>>>>> )
>>>>>
>>>>> at
>>>>> org
>>>>> .hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
>>>>>
>>>>> 314)
>>>>>
>>>>> at
>>>>> org
>>>>> .hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
>>>>>
>>>>> a:1300)
>>>>>
>>>>> at
>>>>> org
>>>>> .hibernate.cfg.AnnotationConfiguration.buildSessionFactory(Annotat
>>>>>
>>>>> ionConfiguration.java:859)
>>>>>
>>>>> at
>>>>> org
>>>>> .hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con
>>>>>
>>>>> figuration.java:669)
>>>>>
>>>>> at
>>>>> org
>>>>> .hibernate.ejb.HibernatePersistence.createContainerEntityManagerFa
>>>>>
>>>>> ctory(HibernatePersistence.java:132)
>>>>>
>>>>> at
>>>>> org
>>>>> .apache.openejb.assembler.classic.PersistenceBuilder.createEntityM
>>>>>
>>>>> anagerFactory(PersistenceBuilder.java:183)
>>>>>
>>>>> at
>>>>> org
>>>>> .apache.openejb.assembler.classic.Assembler.createApplication(Asse
>>>>>
>>>>> mbler.java:487)
>>>>>
>>>>> at
>>>>> org
>>>>> .apache.openejb.assembler.classic.Assembler.createApplication(Asse
>>>>>
>>>>> mbler.java:447)
>>>>>
>>>>> at
>>>>> org
>>>>> .apache.openejb.assembler.classic.Assembler.buildContainerSystem(A
>>>>>
>>>>> ssembler.java:365)
>>>>>
>>>>> at
>>>>> org
>>>>> .apache.openejb.assembler.classic.Assembler.build(Assembler.java:2
>>>>>
>>>>> 77)
>>>>>
>>>>> at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:150)
>>>>>
>>>>> at org.apache.openejb.OpenEJB.init(OpenEJB.java:299)
>>>>>
>>>>> at
>>>>> org
>>>>> .apache.openejb.tomcat.catalina.TomcatLoader.init(TomcatLoader.jav
>>>>>
>>>>> a:121)
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Openejb.xml:
>>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>
>>>>> <openejb>
>>>>>
>>>>>
>>>>>
>>>>> <Container id="My CMP Container" type="CMP_ENTITY">
>>>>>
>>>>>
>>>>>
>>>>> </Container>
>>>>>
>>>>> <Container id="My BMP Container" type="BMP_ENTITY">
>>>>>
>>>>>
>>>>>
>>>>> PoolSize 10
>>>>>
>>>>>
>>>>>
>>>>> </Container>
>>>>>
>>>>> <Container id="My Stateful Container" type="STATEFUL">
>>>>>
>>>>> Passivator org.apache.openejb.core.stateful.SimplePassivater
>>>>>
>>>>>
>>>>>
>>>>> TimeOut 20
>>>>>
>>>>>
>>>>>
>>>>> Capacity 1000
>>>>>
>>>>>
>>>>>
>>>>> BulkPassivate 100
>>>>>
>>>>>
>>>>>
>>>>> </Container>
>>>>>
>>>>>
>>>>>
>>>>> <Container id="My Stateless Container" type="STATELESS">
>>>>>
>>>>> TimeOut 0
>>>>>
>>>>>
>>>>>
>>>>> PoolSize 10
>>>>>
>>>>>
>>>>>
>>>>> StrictPooling true
>>>>>
>>>>> </Container>
>>>>>
>>>>>
>>>>>
>>>>> <Resource id="MyDS" type="DataSource">
>>>>>
>>>>> JdbcDriver oracle.jdbc.OracleDriver
>>>>>
>>>>> JdbcUrl jdbc:oracle:thin:@localhost:1521:XE
>>>>>
>>>>> UserName username
>>>>>
>>>>> Password password
>>>>>
>>>>> JtaManaged true
>>>>>
>>>>> </Resource>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> <Resource id="MyDSUn" type="DataSource">
>>>>>
>>>>> JdbcDriver oracle.jdbc.OracleDriver
>>>>>
>>>>> JdbcUrl jdbc:oracle:thin:@localhost:1521:XE
>>>>>
>>>>> UserName username
>>>>>
>>>>> Password password
>>>>>
>>>>> JtaManaged false
>>>>>
>>>>> </Resource>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> <Resource id="MyOrclDS" type="DataSource">
>>>>>
>>>>> JdbcDriver oracle.jdbc.OracleDriver
>>>>>
>>>>> JdbcUrl jdbc:oracle:thin:@localhost:1521:XE
>>>>>
>>>>> UserName username
>>>>>
>>>>> Password password
>>>>>
>>>>> JtaManaged true
>>>>>
>>>>> </Resource>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> <Resource id="MyOrclDSUn" type="DataSource">
>>>>>
>>>>> JdbcDriver oracle.jdbc.OracleDriver
>>>>>
>>>>> JdbcUrl jdbc:oracle:thin:@localhost:1521:XE
>>>>>
>>>>> UserName username
>>>>>
>>>>> Password password
>>>>>
>>>>> JtaManaged false
>>>>>
>>>>> </Resource>
>>>>>
>>>>>
>>>>>
>>>>> <Deployments dir="apps/" />
>>>>>
>>>>>
>>>>>
>>>>> </openejb>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Persistence.xml:
>>>>>
>>>>> <persistence xmlns="http://java.sun.com/xml/ns/persistence"
>>>>>
>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>
>>>>> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
>>>>> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
>>>>>
>>>>> version="1.0">
>>>>>
>>>>> <persistence-unit name="MyEM" transaction-type="JTA" >
>>>>>
>>>>> <provider>org.hibernate.ejb.HibernatePersistence</provider>
>>>>>
>>>>> <jta-data-source>MyDS</jta-data-source>
>>>>>
>>>>> <non-jta-data-source>MyDSUn</non-jta-data-source>
>>>>>
>>>>> <class>.</class>
>>>>>
>>>>> [pojo classes]
>>>>>
>>>>>
>>>>>
>>>>> <exclude-unlisted-classes>false</exclude-unlisted-classes>
>>>>>
>>>>> <properties>
>>>>>
>>>>> <property name="hibernate.dialect"
>>>>>
>>>>>
>>>>> value="org.hibernate.dialect.Oracle10gDialect" />
>>>>>
>>>>> <property name="hibernate.show_sql" value="true" />
>>>>>
>>>>> <property name="hibernate.cache.provider_class"
>>>>>
>>>>>
>>>>> value="org.hibernate.cache.HashtableCacheProvider"
>>>>> />
>>>>>
>>>>> <property
>>>>> name="hibernate.transaction.manager_lookup_class"
>>>>>
>>>>>
>>>>> value="org.hibernate.transaction.JBossTransactionManagerLookup" />
>>>>>
>>>>> <property name="hibernate.hbm2ddl.auto"
>>>>> value="update" />
>>>>>
>>>>> <property name="hibernate.jdbc.batch_size"
>>>>> value="0"/>
>>>>>
>>>>> </properties>
>>>>>
>>>>> </persistence-unit>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Openejb.log (why is openejb "Adjusting" the datasource for my EM?)
>>>>>
>>>>> 2009-01-19 12:43:30,217 - INFO - Configuring Service(id=Tomcat
>>>>> Security
>>>>> Service, type=SecurityService, provider-id=Tomcat Security Service)
>>>>>
>>>>> 2009-01-19 12:43:30,220 - INFO - Configuring Service(id=Default
>>>>> Transaction
>>>>> Manager, type=TransactionManager, provider-id=Default Transaction
>>>>> Manager)
>>>>>
>>>>> 2009-01-19 12:43:30,222 - INFO - Configuring Service(id=MyDS,
>>>>> type=Resource, provider-id=Default JDBC Database)
>>>>>
>>>>> 2009-01-19 12:43:30,224 - INFO - Configuring Service(id=MyDSUn,
>>>>> type=Resource, provider-id=Default JDBC Database)
>>>>>
>>>>> 2009-01-19 12:43:30,225 - INFO - Configuring Service(id=MyOrclDS,
>>>>> type=Resource, provider-id=Default JDBC Database)
>>>>>
>>>>> 2009-01-19 12:43:30,227 - INFO - Configuring
>>>>> Service(id=MyOrclDSUn,
>>>>> type=Resource, provider-id=Default JDBC Database)
>>>>>
>>>>> 2009-01-19 12:43:30,230 - INFO - Configuring Service(id=My CMP
>>>>> Container,
>>>>> type=Container, provider-id=Default CMP Container)
>>>>>
>>>>> 2009-01-19 12:43:30,232 - INFO - Configuring Service(id=My BMP
>>>>> Container,
>>>>> type=Container, provider-id=Default BMP Container)
>>>>>
>>>>> 2009-01-19 12:43:30,234 - INFO - Configuring Service(id=My
>>>>> Stateful
>>>>> Container, type=Container, provider-id=Default Stateful Container)
>>>>>
>>>>> 2009-01-19 12:43:30,235 - INFO - Configuring Service(id=My
>>>>> Stateless
>>>>> Container, type=Container, provider-id=Default Stateless Container)
>>>>>
>>>>> 2009-01-19 12:43:30,934 - INFO - Configuring enterprise
>>>>> application:
>>>>> C:\dev\apache-tomcat-6.0.18\apps\my-ejb.jar
>>>>>
>>>>> 2009-01-19 12:43:31,408 - INFO - Configuring
>>>>> PersistenceUnit(name=MyEM,
>>>>> provider=org.hibernate.ejb.HibernatePersistence)
>>>>>
>>>>> 2009-01-19 12:43:31,413 - INFO - Configuring Service(id=Default
>>>>> JDBC
>>>>> Database, type=Resource, provider-id=Default JDBC Database)
>>>>>
>>>>> 2009-01-19 12:43:31,415 - INFO - Configuring Service(id=Default
>>>>> Unmanaged
>>>>> JDBC Database, type=Resource, provider-id=Default Unmanaged JDBC
>>>>> Database)
>>>>>
>>>>> 2009-01-19 12:43:31,416 - INFO - Auto-creating a Resource with id
>>>>> 'Default
>>>>> JDBC Database' of type 'DataSource for 'MyEM'.
>>>>>
>>>>> 2009-01-19 12:43:31,416 - INFO - Auto-creating a Resource with id
>>>>> 'Default
>>>>> Unmanaged JDBC Database' of type 'DataSource for 'MyEM'.
>>>>>
>>>>> 2009-01-19 12:43:31,416 - INFO - Configuring
>>>>> PersistenceUnit(name=MyOrclEM,
>>>>> provider=org.hibernate.ejb.HibernatePersistence)
>>>>>
>>>>> 2009-01-19 12:43:31,417 - INFO - Adjusting MyOrclEM <jta-data-
>>>>> source> to
>>>>> 'Default JDBC Database'
>>>>>
>>>>> 2009-01-19 12:43:31,418 - INFO - Adjusting MyOrclEM <non-jta-
>>>>> data-source>
>>>>> to 'Default Unmanaged JDBC Database'
>>>>>
>>>>> 2009-01-19 12:43:31,447 - INFO - Enterprise application
>>>>> "C:\dev\magsuite\ms-v2\apache-tomcat-6.0.18\apps\msuite-ejb.jar"
>>>>> loaded.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> All necessary jars are there: hibernates jars and oracle drivers.
>>>>>
>>>>>
>>>>>
>>>>> Thank you.
>>>>>
>>>>>
>>>>>
>>>>> Regards,
>>>>>
>>>>> Paolo
>>>>>
>>>>>
>>
>
>
>
>
R: Eclipse WTP + Tomcat Debug
Posted by Paolo Spadafora <p....@gmail.com>.
Hi David,
With eclipse WTP you can debug a web application without restart tomcat
(except a few cases, like changes on a struts config).
It runs an instance of tomcat using a temp folder to deploy webapp
(exploded) and some custom xml configuration (adds a few special tags inside
server.xml and web.xml).
I think what we need is something like the JBoss plugin not WTP.
The JBoss plugin does something very simple, keeps in synch your webapps and
ejbs by copying the compiled classes (and project files) under the
deployment folder, like mywebapp.war or myejb.jar, but these are folders,
not files.
Basically the tomcat-openejb plugin should do a few simple things:
- start its own customized instance of tomcat with a pre-deployed
application: openejb.war
- keep a list of deployed application (eg: a Web Application "webapp" and an
EJB "ejb")
- intercept changes to deployed webapp files or class compilation and synch
with tomcat copy
- intercept changes to deployed ejb and synch with the filesystem/openejb,
like runtime class loading/replacement
- undeploy and clean (temp files, etc)
For instance, for point 1, the plug-in should dynamically crate a temp
folder where to run openejb-tomcat, set openejb home for you, set bootstrap
jars, etc. usually they do in the plug-in folder:
eclipse/plugins/openejb.apache.org/tmp0/.
There is more, but I think is enough to give you an idea.
Paolo
-----Messaggio originale-----
Da: David Blevins [mailto:david.blevins@visi.com]
Inviato: mercoledì 11 febbraio 2009 6.15
A: users@openejb.apache.org
Cc: Karan Malhi
Oggetto: Eclipse WTP + Tomcat Debug
On Feb 3, 2009, at 2:30 AM, Paolo Spadafora wrote:
> To be able to work seriously I need to debug tomcat with embed
> openejb using
> WTP,
> I know how to do it with remote debugger but doesnt work well, have
> to
> re-deploy my ejb+webapp each time.
Hi Paolo,
I'm not familiar with the Tomcat support in the Eclipse WTP. If you
can tell me a bit about it that would be appreciated.
Karan was mentioning something the other day regarding Eclipse/Tomcat
and having to start/stop Tomcat after each change. Cc'ing him as
maybe he has some info also.
-David
Re: Eclipse WTP + Tomcat Debug
Posted by Paolo Spadafora <p....@gmail.com>.
Hi,
I am very busy but I'd like to work on it.
Will keep you up to date.
thank you.
Paolo.
2009/2/21 Jonathan Gallimore <jo...@gmail.com>
> On Sat, Feb 21, 2009 at 8:20 PM, David Blevins <david.blevins@visi.com
> >wrote:
>
> > On Feb 13, 2009, at 3:43 AM, Paolo Spadafora wrote:
> >
> > Hi,
> >> To answer you question: yes.
> >> It's because of openejb+tomcat, usually I can change a line of code and
> >> see
> >> the new change without restart tomcat or reload the webapp.
> >> It does not reload the webapp, just the single class, but it depends,
> >> sometimes it's necessary to do a restart or reload the webapp, the
> plugin
> >> somehow is able to understand that (you see "restart" in the tomcat
> >> status).
> >> As I said in another email, where I explain a bit about WTP plugin, it's
> >> necessary to have a plugin that takes care of a few tasks (like set
> >> openejb_home dynamically, set bootstrap jars and so on).
> >> Probably is not so difficult to extend the current wtp tomcat plugin to
> >> handle openejb.
> >>
> >
> > That's interesting. We do have an WTP-based Eclipse plugin in
> development
> > for OpenEJB, but I think it might be OpenEJB-standalone only at this
> point.
> > Jonathan, would know better -- he wrote it :)
>
>
> That's absolutely right - the WTP plugin is only for the standalone OpenEJB
> server. There is already a WTP plugin for Tomcat which comes with the
> Eclipse JST/WST tools.
>
> I don't have any ideas of my own as to why Eclipse isn't hotswapping your
> code, although I did wonder whether it was just a class loading issue or
> something like that (but that is just a complete guess).
>
>
> >
> > On Feb 11, 2009, at 12:57 AM, Paolo Spadafora wrote:
> >
> >> With eclipse WTP you can debug a web application without restart tomcat
> >> (except a few cases, like changes on a struts config).
> >> It runs an instance of tomcat using a temp folder to deploy webapp
> >> (exploded) and some custom xml configuration (adds a few special tags
> >> inside
> >> server.xml and web.xml).
> >> I think what we need is something like the JBoss plugin not WTP.
> >> The JBoss plugin does something very simple, keeps in synch your webapps
> >> and
> >> ejbs by copying the compiled classes (and project files) under the
> >> deployment folder, like mywebapp.war or myejb.jar, but these are
> folders,
> >> not files.
> >> Basically the tomcat-openejb plugin should do a few simple things:
> >> - start its own customized instance of tomcat with a pre-deployed
> >> application: openejb.war
> >> - keep a list of deployed application (eg: a Web Application "webapp"
> and
> >> an
> >> EJB "ejb")
> >> - intercept changes to deployed webapp files or class compilation and
> >> synch
> >> with tomcat copy
> >> - intercept changes to deployed ejb and synch with the
> filesystem/openejb,
> >> like runtime class loading/replacement
> >> - undeploy and clean (temp files, etc)
> >>
> >> For instance, for point 1, the plug-in should dynamically crate a temp
> >> folder where to run openejb-tomcat, set openejb home for you, set
> >> bootstrap
> >> jars, etc. usually they do in the plug-in folder:
> >> eclipse/plugins/openejb.apache.org/tmp0/.
> >> There is more, but I think is enough to give you an idea.
> >>
> >
> >
> > Jonathan might have a better idea what it might take to do some of these
> > things. And while we're wrangling up people, are you at all interested
> in
> > working on it? I bet you're already designing it in your head :)
> >
>
> This all sounds very interesting - I think a WTP server for Tomcat+OpenEJB
> would be be very useful. The current plugin uses the DeployerBusiness EJB
> in
> the standalone server, and it looks like this is available in Tomcat,
> perhaps we can use functionality we already have in
> org.apache.openejb.eclipse.server.ServerDeployer [
>
> https://svn.apache.org/repos/asf/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.server/src/main/java/org/apache/openejb/eclipse/server/ServerDeployer.java
> ]
> to keep everything in sync.
>
> If you'd like to work on this, please do join in. I'll help you in any way
> I
> can.
>
> Jon
>
>
> >
> >
> > -David
> >
> >
> >
> > Bye,
> >> Paolo
> >>
> >>
> >> On 13/02/09 05:12, "Karan Malhi" <ka...@gmail.com> wrote:
> >>
> >> I am using maven-tomcat-plugin in eclipse and its working fine. I have
> >>> not
> >>> run it in debug mode, but I have to redeploy the app if I make a change
> >>> to
> >>> any .class or update a jar in the lib. Here is the tomcat documentation
> >>> which says that in development mode, tomcat would reload teh app if
> >>> reloadable is set to true
> >>>
> >>> reloadable
> >>>
> >>> Set to true if you want Catalina to monitor classes in
> /WEB-INF/classes/
> >>> and
> >>> /WEB-INF/lib for changes, and automatically reload the web application
> if
> >>> a
> >>> change is detected. This feature is very useful during application
> >>> development, but it requires significant runtime overhead and is not
> >>> recommended for use on deployed production applications. That's why the
> >>> default setting for this attribute is *false*. You can use the
> >>> Manager<http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html>web
> >>> application, however, to trigger reloads of deployed applications on
> >>> demand.
> >>> The maven-tomcat-plugin also redeploys the app when I make some change.
> >>>
> >>> I do not know much about tomcat +WTP, but seems like whether debugging
> or
> >>> not, webapp is reloaded when classes/jars change in webapp.
> >>>
> >>> Question:- Is it because of openejb + tomcat that you have to reload
> the
> >>> webapp while debugging, or do you have to do that anyway (for a tomcat
> >>> instance without openejb)?
> >>>
> >>> On Wed, Feb 11, 2009 at 12:14 AM, David Blevins <
> david.blevins@visi.com
> >>> >wrote:
> >>>
> >>> On Feb 3, 2009, at 2:30 AM, Paolo Spadafora wrote:
> >>>>
> >>>> To be able to work seriously I need to debug tomcat with embed openejb
> >>>>
> >>>>> using
> >>>>> WTP,
> >>>>> I know how to do it with remote debugger but doesn't work well, have
> to
> >>>>> re-deploy my ejb+webapp each time.
> >>>>>
> >>>>>
> >>>> Hi Paolo,
> >>>>
> >>>> I'm not familiar with the Tomcat support in the Eclipse WTP. If you
> can
> >>>> tell me a bit about it that would be appreciated.
> >>>>
> >>>> Karan was mentioning something the other day regarding Eclipse/Tomcat
> >>>> and
> >>>> having to start/stop Tomcat after each change. Cc'ing him as maybe he
> >>>> has
> >>>> some info also.
> >>>>
> >>>> -David
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>
> >>
> >>
> >
>
Re: Eclipse WTP + Tomcat Debug
Posted by Jonathan Gallimore <jo...@gmail.com>.
On Sat, Feb 21, 2009 at 8:20 PM, David Blevins <da...@visi.com>wrote:
> On Feb 13, 2009, at 3:43 AM, Paolo Spadafora wrote:
>
> Hi,
>> To answer you question: yes.
>> It's because of openejb+tomcat, usually I can change a line of code and
>> see
>> the new change without restart tomcat or reload the webapp.
>> It does not reload the webapp, just the single class, but it depends,
>> sometimes it's necessary to do a restart or reload the webapp, the plugin
>> somehow is able to understand that (you see "restart" in the tomcat
>> status).
>> As I said in another email, where I explain a bit about WTP plugin, it's
>> necessary to have a plugin that takes care of a few tasks (like set
>> openejb_home dynamically, set bootstrap jars and so on).
>> Probably is not so difficult to extend the current wtp tomcat plugin to
>> handle openejb.
>>
>
> That's interesting. We do have an WTP-based Eclipse plugin in development
> for OpenEJB, but I think it might be OpenEJB-standalone only at this point.
> Jonathan, would know better -- he wrote it :)
That's absolutely right - the WTP plugin is only for the standalone OpenEJB
server. There is already a WTP plugin for Tomcat which comes with the
Eclipse JST/WST tools.
I don't have any ideas of my own as to why Eclipse isn't hotswapping your
code, although I did wonder whether it was just a class loading issue or
something like that (but that is just a complete guess).
>
> On Feb 11, 2009, at 12:57 AM, Paolo Spadafora wrote:
>
>> With eclipse WTP you can debug a web application without restart tomcat
>> (except a few cases, like changes on a struts config).
>> It runs an instance of tomcat using a temp folder to deploy webapp
>> (exploded) and some custom xml configuration (adds a few special tags
>> inside
>> server.xml and web.xml).
>> I think what we need is something like the JBoss plugin not WTP.
>> The JBoss plugin does something very simple, keeps in synch your webapps
>> and
>> ejbs by copying the compiled classes (and project files) under the
>> deployment folder, like mywebapp.war or myejb.jar, but these are folders,
>> not files.
>> Basically the tomcat-openejb plugin should do a few simple things:
>> - start its own customized instance of tomcat with a pre-deployed
>> application: openejb.war
>> - keep a list of deployed application (eg: a Web Application "webapp" and
>> an
>> EJB "ejb")
>> - intercept changes to deployed webapp files or class compilation and
>> synch
>> with tomcat copy
>> - intercept changes to deployed ejb and synch with the filesystem/openejb,
>> like runtime class loading/replacement
>> - undeploy and clean (temp files, etc)
>>
>> For instance, for point 1, the plug-in should dynamically crate a temp
>> folder where to run openejb-tomcat, set openejb home for you, set
>> bootstrap
>> jars, etc. usually they do in the plug-in folder:
>> eclipse/plugins/openejb.apache.org/tmp0/.
>> There is more, but I think is enough to give you an idea.
>>
>
>
> Jonathan might have a better idea what it might take to do some of these
> things. And while we're wrangling up people, are you at all interested in
> working on it? I bet you're already designing it in your head :)
>
This all sounds very interesting - I think a WTP server for Tomcat+OpenEJB
would be be very useful. The current plugin uses the DeployerBusiness EJB in
the standalone server, and it looks like this is available in Tomcat,
perhaps we can use functionality we already have in
org.apache.openejb.eclipse.server.ServerDeployer [
https://svn.apache.org/repos/asf/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.server/src/main/java/org/apache/openejb/eclipse/server/ServerDeployer.java]
to keep everything in sync.
If you'd like to work on this, please do join in. I'll help you in any way I
can.
Jon
>
>
> -David
>
>
>
> Bye,
>> Paolo
>>
>>
>> On 13/02/09 05:12, "Karan Malhi" <ka...@gmail.com> wrote:
>>
>> I am using maven-tomcat-plugin in eclipse and its working fine. I have
>>> not
>>> run it in debug mode, but I have to redeploy the app if I make a change
>>> to
>>> any .class or update a jar in the lib. Here is the tomcat documentation
>>> which says that in development mode, tomcat would reload teh app if
>>> reloadable is set to true
>>>
>>> reloadable
>>>
>>> Set to true if you want Catalina to monitor classes in /WEB-INF/classes/
>>> and
>>> /WEB-INF/lib for changes, and automatically reload the web application if
>>> a
>>> change is detected. This feature is very useful during application
>>> development, but it requires significant runtime overhead and is not
>>> recommended for use on deployed production applications. That's why the
>>> default setting for this attribute is *false*. You can use the
>>> Manager<http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html>web
>>> application, however, to trigger reloads of deployed applications on
>>> demand.
>>> The maven-tomcat-plugin also redeploys the app when I make some change.
>>>
>>> I do not know much about tomcat +WTP, but seems like whether debugging or
>>> not, webapp is reloaded when classes/jars change in webapp.
>>>
>>> Question:- Is it because of openejb + tomcat that you have to reload the
>>> webapp while debugging, or do you have to do that anyway (for a tomcat
>>> instance without openejb)?
>>>
>>> On Wed, Feb 11, 2009 at 12:14 AM, David Blevins <david.blevins@visi.com
>>> >wrote:
>>>
>>> On Feb 3, 2009, at 2:30 AM, Paolo Spadafora wrote:
>>>>
>>>> To be able to work seriously I need to debug tomcat with embed openejb
>>>>
>>>>> using
>>>>> WTP,
>>>>> I know how to do it with remote debugger but doesn't work well, have to
>>>>> re-deploy my ejb+webapp each time.
>>>>>
>>>>>
>>>> Hi Paolo,
>>>>
>>>> I'm not familiar with the Tomcat support in the Eclipse WTP. If you can
>>>> tell me a bit about it that would be appreciated.
>>>>
>>>> Karan was mentioning something the other day regarding Eclipse/Tomcat
>>>> and
>>>> having to start/stop Tomcat after each change. Cc'ing him as maybe he
>>>> has
>>>> some info also.
>>>>
>>>> -David
>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>>
>
Re: Eclipse WTP + Tomcat Debug
Posted by David Blevins <da...@visi.com>.
On Feb 13, 2009, at 3:43 AM, Paolo Spadafora wrote:
> Hi,
> To answer you question: yes.
> It's because of openejb+tomcat, usually I can change a line of code
> and see
> the new change without restart tomcat or reload the webapp.
> It does not reload the webapp, just the single class, but it depends,
> sometimes it's necessary to do a restart or reload the webapp, the
> plugin
> somehow is able to understand that (you see "restart" in the tomcat
> status).
> As I said in another email, where I explain a bit about WTP plugin,
> it's
> necessary to have a plugin that takes care of a few tasks (like set
> openejb_home dynamically, set bootstrap jars and so on).
> Probably is not so difficult to extend the current wtp tomcat plugin
> to
> handle openejb.
That's interesting. We do have an WTP-based Eclipse plugin in
development for OpenEJB, but I think it might be OpenEJB-standalone
only at this point. Jonathan, would know better -- he wrote it :)
On Feb 11, 2009, at 12:57 AM, Paolo Spadafora wrote:
> With eclipse WTP you can debug a web application without restart
> tomcat
> (except a few cases, like changes on a struts config).
> It runs an instance of tomcat using a temp folder to deploy webapp
> (exploded) and some custom xml configuration (adds a few special
> tags inside
> server.xml and web.xml).
> I think what we need is something like the JBoss plugin not WTP.
> The JBoss plugin does something very simple, keeps in synch your
> webapps and
> ejbs by copying the compiled classes (and project files) under the
> deployment folder, like mywebapp.war or myejb.jar, but these are
> folders,
> not files.
> Basically the tomcat-openejb plugin should do a few simple things:
> - start its own customized instance of tomcat with a pre-deployed
> application: openejb.war
> - keep a list of deployed application (eg: a Web Application
> "webapp" and an
> EJB "ejb")
> - intercept changes to deployed webapp files or class compilation
> and synch
> with tomcat copy
> - intercept changes to deployed ejb and synch with the filesystem/
> openejb,
> like runtime class loading/replacement
> - undeploy and clean (temp files, etc)
>
> For instance, for point 1, the plug-in should dynamically crate a temp
> folder where to run openejb-tomcat, set openejb home for you, set
> bootstrap
> jars, etc. usually they do in the plug-in folder:
> eclipse/plugins/openejb.apache.org/tmp0/.
> There is more, but I think is enough to give you an idea.
Jonathan might have a better idea what it might take to do some of
these things. And while we're wrangling up people, are you at all
interested in working on it? I bet you're already designing it in
your head :)
-David
> Bye,
> Paolo
>
>
> On 13/02/09 05:12, "Karan Malhi" <ka...@gmail.com> wrote:
>
>> I am using maven-tomcat-plugin in eclipse and its working fine. I
>> have not
>> run it in debug mode, but I have to redeploy the app if I make a
>> change to
>> any .class or update a jar in the lib. Here is the tomcat
>> documentation
>> which says that in development mode, tomcat would reload teh app if
>> reloadable is set to true
>>
>> reloadable
>>
>> Set to true if you want Catalina to monitor classes in /WEB-INF/
>> classes/ and
>> /WEB-INF/lib for changes, and automatically reload the web
>> application if a
>> change is detected. This feature is very useful during application
>> development, but it requires significant runtime overhead and is not
>> recommended for use on deployed production applications. That's why
>> the
>> default setting for this attribute is *false*. You can use the
>> Manager<http://tomcat.apache.org/tomcat-6.0-doc/manager-
>> howto.html>web
>> application, however, to trigger reloads of deployed applications on
>> demand.
>> The maven-tomcat-plugin also redeploys the app when I make some
>> change.
>>
>> I do not know much about tomcat +WTP, but seems like whether
>> debugging or
>> not, webapp is reloaded when classes/jars change in webapp.
>>
>> Question:- Is it because of openejb + tomcat that you have to
>> reload the
>> webapp while debugging, or do you have to do that anyway (for a
>> tomcat
>> instance without openejb)?
>>
>> On Wed, Feb 11, 2009 at 12:14 AM, David Blevins <david.blevins@visi.com
>> >wrote:
>>
>>> On Feb 3, 2009, at 2:30 AM, Paolo Spadafora wrote:
>>>
>>> To be able to work seriously I need to debug tomcat with embed
>>> openejb
>>>> using
>>>> WTP,
>>>> I know how to do it with remote debugger but doesn't work well,
>>>> have to
>>>> re-deploy my ejb+webapp each time.
>>>>
>>>
>>> Hi Paolo,
>>>
>>> I'm not familiar with the Tomcat support in the Eclipse WTP. If
>>> you can
>>> tell me a bit about it that would be appreciated.
>>>
>>> Karan was mentioning something the other day regarding Eclipse/
>>> Tomcat and
>>> having to start/stop Tomcat after each change. Cc'ing him as
>>> maybe he has
>>> some info also.
>>>
>>> -David
>>>
>>>
>>>
>>
>
>
>
Re: Eclipse WTP + Tomcat Debug
Posted by Paolo Spadafora <p....@gmail.com>.
Hi,
To answer you question: yes.
It's because of openejb+tomcat, usually I can change a line of code and see
the new change without restart tomcat or reload the webapp.
It does not reload the webapp, just the single class, but it depends,
sometimes it's necessary to do a restart or reload the webapp, the plugin
somehow is able to understand that (you see "restart" in the tomcat status).
As I said in another email, where I explain a bit about WTP plugin, it's
necessary to have a plugin that takes care of a few tasks (like set
openejb_home dynamically, set bootstrap jars and so on).
Probably is not so difficult to extend the current wtp tomcat plugin to
handle openejb.
Bye,
Paolo
On 13/02/09 05:12, "Karan Malhi" <ka...@gmail.com> wrote:
> I am using maven-tomcat-plugin in eclipse and its working fine. I have not
> run it in debug mode, but I have to redeploy the app if I make a change to
> any .class or update a jar in the lib. Here is the tomcat documentation
> which says that in development mode, tomcat would reload teh app if
> reloadable is set to true
>
> reloadable
>
> Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and
> /WEB-INF/lib for changes, and automatically reload the web application if a
> change is detected. This feature is very useful during application
> development, but it requires significant runtime overhead and is not
> recommended for use on deployed production applications. That's why the
> default setting for this attribute is *false*. You can use the
> Manager<http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html>web
> application, however, to trigger reloads of deployed applications on
> demand.
> The maven-tomcat-plugin also redeploys the app when I make some change.
>
> I do not know much about tomcat +WTP, but seems like whether debugging or
> not, webapp is reloaded when classes/jars change in webapp.
>
> Question:- Is it because of openejb + tomcat that you have to reload the
> webapp while debugging, or do you have to do that anyway (for a tomcat
> instance without openejb)?
>
> On Wed, Feb 11, 2009 at 12:14 AM, David Blevins <da...@visi.com>wrote:
>
>> On Feb 3, 2009, at 2:30 AM, Paolo Spadafora wrote:
>>
>> To be able to work seriously I need to debug tomcat with embed openejb
>>> using
>>> WTP,
>>> I know how to do it with remote debugger but doesn't work well, have to
>>> re-deploy my ejb+webapp each time.
>>>
>>
>> Hi Paolo,
>>
>> I'm not familiar with the Tomcat support in the Eclipse WTP. If you can
>> tell me a bit about it that would be appreciated.
>>
>> Karan was mentioning something the other day regarding Eclipse/Tomcat and
>> having to start/stop Tomcat after each change. Cc'ing him as maybe he has
>> some info also.
>>
>> -David
>>
>>
>>
>
Re: Eclipse WTP + Tomcat Debug
Posted by Karan Malhi <ka...@gmail.com>.
I am using maven-tomcat-plugin in eclipse and its working fine. I have not
run it in debug mode, but I have to redeploy the app if I make a change to
any .class or update a jar in the lib. Here is the tomcat documentation
which says that in development mode, tomcat would reload teh app if
reloadable is set to true
reloadable
Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and
/WEB-INF/lib for changes, and automatically reload the web application if a
change is detected. This feature is very useful during application
development, but it requires significant runtime overhead and is not
recommended for use on deployed production applications. That's why the
default setting for this attribute is *false*. You can use the
Manager<http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html>web
application, however, to trigger reloads of deployed applications on
demand.
The maven-tomcat-plugin also redeploys the app when I make some change.
I do not know much about tomcat +WTP, but seems like whether debugging or
not, webapp is reloaded when classes/jars change in webapp.
Question:- Is it because of openejb + tomcat that you have to reload the
webapp while debugging, or do you have to do that anyway (for a tomcat
instance without openejb)?
On Wed, Feb 11, 2009 at 12:14 AM, David Blevins <da...@visi.com>wrote:
> On Feb 3, 2009, at 2:30 AM, Paolo Spadafora wrote:
>
> To be able to work seriously I need to debug tomcat with embed openejb
>> using
>> WTP,
>> I know how to do it with remote debugger but doesn't work well, have to
>> re-deploy my ejb+webapp each time.
>>
>
> Hi Paolo,
>
> I'm not familiar with the Tomcat support in the Eclipse WTP. If you can
> tell me a bit about it that would be appreciated.
>
> Karan was mentioning something the other day regarding Eclipse/Tomcat and
> having to start/stop Tomcat after each change. Cc'ing him as maybe he has
> some info also.
>
> -David
>
>
>
--
Karan Singh Malhi
Eclipse WTP + Tomcat Debug
Posted by David Blevins <da...@visi.com>.
On Feb 3, 2009, at 2:30 AM, Paolo Spadafora wrote:
> To be able to work seriously I need to debug tomcat with embed
> openejb using
> WTP,
> I know how to do it with remote debugger but doesn’t work well, have
> to
> re-deploy my ejb+webapp each time.
Hi Paolo,
I'm not familiar with the Tomcat support in the Eclipse WTP. If you
can tell me a bit about it that would be appreciated.
Karan was mentioning something the other day regarding Eclipse/Tomcat
and having to start/stop Tomcat after each change. Cc'ing him as
maybe he has some info also.
-David