Re: MySQL resource in Tomee 1.5.2
Just read your blog - you can ignore my previous post here. But my problem remains. Does the file naming convention has something to do with it? Does the file has to be named openejb.xml or resource.xml ??? -- View this message in context: http://openejb.979440.n4.nabble.com/MySQL-resource-in-Tomee-1-5-2-tp4665872p4665994.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: MySQL resource in Tomee 1.5.2
I tried that - I still get the error. I noticed one line in the Tomee startup logs INFO: Configuring Service(id=Default JDBC Database, type=Resource, provider-id=Default JDBC Database) -- does this mean, it is loading the default Database?? -- View this message in context: http://openejb.979440.n4.nabble.com/MySQL-resource-in-Tomee-1-5-2-tp4665872p4665992.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: MySQL resource in Tomee 1.5.2
I believe this is the same bug reported in https://issues.apache.org/jira/browse/TOMEE-924 I will try in 1.6.0 snapshot and check. -- View this message in context: http://openejb.979440.n4.nabble.com/MySQL-resource-in-Tomee-1-5-2-tp4665872p4666006.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: MySQL resource in Tomee 1.5.2
So if I understand you correctly the resource id should be same as the war name Are you suggesting this ? Resource id=quot;jdbc/lt;lt;bWAR-NAME* type=javax.sql.DataSource JdbcDriver com.mysql.jdbc.Driver JdbcUrl jdbc:mysql://localhost:3306/localdb MaxActive 100 MaxIdle 30 MaxWait 1 /Resource Could you please elaborate it a bit? I am new to this , and it is really not working if I put the resource xml in the WEB-INF folder -- View this message in context: http://openejb.979440.n4.nabble.com/MySQL-resource-in-Tomee-1-5-2-tp4665872p4665980.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: MySQL resource in Tomee 1.5.2
if you war is called foo.war and your resource id is bar the jndi name was openejb:Resource/foo/bar IIRC Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau 2013/11/5 asif.tmcp asif.t...@gmail.com: So if I understand you correctly the resource id should be same as the war name Are you suggesting this ? Resource id=quot;jdbc/lt;lt;bWAR-NAME* type=javax.sql.DataSource JdbcDriver com.mysql.jdbc.Driver JdbcUrl jdbc:mysql://localhost:3306/localdb MaxActive 100 MaxIdle 30 MaxWait 1 /Resource Could you please elaborate it a bit? I am new to this , and it is really not working if I put the resource xml in the WEB-INF folder -- View this message in context: http://openejb.979440.n4.nabble.com/MySQL-resource-in-Tomee-1-5-2-tp4665872p4665980.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: MySQL resource in Tomee 1.5.2
Just so that I am understanding this correctly, would it be possible for you to provide a resources.xml sample, the web.xml snippet and a small code for datasource from initialcontext lookup - ?? Mine are here :- Resources.xml ( in WEB-INF folder of deployed war) Resource id=jdbc/localDB type=javax.sql.DataSource JdbcDriver com.mysql.jdbc.Driver JdbcUrl jdbc:mysql://localhost:3306/localdatabase MaxActive 100 MaxIdle 30 MaxWait 1 UserName username Password password /Resource web.xml ( in WEB-INF folder of deployed war) resource-ref descriptionMySQL Connection/description res-ref-namejdbc/locallDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Code to lookup and use datasource InitialContext ic = new InitialContext(); Context envCtx = (Context) ic.lookup(java:comp/env); DataSource ds = (DataSource)envCtx.lookup(jdbc/localDB); -- View this message in context: http://openejb.979440.n4.nabble.com/MySQL-resource-in-Tomee-1-5-2-tp4665872p4665892.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: MySQL resource in Tomee 1.5.2
Hi Romain, If I understand you correctly, you are saying that id and resource name do not match Here :- Resource id=quot;lt;bjdbc/localDB* type=javax.sql.DataSource JdbcDriver com.mysql.jdbc.Driver JdbcUrl jdbc:mysql://localhost:3306/localdb MaxActive 100 MaxIdle 30 MaxWait 1 and resource-ref descriptionMySQL Connection/description res-ref-name*jdbc/localDB*/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref isn't resourcename = jdbc/localDB same as id=jdbc/localDB What exactly is the prefix that you are mentioning to be added in resources.xml? -- View this message in context: http://openejb.979440.n4.nabble.com/MySQL-resource-in-Tomee-1-5-2-tp4665872p4665891.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: MySQL resource in Tomee 1.5.2
Hi It was the app id (war name by default). In all cases it is written in the logs when the resource is created Le 3 nov. 2013 13:04, asif.tmcp asif.t...@gmail.com a écrit : Hi Romain, If I understand you correctly, you are saying that id and resource name do not match Here :- Resource id=quot;lt;bjdbc/localDB* type=javax.sql.DataSource JdbcDriver com.mysql.jdbc.Driver JdbcUrl jdbc:mysql://localhost:3306/localdb MaxActive 100 MaxIdle 30 MaxWait 1 and resource-ref descriptionMySQL Connection/description res-ref-name*jdbc/localDB*/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref isn't resourcename = jdbc/localDB same as id=jdbc/localDB What exactly is the prefix that you are mentioning to be added in resources.xml? -- View this message in context: http://openejb.979440.n4.nabble.com/MySQL-resource-in-Tomee-1-5-2-tp4665872p4665891.html Sent from the OpenEJB User mailing list archive at Nabble.com.
MySQL resource in Tomee 1.5.2
I am putting resources.xml in the WEB-INF Folder, with a resource configuration. Resource id=jdbc/localDB type=javax.sql.DataSource JdbcDriver com.mysql.jdbc.Driver JdbcUrl jdbc:mysql://localhost:3306/localdb MaxActive 100 MaxIdle 30 MaxWait 1 UserName username Password password /Resource Unfortunately, tomee single mindedly tries to load the hsqldb and then report a vague issue java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: USERS at org.hsqldb.jdbc.Util.sqlException(Unknown Source) at org.hsqldb.jdbc.Util.sqlException(Unknown Source) If I put the resource in the tomee.xml in conf folder Sometimes it works. Environment: Windows 7 ; Eclipse : Tomee 1.5.2 Tested as a war on tomee 1.5.2 - the error still exists. A similar problem is reported here http://openejb.979440.n4.nabble.com/Unable-to-configure-MYSQL-resource-in-tomee-xml-td4659538i20.html and here https://issues.apache.org/jira/browse/TOMEE-924 - any ideas? Resolutions? Thanks and Regards. -- View this message in context: http://openejb.979440.n4.nabble.com/MySQL-resource-in-Tomee-1-5-2-tp4665872.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: MySQL resource in Tomee 1.5.2
Hi The error is linked to the binding of the resource: either an injection or a datasource name in persistence.xml Le 2 nov. 2013 08:50, asif.tmcp asif.t...@gmail.com a écrit : I am putting resources.xml in the WEB-INF Folder, with a resource configuration. Resource id=jdbc/localDB type=javax.sql.DataSource JdbcDriver com.mysql.jdbc.Driver JdbcUrl jdbc:mysql://localhost:3306/localdb MaxActive 100 MaxIdle 30 MaxWait 1 UserName username Password password /Resource Unfortunately, tomee single mindedly tries to load the hsqldb and then report a vague issue java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: USERS at org.hsqldb.jdbc.Util.sqlException(Unknown Source) at org.hsqldb.jdbc.Util.sqlException(Unknown Source) If I put the resource in the tomee.xml in conf folder Sometimes it works. Environment: Windows 7 ; Eclipse : Tomee 1.5.2 Tested as a war on tomee 1.5.2 - the error still exists. A similar problem is reported here http://openejb.979440.n4.nabble.com/Unable-to-configure-MYSQL-resource-in-tomee-xml-td4659538i20.html and here https://issues.apache.org/jira/browse/TOMEE-924 - any ideas? Resolutions? Thanks and Regards. -- View this message in context: http://openejb.979440.n4.nabble.com/MySQL-resource-in-Tomee-1-5-2-tp4665872.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: MySQL resource in Tomee 1.5.2
Hi Romain, Thanks for taking a look. But I am Not sure what you meant .. could you please elaborate. I have the resource configuration in tomee.xml and the following in web.xml. resource-ref descriptionMySQL Connection/description res-ref-namejdbc/localDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref In the code , I try to access it with InitialContext ic = new InitialContext(); DataSource ds = (DataSource)envCtx.lookup(jdbc/SentinelDB); If I put the resources in tomee.xml , it works fine. However, if I put it in resources.xml in the WEB-INF folder for the app, then I get the error. -- View this message in context: http://openejb.979440.n4.nabble.com/MySQL-resource-in-Tomee-1-5-2-tp4665872p4665878.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: MySQL resource in Tomee 1.5.2
Sorry the code got messed up. The java code is as follows:- InitialContext ic = new InitialContext(); Context envCtx = (Context) ic.lookup(java:comp/env); DataSource ds = (DataSource)envCtx.lookup(jdbc/SentinelDB); -- View this message in context: http://openejb.979440.n4.nabble.com/MySQL-resource-in-Tomee-1-5-2-tp4665872p4665879.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: MySQL resource in Tomee 1.5.2
Do you have logs saying a resource is adjusted? Le 2 nov. 2013 17:16, asif.tmcp asif.t...@gmail.com a écrit : Sorry the code got messed up. The java code is as follows:- InitialContext ic = new InitialContext(); Context envCtx = (Context) ic.lookup(java:comp/env); DataSource ds = (DataSource)envCtx.lookup(jdbc/SentinelDB); -- View this message in context: http://openejb.979440.n4.nabble.com/MySQL-resource-in-Tomee-1-5-2-tp4665872p4665879.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: MySQL resource in Tomee 1.5.2
Nope, it just mentions creating a default database, although resources.xml exists:- Nov 02, 2013 3:27:08 PM org.apache.tomee.catalina.TomEEClassLoaderEnricher validateJarFile WARNING: jar 'D:\dev_wksd\eclipse-wksd\devel\Sentinel\war\WEB-INF\lib\hibernate-jpa-2.0-api-1.0.1.Final.jar' contains offending class: javax.persistence.Entity. It will be ignored. Nov 02, 2013 3:27:08 PM org.apache.tomee.catalina.TomEEClassLoaderEnricher validateJarFile WARNING: jar 'D:\dev_wksd\eclipse-wksd\devel\Sentinel\war\WEB-INF\lib\persistence-api-1.0.jar' contains offending class: javax.persistence.Entity. It will be ignored. Nov 02, 2013 3:27:09 PM org.apache.openejb.config.ConfigurationFactory configureApplication INFO: Configuring enterprise application: D:\dev_wksd\eclipse-wksd\devel\Sentinel\war Nov 02, 2013 3:27:09 PM org.apache.openejb.config.ConfigurationFactory configureService INFO: Configuring Service(id=Default JDBC Database, type=Resource, provider-id=Default JDBC Database) Nov 02, 2013 3:27:09 PM org.apache.openejb.config.AutoConfig logAutoCreateResource INFO: Auto-creating a Resource with id 'Default JDBC Database' of type 'javax.sql.DataSource for 'Sentinel'. Nov 02, 2013 3:27:09 PM org.apache.openejb.assembler.classic.Assembler createRecipe INFO: Creating Resource(id=Default JDBC Database) Nov 02, 2013 3:27:09 PM org.apache.openejb.config.AppInfoBuilder build INFO: Enterprise application D:\dev_wksd\eclipse-wksd\devel\Sentinel\war loaded. Nov 02, 2013 3:27:09 PM org.apache.openejb.assembler.classic.Assembler createApplication INFO: Assembling app: D:\dev_wksd\eclipse-wksd\devel\Sentinel\war Nov 02, 2013 3:27:09 PM org.apache.openejb.cdi.CdiBuilder initSingleton INFO: Existing thread singleton service in SystemInstance(): org.apache.openejb.cdi.ThreadSingletonServiceImpl@42e3f9e3 Nov 02, 2013 3:27:09 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication INFO: OpenWebBeans Container is starting... Nov 02, 2013 3:27:09 PM org.apache.webbeans.plugins.PluginLoader startUp INFO: Adding OpenWebBeansPlugin : [CdiPlugin] Nov 02, 2013 3:27:09 PM org.apache.webbeans.plugins.PluginLoader startUp INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin] Nov 02, 2013 3:27:09 PM org.apache.openejb.cdi.BeansDeployer validateInjectionPoints INFO: All injection points are validated successfully. Nov 02, 2013 3:27:09 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication INFO: OpenWebBeans Container has started, it took 3 ms. Nov 02, 2013 3:27:09 PM org.apache.openejb.assembler.classic.Assembler createApplication INFO: Deployed Application(path=D:\dev_wksd\eclipse-wksd\devel\Sentinel\war) Nov 02, 2013 3:27:10 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Shiro environment Nov 02, 2013 3:27:10 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory D:\dev_wksd\eclipse-wksd\devel\server\apache-tomee-plus-1.5.2\webapps\docs Nov 02, 2013 3:27:10 PM org.apache.tomee.catalina.TomcatWebAppBuilder init -- View this message in context: http://openejb.979440.n4.nabble.com/MySQL-resource-in-Tomee-1-5-2-tp4665872p4665882.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: MySQL resource in Tomee 1.5.2
Cause id and resource name are different Le 2 nov. 2013 20:34, asif.tmcp asif.t...@gmail.com a écrit : Nope, it just mentions creating a default database, although resources.xml exists:- Nov 02, 2013 3:27:08 PM org.apache.tomee.catalina.TomEEClassLoaderEnricher validateJarFile WARNING: jar 'D:\dev_wksd\eclipse-wksd\devel\Sentinel\war\WEB-INF\lib\hibernate-jpa-2.0-api-1.0.1.Final.jar' contains offending class: javax.persistence.Entity. It will be ignored. Nov 02, 2013 3:27:08 PM org.apache.tomee.catalina.TomEEClassLoaderEnricher validateJarFile WARNING: jar 'D:\dev_wksd\eclipse-wksd\devel\Sentinel\war\WEB-INF\lib\persistence-api-1.0.jar' contains offending class: javax.persistence.Entity. It will be ignored. Nov 02, 2013 3:27:09 PM org.apache.openejb.config.ConfigurationFactory configureApplication INFO: Configuring enterprise application: D:\dev_wksd\eclipse-wksd\devel\Sentinel\war Nov 02, 2013 3:27:09 PM org.apache.openejb.config.ConfigurationFactory configureService INFO: Configuring Service(id=Default JDBC Database, type=Resource, provider-id=Default JDBC Database) Nov 02, 2013 3:27:09 PM org.apache.openejb.config.AutoConfig logAutoCreateResource INFO: Auto-creating a Resource with id 'Default JDBC Database' of type 'javax.sql.DataSource for 'Sentinel'. Nov 02, 2013 3:27:09 PM org.apache.openejb.assembler.classic.Assembler createRecipe INFO: Creating Resource(id=Default JDBC Database) Nov 02, 2013 3:27:09 PM org.apache.openejb.config.AppInfoBuilder build INFO: Enterprise application D:\dev_wksd\eclipse-wksd\devel\Sentinel\war loaded. Nov 02, 2013 3:27:09 PM org.apache.openejb.assembler.classic.Assembler createApplication INFO: Assembling app: D:\dev_wksd\eclipse-wksd\devel\Sentinel\war Nov 02, 2013 3:27:09 PM org.apache.openejb.cdi.CdiBuilder initSingleton INFO: Existing thread singleton service in SystemInstance(): org.apache.openejb.cdi.ThreadSingletonServiceImpl@42e3f9e3 Nov 02, 2013 3:27:09 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication INFO: OpenWebBeans Container is starting... Nov 02, 2013 3:27:09 PM org.apache.webbeans.plugins.PluginLoader startUp INFO: Adding OpenWebBeansPlugin : [CdiPlugin] Nov 02, 2013 3:27:09 PM org.apache.webbeans.plugins.PluginLoader startUp INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin] Nov 02, 2013 3:27:09 PM org.apache.openejb.cdi.BeansDeployer validateInjectionPoints INFO: All injection points are validated successfully. Nov 02, 2013 3:27:09 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication INFO: OpenWebBeans Container has started, it took 3 ms. Nov 02, 2013 3:27:09 PM org.apache.openejb.assembler.classic.Assembler createApplication INFO: Deployed Application(path=D:\dev_wksd\eclipse-wksd\devel\Sentinel\war) Nov 02, 2013 3:27:10 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Shiro environment Nov 02, 2013 3:27:10 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory D:\dev_wksd\eclipse-wksd\devel\server\apache-tomee-plus-1.5.2\webapps\docs Nov 02, 2013 3:27:10 PM org.apache.tomee.catalina.TomcatWebAppBuilder init -- View this message in context: http://openejb.979440.n4.nabble.com/MySQL-resource-in-Tomee-1-5-2-tp4665872p4665882.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: MySQL resource in Tomee 1.5.2
Ps: in 1.5.2 lookup of resource in resources.xml needed to add a prefix. Thats ok on trunk Le 2 nov. 2013 20:40, Romain Manni-Bucau rmannibu...@gmail.com a écrit : Cause id and resource name are different Le 2 nov. 2013 20:34, asif.tmcp asif.t...@gmail.com a écrit : Nope, it just mentions creating a default database, although resources.xml exists:- Nov 02, 2013 3:27:08 PM org.apache.tomee.catalina.TomEEClassLoaderEnricher validateJarFile WARNING: jar 'D:\dev_wksd\eclipse-wksd\devel\Sentinel\war\WEB-INF\lib\hibernate-jpa-2.0-api-1.0.1.Final.jar' contains offending class: javax.persistence.Entity. It will be ignored. Nov 02, 2013 3:27:08 PM org.apache.tomee.catalina.TomEEClassLoaderEnricher validateJarFile WARNING: jar 'D:\dev_wksd\eclipse-wksd\devel\Sentinel\war\WEB-INF\lib\persistence-api-1.0.jar' contains offending class: javax.persistence.Entity. It will be ignored. Nov 02, 2013 3:27:09 PM org.apache.openejb.config.ConfigurationFactory configureApplication INFO: Configuring enterprise application: D:\dev_wksd\eclipse-wksd\devel\Sentinel\war Nov 02, 2013 3:27:09 PM org.apache.openejb.config.ConfigurationFactory configureService INFO: Configuring Service(id=Default JDBC Database, type=Resource, provider-id=Default JDBC Database) Nov 02, 2013 3:27:09 PM org.apache.openejb.config.AutoConfig logAutoCreateResource INFO: Auto-creating a Resource with id 'Default JDBC Database' of type 'javax.sql.DataSource for 'Sentinel'. Nov 02, 2013 3:27:09 PM org.apache.openejb.assembler.classic.Assembler createRecipe INFO: Creating Resource(id=Default JDBC Database) Nov 02, 2013 3:27:09 PM org.apache.openejb.config.AppInfoBuilder build INFO: Enterprise application D:\dev_wksd\eclipse-wksd\devel\Sentinel\war loaded. Nov 02, 2013 3:27:09 PM org.apache.openejb.assembler.classic.Assembler createApplication INFO: Assembling app: D:\dev_wksd\eclipse-wksd\devel\Sentinel\war Nov 02, 2013 3:27:09 PM org.apache.openejb.cdi.CdiBuilder initSingleton INFO: Existing thread singleton service in SystemInstance(): org.apache.openejb.cdi.ThreadSingletonServiceImpl@42e3f9e3 Nov 02, 2013 3:27:09 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication INFO: OpenWebBeans Container is starting... Nov 02, 2013 3:27:09 PM org.apache.webbeans.plugins.PluginLoader startUp INFO: Adding OpenWebBeansPlugin : [CdiPlugin] Nov 02, 2013 3:27:09 PM org.apache.webbeans.plugins.PluginLoader startUp INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin] Nov 02, 2013 3:27:09 PM org.apache.openejb.cdi.BeansDeployer validateInjectionPoints INFO: All injection points are validated successfully. Nov 02, 2013 3:27:09 PM org.apache.openejb.cdi.OpenEJBLifecycle startApplication INFO: OpenWebBeans Container has started, it took 3 ms. Nov 02, 2013 3:27:09 PM org.apache.openejb.assembler.classic.Assembler createApplication INFO: Deployed Application(path=D:\dev_wksd\eclipse-wksd\devel\Sentinel\war) Nov 02, 2013 3:27:10 PM org.apache.catalina.core.ApplicationContext log INFO: Initializing Shiro environment Nov 02, 2013 3:27:10 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory D:\dev_wksd\eclipse-wksd\devel\server\apache-tomee-plus-1.5.2\webapps\docs Nov 02, 2013 3:27:10 PM org.apache.tomee.catalina.TomcatWebAppBuilder init -- View this message in context: http://openejb.979440.n4.nabble.com/MySQL-resource-in-Tomee-1-5-2-tp4665872p4665882.html Sent from the OpenEJB User mailing list archive at Nabble.com.