RE: openejb.xml
Hi Romain, From: http://download.oracle.com/otndocs/jcp/persistence-2.0-fr-eval-oth-JSpec/ snippet 8.2.1.5 jta-data-source, non-jta-data-source In Java EE environments, the jta-data-source and non-jta-data-source elements are used to specify the global JNDI name of the JTA and/or non-JTA data source to be used by the persistence provider. If neither is specified, the deployer must specify a JTA data source at deployment or a JTA data source must be provided by the container, and a JTA EntityManagerFactory will be created to correspond to it. These elements name the data source in the local environment; the format of these names and the ability to specify the names are product specific. /snippet Specifically the elements are used to specify the *global JNDI name*. Granted that the format of these names and the ability to specify the names are product specific. That's why it's 'java:/DefaultDS' (JBoss 6) or 'java:jboss/datasources/ExampleDS' (JBoss 7) or 'jdbc/__default' (Glassfish) etc... and if the code does a new InitialContext(java:/DefaultDS) it will get that datasource. Where you getting your info from about standards? So back to OpenEJB ... jta-data-sourcefoo/jta-data-source ... I cannot get datasource if I do new InitialContext(foo) because it's actually new InitialContext(java:openejb/Resource/xyz) or whatever the resource name is. It doesn't match up. Some samples to the above that I noticed ... #1. I don't have an OpenEJB managed datasource, but I have my own DBCP that I manually loaded into JNDI at java:/jdbc/arquillian/dbUnitDS (not sure how this setup will play out with JTA). I get this in the log: INFO - Adjusting PersistenceUnit test jta-data-source to Resource ID 'Default JDBC Database' from '/jdbc/arquillian/dbUnitDS' #2. I have jta-data-sourceblah/jta-data-source and dbUnitDS=new://Resource?type=DataSource. I get this in the log: INFO - Adjusting PersistenceUnit test jta-data-source to Resource ID 'dbUnitDS' from 'blah' Okay... thanks... I would have preferred an error and have to correct (align) the entries. I don't know what the behaviour would be if I had multiple OpenEJB managed datasources. Didn't try it. I appreciate the discussion on the format of jta-data-source, but like said earlier it's how OpenEJB swaps it out behind the scenes that throws me off as, IMHO, it doesn't respect the global JNDI entry that I put in there. Am I missing something? Wow... this is really getting off-topic to my initial question. Good discussion, though. I'll try to get back on track ... I'm going to change the name from jndi.properties to something custom (openejb.properties) and create some custom glue Arquillian extension to load the contents of the file and set the entries in InitialContext. I think that will work. Some hoping I wouldn't have write up some custom thing for this. Oh well. C'est la vie. Sorry for the long email. Thanks, Trev -Original Message- From: Romain Manni-Bucau [mailto:rmannibu...@gmail.com] Sent: Thursday, December 13, 2012 3:08 PM To: users@openejb.apache.org Subject: Re: openejb.xml wrong jta-data-sourcefoo/jta-data-source is the standard. java:... names are not. You can use java:openejb/Resource/foo too i guess...but well not better ;) OpenEJB 4.5.1 should support java:global or java:app (can't remember) names for datasources. But well clearly not something portable between application servers. about root utl we can't guess it from arquillian so the heuristic is to use the place where persistence.xml is (well it is the marker then we update it). You can't compare openejb to jboss or was because openejb arquilliana dapter doesn't dump the archive on the disk. If you need it use tomee remote arquillian adapter (or embedded) maybe Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau 2012/12/13 Baker, Trevor crba...@mail.ubc.ca: jta-data-sourcefoo/jta-data-source
Re: openejb.xml
well, if you want a global name use java:openejb/Resource... one...but that's not portable at all, thought i saw either in JPA spec or JavaEE (can't recall ATM) the name was not absolute. about arquillian you can put the properties in arquillian.xml with our adapter...not sure what you do in fact Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau 2012/12/14 Baker, Trevor crba...@mail.ubc.ca: Hi Romain, From: http://download.oracle.com/otndocs/jcp/persistence-2.0-fr-eval-oth-JSpec/ snippet 8.2.1.5 jta-data-source, non-jta-data-source In Java EE environments, the jta-data-source and non-jta-data-source elements are used to specify the global JNDI name of the JTA and/or non-JTA data source to be used by the persistence provider. If neither is specified, the deployer must specify a JTA data source at deployment or a JTA data source must be provided by the container, and a JTA EntityManagerFactory will be created to correspond to it. These elements name the data source in the local environment; the format of these names and the ability to specify the names are product specific. /snippet Specifically the elements are used to specify the *global JNDI name*. Granted that the format of these names and the ability to specify the names are product specific. That's why it's 'java:/DefaultDS' (JBoss 6) or 'java:jboss/datasources/ExampleDS' (JBoss 7) or 'jdbc/__default' (Glassfish) etc... and if the code does a new InitialContext(java:/DefaultDS) it will get that datasource. Where you getting your info from about standards? So back to OpenEJB ... jta-data-sourcefoo/jta-data-source ... I cannot get datasource if I do new InitialContext(foo) because it's actually new InitialContext(java:openejb/Resource/xyz) or whatever the resource name is. It doesn't match up. Some samples to the above that I noticed ... #1. I don't have an OpenEJB managed datasource, but I have my own DBCP that I manually loaded into JNDI at java:/jdbc/arquillian/dbUnitDS (not sure how this setup will play out with JTA). I get this in the log: INFO - Adjusting PersistenceUnit test jta-data-source to Resource ID 'Default JDBC Database' from '/jdbc/arquillian/dbUnitDS' #2. I have jta-data-sourceblah/jta-data-source and dbUnitDS=new://Resource?type=DataSource. I get this in the log: INFO - Adjusting PersistenceUnit test jta-data-source to Resource ID 'dbUnitDS' from 'blah' Okay... thanks... I would have preferred an error and have to correct (align) the entries. I don't know what the behaviour would be if I had multiple OpenEJB managed datasources. Didn't try it. I appreciate the discussion on the format of jta-data-source, but like said earlier it's how OpenEJB swaps it out behind the scenes that throws me off as, IMHO, it doesn't respect the global JNDI entry that I put in there. Am I missing something? Wow... this is really getting off-topic to my initial question. Good discussion, though. I'll try to get back on track ... I'm going to change the name from jndi.properties to something custom (openejb.properties) and create some custom glue Arquillian extension to load the contents of the file and set the entries in InitialContext. I think that will work. Some hoping I wouldn't have write up some custom thing for this. Oh well. C'est la vie. Sorry for the long email. Thanks, Trev -Original Message- From: Romain Manni-Bucau [mailto:rmannibu...@gmail.com] Sent: Thursday, December 13, 2012 3:08 PM To: users@openejb.apache.org Subject: Re: openejb.xml wrong jta-data-sourcefoo/jta-data-source is the standard. java:... names are not. You can use java:openejb/Resource/foo too i guess...but well not better ;) OpenEJB 4.5.1 should support java:global or java:app (can't remember) names for datasources. But well clearly not something portable between application servers. about root utl we can't guess it from arquillian so the heuristic is to use the place where persistence.xml is (well it is the marker then we update it). You can't compare openejb to jboss or was because openejb arquilliana dapter doesn't dump the archive on the disk. If you need it use tomee remote arquillian adapter (or embedded) maybe Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau 2012/12/13 Baker, Trevor crba...@mail.ubc.ca: jta-data-sourcefoo/jta-data-source
RE: openejb.xml
Yup. I've never heard of a portable jta-data-source. I see a lot examples (even the Java EE tutorial) using 'jdbc/MyDS' because that's the Glassfish ref impl way of doing it. Hopefully in the future they can make it more portable like the EJB 3.1 spec on naming. If you remember that spec, I would love to see it. D'uh. Properties in arquillian.xml. Forgot about that. Many thanks. Trev -Original Message- From: Romain Manni-Bucau [mailto:rmannibu...@gmail.com] Sent: Friday, December 14, 2012 1:11 AM To: users@openejb.apache.org Subject: Re: openejb.xml well, if you want a global name use java:openejb/Resource... one...but that's not portable at all, thought i saw either in JPA spec or JavaEE (can't recall ATM) the name was not absolute. about arquillian you can put the properties in arquillian.xml with our adapter...not sure what you do in fact Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau 2012/12/14 Baker, Trevor crba...@mail.ubc.ca: Hi Romain, From: http://download.oracle.com/otndocs/jcp/persistence-2.0-fr-eval-oth-JSp ec/ snippet 8.2.1.5 jta-data-source, non-jta-data-source In Java EE environments, the jta-data-source and non-jta-data-source elements are used to specify the global JNDI name of the JTA and/or non-JTA data source to be used by the persistence provider. If neither is specified, the deployer must specify a JTA data source at deployment or a JTA data source must be provided by the container, and a JTA EntityManagerFactory will be created to correspond to it. These elements name the data source in the local environment; the format of these names and the ability to specify the names are product specific. /snippet Specifically the elements are used to specify the *global JNDI name*. Granted that the format of these names and the ability to specify the names are product specific. That's why it's 'java:/DefaultDS' (JBoss 6) or 'java:jboss/datasources/ExampleDS' (JBoss 7) or 'jdbc/__default' (Glassfish) etc... and if the code does a new InitialContext(java:/DefaultDS) it will get that datasource. Where you getting your info from about standards? So back to OpenEJB ... jta-data-sourcefoo/jta-data-source ... I cannot get datasource if I do new InitialContext(foo) because it's actually new InitialContext(java:openejb/Resource/xyz) or whatever the resource name is. It doesn't match up. Some samples to the above that I noticed ... #1. I don't have an OpenEJB managed datasource, but I have my own DBCP that I manually loaded into JNDI at java:/jdbc/arquillian/dbUnitDS (not sure how this setup will play out with JTA). I get this in the log: INFO - Adjusting PersistenceUnit test jta-data-source to Resource ID 'Default JDBC Database' from '/jdbc/arquillian/dbUnitDS' #2. I have jta-data-sourceblah/jta-data-source and dbUnitDS=new://Resource?type=DataSource. I get this in the log: INFO - Adjusting PersistenceUnit test jta-data-source to Resource ID 'dbUnitDS' from 'blah' Okay... thanks... I would have preferred an error and have to correct (align) the entries. I don't know what the behaviour would be if I had multiple OpenEJB managed datasources. Didn't try it. I appreciate the discussion on the format of jta-data-source, but like said earlier it's how OpenEJB swaps it out behind the scenes that throws me off as, IMHO, it doesn't respect the global JNDI entry that I put in there. Am I missing something? Wow... this is really getting off-topic to my initial question. Good discussion, though. I'll try to get back on track ... I'm going to change the name from jndi.properties to something custom (openejb.properties) and create some custom glue Arquillian extension to load the contents of the file and set the entries in InitialContext. I think that will work. Some hoping I wouldn't have write up some custom thing for this. Oh well. C'est la vie. Sorry for the long email. Thanks, Trev -Original Message- From: Romain Manni-Bucau [mailto:rmannibu...@gmail.com] Sent: Thursday, December 13, 2012 3:08 PM To: users@openejb.apache.org Subject: Re: openejb.xml wrong jta-data-sourcefoo/jta-data-source is the standard. java:... names are not. You can use java:openejb/Resource/foo too i guess...but well not better ;) OpenEJB 4.5.1 should support java:global or java:app (can't remember) names for datasources. But well clearly not something portable between application servers. about root utl we can't guess it from arquillian so the heuristic is to use the place where persistence.xml is (well it is the marker then we update it). You can't compare openejb to jboss or was because openejb arquilliana dapter doesn't dump the archive on the disk. If you need it use tomee remote arquillian adapter (or embedded) maybe Romain Manni-Bucau Twitter
Re: openejb.xml
[off topic]personally i'd love to get rid of JNDI, then be able to for instance use a producer to get the datasource - would need a lot of changes in the spec and the ability to configure from the server some common producers for apps but would be far easier then - just my opinion[/] Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau 2012/12/14 Baker, Trevor crba...@mail.ubc.ca: Yup. I've never heard of a portable jta-data-source. I see a lot examples (even the Java EE tutorial) using 'jdbc/MyDS' because that's the Glassfish ref impl way of doing it. Hopefully in the future they can make it more portable like the EJB 3.1 spec on naming. If you remember that spec, I would love to see it. D'uh. Properties in arquillian.xml. Forgot about that. Many thanks. Trev -Original Message- From: Romain Manni-Bucau [mailto:rmannibu...@gmail.com] Sent: Friday, December 14, 2012 1:11 AM To: users@openejb.apache.org Subject: Re: openejb.xml well, if you want a global name use java:openejb/Resource... one...but that's not portable at all, thought i saw either in JPA spec or JavaEE (can't recall ATM) the name was not absolute. about arquillian you can put the properties in arquillian.xml with our adapter...not sure what you do in fact Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau 2012/12/14 Baker, Trevor crba...@mail.ubc.ca: Hi Romain, From: http://download.oracle.com/otndocs/jcp/persistence-2.0-fr-eval-oth-JSp ec/ snippet 8.2.1.5 jta-data-source, non-jta-data-source In Java EE environments, the jta-data-source and non-jta-data-source elements are used to specify the global JNDI name of the JTA and/or non-JTA data source to be used by the persistence provider. If neither is specified, the deployer must specify a JTA data source at deployment or a JTA data source must be provided by the container, and a JTA EntityManagerFactory will be created to correspond to it. These elements name the data source in the local environment; the format of these names and the ability to specify the names are product specific. /snippet Specifically the elements are used to specify the *global JNDI name*. Granted that the format of these names and the ability to specify the names are product specific. That's why it's 'java:/DefaultDS' (JBoss 6) or 'java:jboss/datasources/ExampleDS' (JBoss 7) or 'jdbc/__default' (Glassfish) etc... and if the code does a new InitialContext(java:/DefaultDS) it will get that datasource. Where you getting your info from about standards? So back to OpenEJB ... jta-data-sourcefoo/jta-data-source ... I cannot get datasource if I do new InitialContext(foo) because it's actually new InitialContext(java:openejb/Resource/xyz) or whatever the resource name is. It doesn't match up. Some samples to the above that I noticed ... #1. I don't have an OpenEJB managed datasource, but I have my own DBCP that I manually loaded into JNDI at java:/jdbc/arquillian/dbUnitDS (not sure how this setup will play out with JTA). I get this in the log: INFO - Adjusting PersistenceUnit test jta-data-source to Resource ID 'Default JDBC Database' from '/jdbc/arquillian/dbUnitDS' #2. I have jta-data-sourceblah/jta-data-source and dbUnitDS=new://Resource?type=DataSource. I get this in the log: INFO - Adjusting PersistenceUnit test jta-data-source to Resource ID 'dbUnitDS' from 'blah' Okay... thanks... I would have preferred an error and have to correct (align) the entries. I don't know what the behaviour would be if I had multiple OpenEJB managed datasources. Didn't try it. I appreciate the discussion on the format of jta-data-source, but like said earlier it's how OpenEJB swaps it out behind the scenes that throws me off as, IMHO, it doesn't respect the global JNDI entry that I put in there. Am I missing something? Wow... this is really getting off-topic to my initial question. Good discussion, though. I'll try to get back on track ... I'm going to change the name from jndi.properties to something custom (openejb.properties) and create some custom glue Arquillian extension to load the contents of the file and set the entries in InitialContext. I think that will work. Some hoping I wouldn't have write up some custom thing for this. Oh well. C'est la vie. Sorry for the long email. Thanks, Trev -Original Message- From: Romain Manni-Bucau [mailto:rmannibu...@gmail.com] Sent: Thursday, December 13, 2012 3:08 PM To: users@openejb.apache.org Subject: Re: openejb.xml wrong jta-data-sourcefoo/jta-data-source is the standard. java:... names are not. You can use java:openejb/Resource/foo too i guess...but well not better ;) OpenEJB 4.5.1 should support
openejb.xml
Hi, I have the following jndi.properties: java.naming.factory.initial=org.apache.openejb.client.LocalInitialContextFactory # create a new data source at: java:/openejb/Resource/dbUnitDS dbUnitDS=new://Resource?type=DataSource dbUnitDS.JdbcUrl=jdbc:h2:mem:arquillian;DB_CLOSE_DELAY=-1 dbUnitDS.JdbcDriver=org.h2.Driver dbUnitDS.JtaManaged=true # add properties for the persistence unit test.hibernate.dialect=org.hibernate.dialect.H2Dialect test.hibernate.hbm2ddl.auto=create-drop test.hibernate.id.new_generator_mappings=true Unfortunately, jndi.properties is interfering with non-openejb unit tests in the project. Would like to convert to openejb.xml but need some help. Can someone send back the openejb.xml equivalent. I'm assuming I can place in src/test/resources/openejb.xml. Not being lazy. Just can't find any good resources. Would be nice if this page could have a sample openejb.xml: http://tomee.apache.org/embedded-configuration.html Thanks, Trev
RE: openejb.xml
Fixed some line-ending weirdness. -Original Message- From: Baker, Trevor [mailto:crba...@mail.ubc.ca] Sent: Thursday, December 13, 2012 12:07 PM To: users@openejb.apache.org Subject: openejb.xml Hi, I have the following jndi.properties: java.naming.factory.initial=org.apache.openejb.client.LocalInitialContextFactory # create a new data source at: java:/openejb/Resource/dbUnitDS dbUnitDS=new://Resource?type=DataSource dbUnitDS.JdbcUrl=jdbc:h2:mem:arquillian;DB_CLOSE_DELAY=-1 dbUnitDS.JdbcDriver=org.h2.Driver dbUnitDS.JtaManaged=true # add properties for the persistence unit test.hibernate.dialect=org.hibernate.dialect.H2Dialect test.hibernate.hbm2ddl.auto=create-drop test.hibernate.id.new_generator_mappings=true --- Unfortunately, jndi.properties is interfering with non-openejb unit tests in the project. Would like to convert to openejb.xml but need some help. Can someone send back the openejb.xml equivalent. I'm assuming I can place in src/test/resources/openejb.xml. Not being lazy. Just can't find any good resources. Would be nice if this page could have a sample openejb.xml: http://tomee.apache.org/embedded-configuration.html Thanks, Trev
Re: openejb.xml
Hi Trevor, Can you tell us your changes/findings so we can adjust the docs to make it easier for everyone else? Best Regards, Neale - Original Message - From: Baker, Trevor crba...@mail.ubc.ca To: users@openejb.apache.org Sent: Friday, December 14, 2012 7:10 AM Subject: RE: openejb.xml Fixed some line-ending weirdness. -Original Message- From: Baker, Trevor [mailto:crba...@mail.ubc.ca] Sent: Thursday, December 13, 2012 12:07 PM To: users@openejb.apache.org Subject: openejb.xml Hi, I have the following jndi.properties: java.naming.factory.initial=org.apache.openejb.client.LocalInitialContextFactory # create a new data source at: java:/openejb/Resource/dbUnitDS dbUnitDS=new://Resource?type=DataSource dbUnitDS.JdbcUrl=jdbc:h2:mem:arquillian;DB_CLOSE_DELAY=-1 dbUnitDS.JdbcDriver=org.h2.Driver dbUnitDS.JtaManaged=true # add properties for the persistence unit test.hibernate.dialect=org.hibernate.dialect.H2Dialect test.hibernate.hbm2ddl.auto=create-drop test.hibernate.id.new_generator_mappings=true --- Unfortunately, jndi.properties is interfering with non-openejb unit tests in the project. Would like to convert to openejb.xml but need some help. Can someone send back the openejb.xml equivalent. I'm assuming I can place in src/test/resources/openejb.xml. Not being lazy. Just can't find any good resources. Would be nice if this page could have a sample openejb.xml: http://tomee.apache.org/embedded-configuration.html Thanks, Trev
Re: openejb.xml
hmm jndi.properties is not managed by openejb directly in your case byt InitialContext IIRC why not simply passing these properties to openejb when starting the container? Note: new EJBContainer API ignores jndi.properties IIRC for the datasource you can create a conf folder (in .) and add openejb.xml file. For hibernate you'll need to add it somewhere else (you can use altdd to define a test.persistence.xml normally) Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau 2012/12/13 Neale ne...@metawerx.net: Hi Trevor, Can you tell us your changes/findings so we can adjust the docs to make it easier for everyone else? Best Regards, Neale - Original Message - From: Baker, Trevor crba...@mail.ubc.ca To: users@openejb.apache.org Sent: Friday, December 14, 2012 7:10 AM Subject: RE: openejb.xml Fixed some line-ending weirdness. -Original Message- From: Baker, Trevor [mailto:crba...@mail.ubc.ca] Sent: Thursday, December 13, 2012 12:07 PM To: users@openejb.apache.org Subject: openejb.xml Hi, I have the following jndi.properties: java.naming.factory.initial=org.apache.openejb.client.LocalInitialContextFactory # create a new data source at: java:/openejb/Resource/dbUnitDS dbUnitDS=new://Resource?type=DataSource dbUnitDS.JdbcUrl=jdbc:h2:mem:arquillian;DB_CLOSE_DELAY=-1 dbUnitDS.JdbcDriver=org.h2.Driver dbUnitDS.JtaManaged=true # add properties for the persistence unit test.hibernate.dialect=org.hibernate.dialect.H2Dialect test.hibernate.hbm2ddl.auto=create-drop test.hibernate.id.new_generator_mappings=true --- Unfortunately, jndi.properties is interfering with non-openejb unit tests in the project. Would like to convert to openejb.xml but need some help. Can someone send back the openejb.xml equivalent. I'm assuming I can place in src/test/resources/openejb.xml. Not being lazy. Just can't find any good resources. Would be nice if this page could have a sample openejb.xml: http://tomee.apache.org/embedded-configuration.html Thanks, Trev
RE: openejb.xml
I'm hoping to use config files instead of doing it programmatically. I tried a src/test/resources/dbUnit-persistence.xml once before with Arquillian putting it into the archive as META-INF/persistence.xml. Sadly, the PU's root url passed to hibernate was incorrect and hibernate didn't obviously find my src/main/java/... @Entity tagged classes. So went the jndi.properties route and overriding entries in src/main/resources/META-INF/persistence.xml. I'll get a test case for you. IIRC, I think it used file://.../src/test/resources as the root url instead of a virtual Jar. For the PU's jta-data-sourcejava:/my/own/jdbc/dbUnitDS/jta-data-source, OpenEJB does some magic in the back and replaces it. Is there a way I can keep it and I can supply the data source? I got a JNDI tree importer for @Resource(lookup) stuff so I can throw in a DBCP too. Thanks, Trev -Original Message- From: Romain Manni-Bucau [mailto:rmannibu...@gmail.com] Sent: Thursday, December 13, 2012 12:40 PM To: users@openejb.apache.org Subject: Re: openejb.xml hmm jndi.properties is not managed by openejb directly in your case byt InitialContext IIRC why not simply passing these properties to openejb when starting the container? Note: new EJBContainer API ignores jndi.properties IIRC for the datasource you can create a conf folder (in .) and add openejb.xml file. For hibernate you'll need to add it somewhere else (you can use altdd to define a test.persistence.xml normally) Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau 2012/12/13 Neale ne...@metawerx.net: Hi Trevor, Can you tell us your changes/findings so we can adjust the docs to make it easier for everyone else? Best Regards, Neale - Original Message - From: Baker, Trevor crba...@mail.ubc.ca To: users@openejb.apache.org Sent: Friday, December 14, 2012 7:10 AM Subject: RE: openejb.xml Fixed some line-ending weirdness. -Original Message- From: Baker, Trevor [mailto:crba...@mail.ubc.ca] Sent: Thursday, December 13, 2012 12:07 PM To: users@openejb.apache.org Subject: openejb.xml Hi, I have the following jndi.properties: java.naming.factory.initial=org.apache.openejb.client.LocalInitialCont extFactory # create a new data source at: java:/openejb/Resource/dbUnitDS dbUnitDS=new://Resource?type=DataSource dbUnitDS.JdbcUrl=jdbc:h2:mem:arquillian;DB_CLOSE_DELAY=-1 dbUnitDS.JdbcDriver=org.h2.Driver dbUnitDS.JtaManaged=true # add properties for the persistence unit test.hibernate.dialect=org.hibernate.dialect.H2Dialect test.hibernate.hbm2ddl.auto=create-drop test.hibernate.id.new_generator_mappings=true --- Unfortunately, jndi.properties is interfering with non-openejb unit tests in the project. Would like to convert to openejb.xml but need some help. Can someone send back the openejb.xml equivalent. I'm assuming I can place in src/test/resources/openejb.xml. Not being lazy. Just can't find any good resources. Would be nice if this page could have a sample openejb.xml: http://tomee.apache.org/embedded-configuration.html Thanks, Trev
Re: openejb.xml
about root url with 1.5.1 it should be the build dir (well we look at classpath persistence.xml so if resources is in the classpath...) but you can avoid it specifying your entities. From arquillian in fully embedded mode that's not so easy to get it right (you can specify it using new StringAsset(..) so no root url) about the datasource just define a resource called foo (whatever you want but not java:foo) and use foo in the persistence.xml (java:/my/own/jdbc/dbUnitDS is not standard in this place) Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau 2012/12/13 Baker, Trevor crba...@mail.ubc.ca: I'm hoping to use config files instead of doing it programmatically. I tried a src/test/resources/dbUnit-persistence.xml once before with Arquillian putting it into the archive as META-INF/persistence.xml. Sadly, the PU's root url passed to hibernate was incorrect and hibernate didn't obviously find my src/main/java/... @Entity tagged classes. So went the jndi.properties route and overriding entries in src/main/resources/META-INF/persistence.xml. I'll get a test case for you. IIRC, I think it used file://.../src/test/resources as the root url instead of a virtual Jar. For the PU's jta-data-sourcejava:/my/own/jdbc/dbUnitDS/jta-data-source, OpenEJB does some magic in the back and replaces it. Is there a way I can keep it and I can supply the data source? I got a JNDI tree importer for @Resource(lookup) stuff so I can throw in a DBCP too. Thanks, Trev -Original Message- From: Romain Manni-Bucau [mailto:rmannibu...@gmail.com] Sent: Thursday, December 13, 2012 12:40 PM To: users@openejb.apache.org Subject: Re: openejb.xml hmm jndi.properties is not managed by openejb directly in your case byt InitialContext IIRC why not simply passing these properties to openejb when starting the container? Note: new EJBContainer API ignores jndi.properties IIRC for the datasource you can create a conf folder (in .) and add openejb.xml file. For hibernate you'll need to add it somewhere else (you can use altdd to define a test.persistence.xml normally) Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau 2012/12/13 Neale ne...@metawerx.net: Hi Trevor, Can you tell us your changes/findings so we can adjust the docs to make it easier for everyone else? Best Regards, Neale - Original Message - From: Baker, Trevor crba...@mail.ubc.ca To: users@openejb.apache.org Sent: Friday, December 14, 2012 7:10 AM Subject: RE: openejb.xml Fixed some line-ending weirdness. -Original Message- From: Baker, Trevor [mailto:crba...@mail.ubc.ca] Sent: Thursday, December 13, 2012 12:07 PM To: users@openejb.apache.org Subject: openejb.xml Hi, I have the following jndi.properties: java.naming.factory.initial=org.apache.openejb.client.LocalInitialCont extFactory # create a new data source at: java:/openejb/Resource/dbUnitDS dbUnitDS=new://Resource?type=DataSource dbUnitDS.JdbcUrl=jdbc:h2:mem:arquillian;DB_CLOSE_DELAY=-1 dbUnitDS.JdbcDriver=org.h2.Driver dbUnitDS.JtaManaged=true # add properties for the persistence unit test.hibernate.dialect=org.hibernate.dialect.H2Dialect test.hibernate.hbm2ddl.auto=create-drop test.hibernate.id.new_generator_mappings=true --- Unfortunately, jndi.properties is interfering with non-openejb unit tests in the project. Would like to convert to openejb.xml but need some help. Can someone send back the openejb.xml equivalent. I'm assuming I can place in src/test/resources/openejb.xml. Not being lazy. Just can't find any good resources. Would be nice if this page could have a sample openejb.xml: http://tomee.apache.org/embedded-configuration.html Thanks, Trev
RE: openejb.xml
Hi Romain, I agree Arquillian in fully embedded is not easy to get right. Been playing around with it for weeks. :-) Not only that but OpenEJB has to deal with different JPA providers too. I understand the desire to load stuff off of file://... because don't have to re-package all the code into a jar://... (or some protocol that jives with ShrinkWrap archives) but I think packaging it up would solve some Arquillian issues (at least for Hibernate ... not sure about other JPA providers). Thoughts? Ok, jta-data-sourcefoo/jta-data-source is the standard for *OpenEJB*. OpenEJB creates the JNDI entry 'java:/openejb/Resource/foo' for the JPA providers to use. Why can't I provide my own *explicit* JNDI path (regardless of how ugly my JNDI path is :-) ? I've worked with Weblogic and JBoss and they don't swap it out like OpenEJB does. It makes my config structure easier because then all OpenEJB and JBoss config aligns better and I have fewer overrides. Sounds like OpenEJB 4.5.1 doesn't support explicit JNDI paths for the jta-data-source non-jta-data-source? If it doesn't I'll create a Jira because I think it should be something for consideration for a future release. Trev -Original Message- From: Romain Manni-Bucau [mailto:rmannibu...@gmail.com] Sent: Thursday, December 13, 2012 1:50 PM To: users@openejb.apache.org Subject: Re: openejb.xml about root url with 1.5.1 it should be the build dir (well we look at classpath persistence.xml so if resources is in the classpath...) but you can avoid it specifying your entities. From arquillian in fully embedded mode that's not so easy to get it right (you can specify it using new StringAsset(..) so no root url) about the datasource just define a resource called foo (whatever you want but not java:foo) and use foo in the persistence.xml (java:/my/own/jdbc/dbUnitDS is not standard in this place) Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau 2012/12/13 Baker, Trevor crba...@mail.ubc.ca: I'm hoping to use config files instead of doing it programmatically. I tried a src/test/resources/dbUnit-persistence.xml once before with Arquillian putting it into the archive as META-INF/persistence.xml. Sadly, the PU's root url passed to hibernate was incorrect and hibernate didn't obviously find my src/main/java/... @Entity tagged classes. So went the jndi.properties route and overriding entries in src/main/resources/META-INF/persistence.xml. I'll get a test case for you. IIRC, I think it used file://.../src/test/resources as the root url instead of a virtual Jar. For the PU's jta-data-sourcejava:/my/own/jdbc/dbUnitDS/jta-data-source, OpenEJB does some magic in the back and replaces it. Is there a way I can keep it and I can supply the data source? I got a JNDI tree importer for @Resource(lookup) stuff so I can throw in a DBCP too. Thanks, Trev -Original Message- From: Romain Manni-Bucau [mailto:rmannibu...@gmail.com] Sent: Thursday, December 13, 2012 12:40 PM To: users@openejb.apache.org Subject: Re: openejb.xml hmm jndi.properties is not managed by openejb directly in your case byt InitialContext IIRC why not simply passing these properties to openejb when starting the container? Note: new EJBContainer API ignores jndi.properties IIRC for the datasource you can create a conf folder (in .) and add openejb.xml file. For hibernate you'll need to add it somewhere else (you can use altdd to define a test.persistence.xml normally) Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau 2012/12/13 Neale ne...@metawerx.net: Hi Trevor, Can you tell us your changes/findings so we can adjust the docs to make it easier for everyone else? Best Regards, Neale - Original Message - From: Baker, Trevor crba...@mail.ubc.ca To: users@openejb.apache.org Sent: Friday, December 14, 2012 7:10 AM Subject: RE: openejb.xml Fixed some line-ending weirdness. -Original Message- From: Baker, Trevor [mailto:crba...@mail.ubc.ca] Sent: Thursday, December 13, 2012 12:07 PM To: users@openejb.apache.org Subject: openejb.xml Hi, I have the following jndi.properties: java.naming.factory.initial=org.apache.openejb.client.LocalInitialCon t extFactory # create a new data source at: java:/openejb/Resource/dbUnitDS dbUnitDS=new://Resource?type=DataSource dbUnitDS.JdbcUrl=jdbc:h2:mem:arquillian;DB_CLOSE_DELAY=-1 dbUnitDS.JdbcDriver=org.h2.Driver dbUnitDS.JtaManaged=true # add properties for the persistence unit test.hibernate.dialect=org.hibernate.dialect.H2Dialect test.hibernate.hbm2ddl.auto=create-drop test.hibernate.id.new_generator_mappings=true --- Unfortunately, jndi.properties is interfering with non-openejb unit
Re: openejb.xml
wrong jta-data-sourcefoo/jta-data-source is the standard. java:... names are not. You can use java:openejb/Resource/foo too i guess...but well not better ;) OpenEJB 4.5.1 should support java:global or java:app (can't remember) names for datasources. But well clearly not something portable between application servers. about root utl we can't guess it from arquillian so the heuristic is to use the place where persistence.xml is (well it is the marker then we update it). You can't compare openejb to jboss or was because openejb arquilliana dapter doesn't dump the archive on the disk. If you need it use tomee remote arquillian adapter (or embedded) maybe Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau 2012/12/13 Baker, Trevor crba...@mail.ubc.ca: jta-data-sourcefoo/jta-data-source
OpenEJB.xml and a custom javax.naming.spi.ObjectFactory
Hey guys, One of the features I'm missing from GlassFish is the ability to bind an ObjectFactory into JNDI. We have a few of these written and need to put them into our instance. I'm also hoping to write a brand new one that could be used to create JNDI links (see previous thread in mailing list). Here's a simple example of a custom ObjectFactory: http://grepcode.com/file/repo1.maven.org/maven2/org.glassfish.connectors/connectors-internal-api/3.0/org/glassfish/resources/custom/factory/PrimitivesAndStringFactory.java Is there a way to put an ObjectFactory like that into conf/openejb.xml? I've read all the documentation on Resources and didn't find anything. I found some old mails on the openejb.iusers that say if you're in Tomcat, you can put it into context.xml, but I was curious if there was a way to do this on OpenEJB standalone server. Thanks guys, -Jonathan -- View this message in context: http://openejb.979440.n4.nabble.com/OpenEJB-xml-and-a-custom-javax-naming-spi-ObjectFactory-tp4655970.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: OpenEJB.xml and a custom javax.naming.spi.ObjectFactory
Hi, did you try using tomcat context.xml? - Romain 2012/7/2 exabrial exabrial+open...@gmail.com Hey guys, One of the features I'm missing from GlassFish is the ability to bind an ObjectFactory into JNDI. We have a few of these written and need to put them into our instance. I'm also hoping to write a brand new one that could be used to create JNDI links (see previous thread in mailing list). Here's a simple example of a custom ObjectFactory: http://grepcode.com/file/repo1.maven.org/maven2/org.glassfish.connectors/connectors-internal-api/3.0/org/glassfish/resources/custom/factory/PrimitivesAndStringFactory.java Is there a way to put an ObjectFactory like that into conf/openejb.xml? I've read all the documentation on Resources and didn't find anything. I found some old mails on the openejb.iusers that say if you're in Tomcat, you can put it into context.xml, but I was curious if there was a way to do this on OpenEJB standalone server. Thanks guys, -Jonathan -- View this message in context: http://openejb.979440.n4.nabble.com/OpenEJB-xml-and-a-custom-javax-naming-spi-ObjectFactory-tp4655970.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: OpenEJB.xml and a custom javax.naming.spi.ObjectFactory
I've done this successfully with context.xml before, however, I was curious if this was available on the standalone OpenEjb 4.0.0 server -- View this message in context: http://openejb.979440.n4.nabble.com/OpenEJB-xml-and-a-custom-javax-naming-spi-ObjectFactory-tp4655970p4655972.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: OpenEJB.xml and a custom javax.naming.spi.ObjectFactory
think not out of the box, currently providing a custom resource will probably be the closer of the need. - Romain 2012/7/2 exabrial exabrial+open...@gmail.com I've done this successfully with context.xml before, however, I was curious if this was available on the standalone OpenEjb 4.0.0 server -- View this message in context: http://openejb.979440.n4.nabble.com/OpenEJB-xml-and-a-custom-javax-naming-spi-ObjectFactory-tp4655970p4655972.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: OpenEJB.xml and a custom javax.naming.spi.ObjectFactory
Ok... that's fine. Would I need to write something like this? http://svn.apache.org/repos/asf/openejb/branches/old-website/src/doc/connector_service.xml (sorry for the XML link, but I can't find that page anywhere else) -- View this message in context: http://openejb.979440.n4.nabble.com/OpenEJB-xml-and-a-custom-javax-naming-spi-ObjectFactory-tp4655970p4655974.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: OpenEJB.xml and a custom javax.naming.spi.ObjectFactory
On Jul 2, 2012, at 2:52 PM, exabrial wrote: Hey guys, One of the features I'm missing from GlassFish is the ability to bind an ObjectFactory into JNDI. We have a few of these written and need to put them into our instance. I'm also hoping to write a brand new one that could be used to create JNDI links (see previous thread in mailing list). Here's a simple example of a custom ObjectFactory: http://grepcode.com/file/repo1.maven.org/maven2/org.glassfish.connectors/connectors-internal-api/3.0/org/glassfish/resources/custom/factory/PrimitivesAndStringFactory.java Do you have an example of how that is configured? I suspect that's not your only ObjectFactory, but note, you can put Primitives and Strings into env-entry elements and get them into JNDI in a standard way. The standard technique also supports java.lang.Class and any Enum type. As Romain notes, there might be something that can be done in the openejb/tomee.xml jar already using Resource to produce things which can then be consumed via @Resource. -David
Re: ServiceProvider Id in openejb.xml
On Nov 10, 2008, at 6:02 PM, ebmm_axis wrote: So,I've been playing around witht his a little bit more, but I still can't get it to work... On the OpenEJB site it states the following: The service-jar.xml should be placed not in the META-INF but somewhere in your package hierarchy (ours is in /org/apache/openejb/service- jar.xml) which allows the services in your service-jar.xml to be referenced by name (such as DefaultStatefulContainer) or more specifically by package and id (such as org.apache.openejb#DefaultStatefulContainer). I have a jar that I have copied to the lib subdirectory with a file called service-jar.xml. I don'tknow if the syntax of the service-jar.xml is right or not, but this is what I've found around the net... ServiceProvider id=myId provider-type=Resource class-name=org.myclass.myclass.TheClassIWantToUse /ServiceProvider In my openejb-jar.xml config file I have the following: Resource id=defaultResource type=TheClassIWantToUse provider=myId /Resource This is really close, you just need to add the package part to the 'provider' attribute. So if you put it at META-INF/com.foo/service- jar.xml, the provider id would be com.foo#myId. That said, there might be a simpler way to do what you want overall. The service-jar.xml stuff is really geared towards plugging in something that needs to be configurable. If you simply want an instance of a specific class injected you can create a property editor for it as described here: http://openejb.apache.org/3.0/custom-injection.html . Let us know if that helps. Also, feel free to go into detail on the kind of thing you're looking to add to the system as we definitely use that feedback to drive features. We've talked about enhancements to the service-jar.xml/openejb.xml functionality as well as specific enhancements for j2ee connector configuration and more. -David
Re: ServiceProvider Id in openejb.xml
So,I've been playing around witht his a little bit more, but I still can't get it to work... On the OpenEJB site it states the following: The service-jar.xml should be placed not in the META-INF but somewhere in your package hierarchy (ours is in /org/apache/openejb/service-jar.xml) which allows the services in your service-jar.xml to be referenced by name (such as DefaultStatefulContainer) or more specifically by package and id (such as org.apache.openejb#DefaultStatefulContainer). I have a jar that I have copied to the lib subdirectory with a file called service-jar.xml. I don'tknow if the syntax of the service-jar.xml is right or not, but this is what I've found around the net... ServiceProvider id=myId provider-type=Resource class-name=org.myclass.myclass.TheClassIWantToUse /ServiceProvider In my openejb-jar.xml config file I have the following: Resource id=defaultResource type=TheClassIWantToUse provider=myId /Resource When I start up the server this is the error I get: org.apache.openejb.OpenEJBException: Failed Configuring Service(id=defaultResource): Cannot find the ServiceProvider id myId in the service-jar.xml at myId. Check that your OpenEJB configuration file is point to the right ServiceProvider id. Anybody know what I'm doing wrong. It's a simple configuratin issue, I know, but I just cannot find the correct syntax and/or placement of the references. Thanx ahead of time. -- View this message in context: http://www.nabble.com/ServiceProvider-Id-in-openejb.xml-tp20429295p20432135.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: Store the encrypted passwords in openejb.xml
Does anyone know how other app servers handle this? -dain On Apr 24, 2008, at 4:37 AM, sujith k wrote: Hi, In my openejb.xml I am storing the user name and password for the database connection in plain text. Is there any way to store the passwords in encrypted format in openejb.xml? The connection details are given bellow. # MySQL example # # This connector will not work until you download the driver at: # http://www.mysql.com/downloads/api-jdbc-stable.html JdbcDrivercom.mysql.jdbc.Driver JdbcUrljdbc:mysql://localhost:3306/test UserNameroot Password root jtamanaged false Thanks in Advance Sujith -- View this message in context: http://www.nabble.com/Store-the-encrypted-passwords-in-openejb.xml-tp16850189p16850189.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Store the encrypted passwords in openejb.xml
Hi, In my openejb.xml I am storing the user name and password for the database connection in plain text. Is there any way to store the passwords in encrypted format in openejb.xml? The connection details are given bellow. # MySQL example # # This connector will not work until you download the driver at: # http://www.mysql.com/downloads/api-jdbc-stable.html JdbcDrivercom.mysql.jdbc.Driver JdbcUrljdbc:mysql://localhost:3306/test UserNameroot Password root jtamanaged false Thanks in Advance Sujith -- View this message in context: http://www.nabble.com/Store-the-encrypted-passwords-in-openejb.xml-tp16850189p16850189.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: Resource elements in openejb.xml quietly remapping to Default JDBC Database?
Happy to help, David ;-) -- Alex On Dec 22, 2007 11:01 PM, David Blevins [EMAIL PROTECTED] wrote: On Dec 22, 2007, at 6:28 PM, David Blevins wrote: So fixed two things. One, I fixed the tomcat servce-jar.xml so the configuration you described above should work. Two, I added warnings on any properties that don't exist -- this should have been there all along and will prevent any future situations where someone is using a configuration flag that is actually doing nothing. FYI, added another nice feature that should have been there, case insensitive property names. So Username, UserName or username is totally fine. -David
Resource elements in openejb.xml quietly remapping to Default JDBC Database?
Hi! Good news. With (lots of) Dain's help, I finally got my example working. We did, however, find what appears to be a bug and a workaround for it. I specify two Resource mappings in my openejb.xml file, which look like this: Resource id=myDataSource type=DataSource JdbcDriver com.mysql.jdbc.Driver JdbcUrl jdbc:mysql://localhost/corm UserName root Password n00p455wyrd JtaManaged true /Resource Resource id=myNonJtaDataSource type=DataSource JdbcDrive com.mysql.jdbc.Driver JdbcUrl jdbc:mysql://localhost/corm UserName root Password n00p455wyrd JtaManaged false /Resource Then, in my persistence.xml file I reference these mappings, like so: jta-data-sourcejava:openejb/Resource/myDataSource/jta-data-source non-jta-data-sourcejava:openejb/Resource/myNonJtaDataSource/non-jta-data-source Now, this all looks normal thus far, but when I boot Tomcat, my openejb logs tell me the following: ... 2007-12-22 18:37:20,636 - INFO - Configuring Service(id=myDataSource, type=Resource, provider-id=Default JDBC Database) 2007-12-22 18:37:20,638 - INFO - Configuring Service(id=myNonJtaDataSource, type=Resource, provider-id=Default JDBC Database) ... This seems to indicate that the two resources are getting automatically pointed at the Default JDBC Database. On further inspection, it turns out that the Default JDBC Database and Default Unmanaged JDBC Database is listed as a Connector elements. Dain's writing more information about this in another thread on the dev list. I think that if the resources are going to get pointed elsewhere, that should be obvious, or loudly noted somewhere. I ended up filtering down the logs with apple's log viewer to find that reassignment. Never would have found it otherwise. So, I switched the Default JDBC Database Connector to a Resource and changed its internals to point at MySQL instead of HSQLDB: Resource id=Default JDBC Database JdbcDriver com.mysql.jdbc.Driver JdbcUrl jdbc:mysql://localhost/corm UserName root Password n00p455wyrd JtaManaged true /Resource And, for consistency, the unmanaged version: Resource id=Default Unmanaged JDBC Database JdbcDriver com.mysql.jdbc.Driver JdbcUrl jdbc:mysql://localhost/corm UserName root Password n00p455wyrd JtaManaged false /Resource Finally, I switch the persistence.xml to read: jta-data-sourcejava:openejb/Resource/Default JDBC Database/jta-data-source non-jta-data-sourcejava:openejb/Resource/Default Unmanaged JDBC Database/non-jta-data-source And now, the app is pointing at the MySQL DataSource correctly. Thanks, guys! -- Alexander R. Saint Croix