You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by "KARR, DAVID" <dk...@att.com> on 2016/08/02 20:52:20 UTC

Define datasource, reference JDBC driver, and see init in console

(I posted this first to tomcat-user, but I realized technically it should go to tomee-user.  I apologize if this is a duplicate for you. In any case, this note has a little more info than the first note.)

I'm attempting to use Tomcat(tomee) to run a REST service that will return some data from some SQL queries (Oracle).  I've installed Tomee 7.0.1, which uses Tomcat 8.5.3.

The JDBC driver is available from a private enterprise maven repo.  I'd prefer to get it from there, as opposed to storing it locally.  I noticed at http://tomee.apache.org/configuring-datasources.html , there is the possible notation of "mvn:g:a:v" for the "classpath" attribute.  However, I don't see any way to configure the Maven repositories this will reference.  How do I tell it to look in a particular repo for this?  Would it just implicitly use my $HOME/.m2/settings.xml file?

My Resource definition in "conf/tomee.xml" looks something like this:
-----------------------
  <Resource id="jdbc/sus2" type="DataSource"
	    maxActive="5" maxIdle="2" maxWait="10000"
	    driverClassName="oracle.jdbc.driver.OracleDriver"
	    url="jdbc:oracle:thin:@<host>:1521:<sid>"
	    username="<user>" password="<password>"/>
----------------

Does this look correct?  I find the Tomcat docs confusing, with respect to the required syntax for this.  It's not clear whether a pure XML syntax is required, or a mixed XML/property syntax.

If I start the instance, should I see any default output that will show Tomcat connecting to this datasource?  If it doesn't show this by default, is there a way to turn this on?

I tried writing the code to obtain the JNDI resource (Spring context references), but it just says it can't find it (fails at "jdbc"), so perhaps my Resource definition was ignored, or my JNDI path is wrong.

Re: Define datasource, reference JDBC driver, and see init in console

Posted by Romain Manni-Bucau <rm...@gmail.com>.
best would be for you to share a sample with this issue on github.
Basically we have ATM one working sample on github vs one mail thread with
errors so hard to help being accurate :s.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-08-03 19:59 GMT+02:00 KARR, DAVID <dk...@att.com>:

> > -----Original Message-----
> > From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> > Sent: Wednesday, August 03, 2016 10:25 AM
> > To: users@tomee.apache.org
> > Subject: Re: Define datasource, reference JDBC driver, and see init in
> > console
> >
> > 2016-08-03 18:41 GMT+02:00 KARR, DAVID <dk...@att.com>:
> >
> > > > -----Original Message-----
> > > > From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> > > > Sent: Tuesday, August 02, 2016 11:53 PM
> > > > To: users@tomee.apache.org
> > > > Subject: Re: Define datasource, reference JDBC driver, and see init
> > > > in console
> > > >
> >
> > > > - using jdbc/sus2 you can use @Resource(name = "jdbc/sus2")
> > > > DataSource ds; or do a lookup on openejb:Resource/jdbc/sus2 or
> > > > java:openejb/Resource/
> > > > jdbc/sus2
> > >
> > > This is my core problem, which I have to solve.  This is a VFAQ about
> > > JNDI, in my view.  It's easy to define a name for something, but all
> > > JNDI systems put "magic prefixes" on all the entities that go into the
> > > JNDI registry, that make it difficult for users to figure out what the
> > > actual names are.
> > >
> > >
> > you can use id="global/foo/bar" to get java:global/foo/bar jndi name if
> > it helps.
>
> Just for kicks, I just tried using exactly that name, and I changed my
> resource definition to more closely match what you described earlier.  It's
> still failing to find the datasource, but I'm now getting different errors.
>
> Here's my Resource:
> --------------
>   <Resource id="global/foo/bar" type="DataSource"
> classpath="mvn:oracle:ojdbc6:11.2.0.3">
>             JdbcDriver = oracle.jdbc.driver.OracleDriver
>             MaxActive = 5
>             MinIdle = 2
>             MaxIdle = 2
>             MaxWait = 10000
>             JdbcUrl = jdbc:oracle:thin:@b2csusdblh1.bodc.att.com:1521:sus2
>             UserName = dk068x
>             Password = Futility00
>   </Resource>
> ---------------
>
> My Spring context excerpt:
> ----------------
>         <jee:jndi-lookup jndi-name="java:global/foo/bar" id="sus2ds"/>
> ----------------
>
> My (truncated) Tomcat console output:
> ----------------
> INFO: Configuring Service(id=global/foo/bar, type=Resource,
> provider-id=Default JDBC Database)
> ...
> INFO: Creating Resource(id=global/foo/bar)
> Aug 03, 2016 10:49:41 AM org.apache.tomcat.jdbc.pool.ConnectionPool
> checkPoolConfiguration
> WARNING: initialSize is larger than maxActive, setting initialSize to: 5
> Aug 03, 2016 10:49:42 AM org.apache.tomcat.jdbc.pool.ConnectionPool init
> SEVERE: Unable to create initial connections of pool.
> org.apache.tomcat.jdbc.pool.PoolExhaustedException: [main] NoWait: Pool
> empty. Unable to fetch a connection, none available[5 in use].
>         at
> org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:679)
>         at
> org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:468)
>         at
> org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:143)
>         at
> org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEConnectionPool.<init>(TomEEDataSourceCreator.java:221)
> ...
>
> Aug 03, 2016 10:49:42 AM
> org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEDataSource <init>
> SEVERE: Can't create DataSource
> org.apache.tomcat.jdbc.pool.PoolExhaustedException: [main] NoWait: Pool
> empty. Unable to fetch a connection, none available[5 in use].
>         at
> org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:679)
>         at
> org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:468)
>         at
> org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:143)
>         at
> org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEConnectionPool.<init>(TomEEDataSourceCreator.java:221)
>         at
> org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEDataSource.createPool(TomEEDataSourceCreator.java:154)
> ...
>
> ...
> 2016-08-03 10:49:44,918 WARN  [localhost-startStop-1]
> support.AbstractApplicationContext (AbstractApplicationContext.java:549) -
> Exception encountered during context initialization - cancelling refresh
> attempt: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'sus2ds': Invocation of init method failed; nested
> exception is javax.naming.NameNotFoundException: Name "foo/bar" not found.
> 2016-08-03 10:49:44,922 ERROR [localhost-startStop-1]
> context.ContextLoader (ContextLoader.java:351) - Context initialization
> failed
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'sus2ds': Invocation of init method failed; nested exception
> is javax.naming.NameNotFoundException: Name "foo/bar" not found.
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
> ...
> Caused by: javax.naming.NameNotFoundException: Name "foo/bar" not found.
>         at
> org.apache.openejb.core.ivm.naming.IvmContext.federate(IvmContext.java:199)
>         at
> org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:151)
>         at
> org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:291)
>         at org.apache.naming.NamingContext.lookup(NamingContext.java:828)
>         at org.apache.naming.NamingContext.lookup(NamingContext.java:174)
>         at
> org.apache.naming.SelectorContext.lookup(SelectorContext.java:163)
>         at javax.naming.InitialContext.lookup(Unknown Source)
>         at
> org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:155)
> ...
> Aug 03, 2016 10:49:44 AM org.apache.catalina.core.StandardContext
> listenerStart
> SEVERE: Exception sending context initialized event to listener instance
> of class org.springframework.web.context.ContextLoaderListener
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'sus2ds': Invocation of init method failed; nested exception
> is javax.naming.NameNotFoundException: Name "foo/bar" not found.
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
> ...
> Caused by: javax.naming.NameNotFoundException: Name "foo/bar" not found.
>         at
> org.apache.openejb.core.ivm.naming.IvmContext.federate(IvmContext.java:199)
>         at
> org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:151)
>         at
> org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:291)
>         at org.apache.naming.NamingContext.lookup(NamingContext.java:828)
>         at org.apache.naming.NamingContext.lookup(NamingContext.java:174)
>         at
> org.apache.naming.SelectorContext.lookup(SelectorContext.java:163)
>         at javax.naming.InitialContext.lookup(Unknown Source)
> ...
> ----------------
>
> I don't know why I'm now seeing the pool errors when I didn't before.  I
> suppose the change to the Resource definition did that.
>
> >
> >
> > > I originally tried "jdbc/sus2".  That failed to find "jdbc".  I tried
> > > changing the resource name to just "sus2" and tried looking up
> > > "java:comp/env/sus2".  That says it failed to find "sus2".
> > >
> > >
> > context.xml resources are bound to comp/env tree (by webapp), tomee.xml
> > ones are bound to openejb:Resource tree (global).
> >
> >
> > > I'm including here an excerpt of the console output, which shows the
> > > "sus2" resource being defined, and the later looking for
> > > "java:comp/env/sus2", saying that "sus2" is not found.
> > > --------------------------
> > > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > > WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context}
> > > Setting property 'source' to 'org.eclipse.jst.jee.server:webproj' did
> > > not find a matching property.
> > > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > > WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context}
> > > Setting property 'source' to 'org.eclipse.jst.jee.server:dumpjndi' did
> > > not find a matching property.
> > > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > > INFO: Server version:        Apache Tomcat (TomEE)/8.0.8.5.3 (7.0.1)
> > > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > > INFO: Server built:          Jun 9 2016 11:16:29 UTC
> > > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > > INFO: Server number:         8.5.3.0
> > > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > > INFO: OS Name:               Windows 7
> > > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > > INFO: OS Version:            6.1
> > > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > > INFO: Architecture:          amd64
> > > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > > INFO: Java Home:             C:\Program Files\Java\jre1.8.0_102
> > > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > > INFO: JVM Version:           1.8.0_102-b14
> > > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > > INFO: JVM Vendor:            Oracle Corporation
> > > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > > INFO: CATALINA_BASE:
> > >
> > > <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tm
> > > p0 Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > > INFO: CATALINA_HOME:
> > >
> > > <homepath>\frameworks\apache-tomee-7.0.1-webprofile\apache-tomee-webpr
> > > ofile-7.0.1 Aug 03, 2016 9:29:40 AM
> > > sun.reflect.NativeMethodAccessorImpl invoke
> > > INFO: Command line argument:
> > > -Dcatalina.base=<homepath>\workspace\.metadata\.plugins\org.eclipse.ws
> > > t.server.core\tmp0 Aug 03, 2016 9:29:40 AM
> > > sun.reflect.NativeMethodAccessorImpl invoke
> > > INFO: Command line argument:
> > > -Dcatalina.home=<homepath>\frameworks\apache-tomee-7.0.1-webprofile\ap
> > > ache-tomee-webprofile-7.0.1 Aug 03, 2016 9:29:40 AM
> > > sun.reflect.NativeMethodAccessorImpl invoke
> > > INFO: Command line argument:
> > > -Dwtp.deploy=<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.s
> > > erver.core\tmp0\wtpwebapps Aug 03, 2016 9:29:40 AM
> > > sun.reflect.NativeMethodAccessorImpl invoke
> > > INFO: Command line argument:
> > > -Djava.endorsed.dirs=<homepath>\frameworks\apache-tomee-7.0.1-webprofi
> > > le\apache-tomee-webprofile-7.0.1\endorsed
> > > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > > INFO: Command line argument: -Dfile.encoding=Cp1252 Aug 03, 2016
> > > 9:29:40 AM sun.reflect.DelegatingMethodAccessorImpl invoke
> > > INFO: The APR based Apache Tomcat Native library which allows optimal
> > > performance in production environments was not found on the
> > > java.library.path: C:\Program
> > > Files\Java\jre1.8.0_102\bin;C:\Windows\Sun\Java\bin;C:\Windows\system3
> > > 2;C:\Windows;c:/Program
> > > Files/Java/jdk1.8.0_102/bin/../jre/bin/server;c:/Program
> > > Files/Java/jdk1.8.0_102/bin/../jre/bin;c:/Program
> > > Files/Java/jdk1.8.0_102/bin/../jre/lib/amd64;c:\Program
> > > Files\Java\jdk1.8.0_102\bin;C:\Program Files (x86)\RSA SecurID Token
> > > Common;C:\Program Files (x86)\NVIDIA
> > > Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\Sys
> > > tem32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\Syst
> > > em32\WindowsPowerShell\v1.0\;C:\Program
> > > Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;C:\Program Files
> > > (x86)\Intel\OpenCL SDK\3.0\bin\x64;C:\Program
> > > Files\1E\NomadBranch\;C:\Program Files (x86)\Enterprise
> > > Vault\EVClient\;c:\Program Files\Java\jdk1.8.0_102\bin;C:\Program
> > > Files\nodejs\;c:\Users\dk068x\frameworks\gradle-2.14.1-all\gradle-
> > 2.14.1\bin;c:\Users\dk068x\frameworks\apache-groovy-sdk-2.4.7\groovy-
> > 2.4.7\bin;<homepath>\AppData\Roaming\npm;<homepath>\Desktop;;.
> > > Aug 03, 2016 9:29:40 AM sun.reflect.DelegatingMethodAccessorImpl
> > > invoke
> > > INFO: Initializing ProtocolHandler ["http-nio-8080"] Aug 03, 2016
> > > 9:29:41 AM sun.reflect.DelegatingMethodAccessorImpl invoke
> > > INFO: Using a shared selector for servlet write/read Aug 03, 2016
> > > 9:29:41 AM sun.reflect.DelegatingMethodAccessorImpl invoke
> > > INFO: Initializing ProtocolHandler ["ajp-nio-8009"] Aug 03, 2016
> > > 9:29:41 AM sun.reflect.DelegatingMethodAccessorImpl invoke
> > > INFO: Using a shared selector for servlet write/read Aug 03, 2016
> > > 9:29:41 AM org.apache.openejb.util.OptionsLog info
> > > INFO: Using
> > > 'openejb.jdbc.datasource-
> > creator=org.apache.tomee.jdbc.TomEEDataSourceCreator'
> > > Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
> > > INFO:
> > > **********************************************************************
> > > ********** Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance
> > > <init>
> > > INFO: OpenEJB http://tomee.apache.org/ Aug 03, 2016 9:29:41 AM
> > > org.apache.openejb.OpenEJB$Instance <init>
> > > INFO: Startup: Wed Aug 03 09:29:41 PDT 2016 Aug 03, 2016 9:29:41 AM
> > > org.apache.openejb.OpenEJB$Instance <init>
> > > INFO: Copyright 1999-2016 (C) Apache OpenEJB Project, All Rights
> > Reserved.
> > > Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
> > > INFO: Version: 7.0.1
> > > Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
> > > INFO: Build date: 20160623
> > > Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
> > > INFO: Build time: 12:04
> > > Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
> > > INFO:
> > > **********************************************************************
> > > ********** Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance
> > > <init>
> > > INFO: openejb.home =
> > > <homepath>\frameworks\apache-tomee-7.0.1-webprofile\apache-tomee-webpr
> > > ofile-7.0.1 Aug 03, 2016 9:29:41 AM
> > > org.apache.openejb.OpenEJB$Instance <init>
> > > INFO: openejb.base =
> > > <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tm
> > > p0 Aug 03, 2016 9:29:41 AM org.apache.openejb.cdi.CdiBuilder
> > > initializeOWB
> > > INFO: Created new singletonService
> > > org.apache.openejb.cdi.ThreadSingletonServiceImpl@37e547da
> > > Aug 03, 2016 9:29:41 AM org.apache.openejb.cdi.CdiBuilder
> > > initializeOWB
> > > INFO: Succeeded in installing singleton service Aug 03, 2016 9:29:41
> > > AM org.apache.openejb.config.ConfigurationFactory init
> > > INFO: TomEE configuration file is
> > >
> > '<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp
> > 0\conf\tomee.xml'
> > > Aug 03, 2016 9:29:41 AM org.apache.openejb.config.ConfigurationFactory
> > > configureService
> > > INFO: Configuring Service(id=Tomcat Security Service,
> > > type=SecurityService, provider-id=Tomcat Security Service) Aug 03,
> > > 2016 9:29:41 AM org.apache.openejb.config.ConfigurationFactory
> > > configureService
> > > INFO: Configuring Service(id=Default Transaction Manager,
> > > type=TransactionManager, provider-id=Default Transaction Manager) Aug
> > > 03, 2016 9:29:41 AM org.apache.openejb.config.ConfigurationFactory
> > > configureService
> > > INFO: Configuring Service(id=sus2, type=Resource, provider-id=sus2)
> > > Aug 03, 2016 9:29:41 AM org.apache.openejb.util.OptionsLog info
> > > INFO: Using 'openejb.deployments.classpath=false'
> > > Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> > > createRecipe
> > > INFO: Creating TransactionManager(id=Default Transaction Manager) Aug
> > > 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> > > createRecipe
> > > INFO: Creating SecurityService(id=Tomcat Security Service) Aug 03,
> > > 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> > > createRecipe
> > > INFO: Creating Resource(id=sus2)
> > > Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> > > unusedProperty
> > > WARNING: unusedProperty maxActive - sus2 Aug 03, 2016 9:29:41 AM
> > > org.apache.openejb.assembler.classic.Assembler
> > > unusedProperty
> > > WARNING: unusedProperty maxIdle - sus2 Aug 03, 2016 9:29:41 AM
> > > org.apache.openejb.assembler.classic.Assembler
> > > unusedProperty
> > > WARNING: unusedProperty maxWait - sus2 Aug 03, 2016 9:29:41 AM
> > > org.apache.openejb.assembler.classic.Assembler
> > > unusedProperty
> > > WARNING: unusedProperty url - sus2
> > > Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> > > unusedProperty
> > > WARNING: unusedProperty username - sus2 Aug 03, 2016 9:29:41 AM
> > > org.apache.openejb.assembler.classic.Assembler
> > > unusedProperty
> > > WARNING: unusedProperty password - sus2 Aug 03, 2016 9:29:41 AM
> > > org.apache.openejb.server.ServiceManager initServer
> > > INFO: Creating ServerService(id=cxf-rs) Aug 03, 2016 9:29:41 AM
> > > org.apache.openejb.server.SimpleServiceManager
> > > start
> > > INFO:   ** Bound Services **
> > > Aug 03, 2016 9:29:41 AM org.apache.openejb.server.SimpleServiceManager
> > > printRow
> > > INFO:   NAME                 IP              PORT
> > > Aug 03, 2016 9:29:41 AM org.apache.openejb.server.SimpleServiceManager
> > > start
> > > INFO: -------
> > > Aug 03, 2016 9:29:41 AM org.apache.openejb.server.SimpleServiceManager
> > > start
> > > INFO: Ready!
> > > Aug 03, 2016 9:29:41 AM sun.reflect.DelegatingMethodAccessorImpl
> > > invoke
> > > INFO: Initialization processed in 1542 ms Aug 03, 2016 9:29:41 AM
> > > org.apache.tomee.catalina.OpenEJBNamingContextListener bindResource
> > > INFO: Importing a Tomcat Resource with id 'UserDatabase' of type
> > > 'org.apache.catalina.UserDatabase'.
> > > Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> > > createRecipe
> > > INFO: Creating Resource(id=UserDatabase) Aug 03, 2016 9:29:41 AM
> > > sun.reflect.DelegatingMethodAccessorImpl invoke
> > > INFO: Starting service Catalina
> > > Aug 03, 2016 9:29:41 AM sun.reflect.DelegatingMethodAccessorImpl
> > > invoke
> > > INFO: Starting Servlet Engine: Apache Tomcat (TomEE)/8.0.8.5.3 (7.0.1)
> > > Aug 03, 2016 9:29:41 AM org.apache.tomee.catalina.TomcatWebAppBuilder
> > > init
> > > INFO: ------------------------- localhost -> / Aug 03, 2016 9:29:41 AM
> > > org.apache.openejb.config.ConfigurationFactory
> > > configureApplication
> > > INFO: Configuring enterprise application:
> > > <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tm
> > > p0\wtpwebapps\ROOT Aug 03, 2016 9:29:41 AM
> > > org.apache.openejb.config.ConfigurationFactory
> > > configureService
> > > INFO: Configuring Service(id=Default Managed Container,
> > > type=Container, provider-id=Default Managed Container) Aug 03, 2016
> > > 9:29:41 AM org.apache.openejb.config.AutoConfig
> > > createContainer
> > > INFO: Auto-creating a container for bean .Comp483003755:
> > > Container(type=MANAGED, id=Default Managed Container) Aug 03, 2016
> > > 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> > > createRecipe
> > > INFO: Creating Container(id=Default Managed Container) Aug 03, 2016
> > > 9:29:42 AM org.apache.openejb.core.managed.SimplePassivater
> > > init
> > > INFO: Using directory <homepath>\AppData\Local\Temp for stateful
> > > session passivation Aug 03, 2016 9:29:42 AM
> > > org.apache.openejb.config.AppInfoBuilder build
> > > INFO: Enterprise application
> > >
> > "<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp
> > 0\wtpwebapps\ROOT"
> > > loaded.
> > > Aug 03, 2016 9:29:42 AM org.apache.openejb.assembler.classic.Assembler
> > > createApplication
> > > INFO: Assembling app:
> > > <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tm
> > > p0\wtpwebapps\ROOT Aug 03, 2016 9:29:42 AM
> > > org.apache.openejb.assembler.classic.Assembler
> > > createApplication
> > > INFO: Deployed
> > > Application(path=<homepath>\workspace\.metadata\.plugins\org.eclipse.w
> > > st.server.core\tmp0\wtpwebapps\ROOT)
> > > Aug 03, 2016 9:29:42 AM org.apache.tomee.catalina.TomcatWebAppBuilder
> > > init
> > > INFO: ------------------------- localhost -> /dumpjndi Aug 03, 2016
> > > 9:29:42 AM org.apache.openejb.config.ConfigurationFactory
> > > configureApplication
> > > INFO: Configuring enterprise application:
> > > <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tm
> > > p0\wtpwebapps\dumpjndi Aug 03, 2016 9:29:42 AM
> > > org.apache.openejb.config.AppInfoBuilder build
> > > INFO: Enterprise application
> > >
> > "<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp
> > 0\wtpwebapps\dumpjndi"
> > > loaded.
> > > Aug 03, 2016 9:29:42 AM org.apache.openejb.assembler.classic.Assembler
> > > createApplication
> > > INFO: Assembling app:
> > > <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tm
> > > p0\wtpwebapps\dumpjndi Aug 03, 2016 9:29:42 AM
> > > org.apache.openejb.assembler.classic.Assembler
> > > createApplication
> > > INFO: Deployed
> > > Application(path=<homepath>\workspace\.metadata\.plugins\org.eclipse.w
> > > st.server.core\tmp0\wtpwebapps\dumpjndi)
> > > Aug 03, 2016 9:29:42 AM org.apache.tomee.catalina.TomcatWebAppBuilder
> > > init
> > > INFO: ------------------------- localhost -> /webproj Aug 03, 2016
> > > 9:29:42 AM org.apache.openejb.config.ConfigurationFactory
> > > configureApplication
> > > INFO: Configuring enterprise application:
> > > <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tm
> > > p0\wtpwebapps\webproj Aug 03, 2016 9:29:42 AM
> > > org.apache.openejb.config.AppInfoBuilder build
> > > INFO: Enterprise application
> > >
> > "<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp
> > 0\wtpwebapps\webproj"
> > > loaded.
> > > Aug 03, 2016 9:29:42 AM org.apache.openejb.assembler.classic.Assembler
> > > createApplication
> > > INFO: Assembling app:
> > > <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tm
> > > p0\wtpwebapps\webproj Aug 03, 2016 9:29:42 AM
> > > org.apache.openejb.assembler.classic.Assembler
> > > createApplication
> > > INFO: Deployed
> > > Application(path=<homepath>\workspace\.metadata\.plugins\org.eclipse.w
> > > st.server.core\tmp0\wtpwebapps\webproj)
> > > Aug 03, 2016 9:29:42 AM sun.reflect.DelegatingMethodAccessorImpl
> > > invoke
> > > INFO: At least one JAR was scanned for TLDs yet contained no TLDs.
> > > Enable debug logging for this logger for a complete list of JARs that
> > > were scanned but no TLDs were found in them. Skipping unneeded JARs
> > > during scanning can improve startup time and JSP compilation time.
> > > Aug 03, 2016 9:29:42 AM org.apache.catalina.core.ApplicationContext
> > > log
> > > INFO: No Spring WebApplicationInitializer types detected on classpath
> > > Aug 03, 2016 9:29:43 AM org.apache.catalina.core.ApplicationContext
> > > log
> > > INFO: Initializing Spring root WebApplicationContext
> > > 2016-08-03 09:29:43,001 INFO  [localhost-startStop-1]
> > > context.ContextLoader (ContextLoader.java:305) - Root
> > > WebApplicationContext: initialization started
> > > 2016-08-03 09:29:43,180 DEBUG [localhost-startStop-1]
> > > env.MutablePropertySources (MutablePropertySources.java:109) - Adding
> > > [servletConfigInitParams] PropertySource with lowest search precedence
> > > 2016-08-03 09:29:43,181 DEBUG [localhost-startStop-1]
> > > env.MutablePropertySources (MutablePropertySources.java:109) - Adding
> > > [servletContextInitParams] PropertySource with lowest search
> > > precedence
> > > 2016-08-03 09:29:43,189 DEBUG [localhost-startStop-1]
> > > env.MutablePropertySources (MutablePropertySources.java:109) - Adding
> > > [jndiProperties] PropertySource with lowest search precedence
> > > 2016-08-03 09:29:43,190 DEBUG [localhost-startStop-1]
> > > env.MutablePropertySources (MutablePropertySources.java:109) - Adding
> > > [systemProperties] PropertySource with lowest search precedence
> > > 2016-08-03 09:29:43,190 DEBUG [localhost-startStop-1]
> > > env.MutablePropertySources (MutablePropertySources.java:109) - Adding
> > > [systemEnvironment] PropertySource with lowest search precedence
> > > 2016-08-03 09:29:43,190 DEBUG [localhost-startStop-1]
> > > env.AbstractEnvironment (AbstractEnvironment.java:127) - Initialized
> > > StandardServletEnvironment with PropertySources
> > > [servletConfigInitParams,servletContextInitParams,jndiProperties,syste
> > > mProperties,systemEnvironment]
> > > 2016-08-03 09:29:43,204 DEBUG [localhost-startStop-1]
> > > env.MutablePropertySources (MutablePropertySources.java:174) -
> > > Replacing [servletContextInitParams] PropertySource with
> > > [servletContextInitParams]
> > > 2016-08-03 09:29:43,210 INFO  [localhost-startStop-1]
> > > support.AbstractApplicationContext
> > > (AbstractApplicationContext.java:581) - Refreshing Root
> > > WebApplicationContext: startup date [Wed Aug 03 09:29:43 PDT 2016];
> > > root of context hierarchy
> > > 2016-08-03 09:29:43,293 INFO  [localhost-startStop-1]
> > > xml.XmlBeanDefinitionReader (XmlBeanDefinitionReader.java:317) -
> > > Loading XML bean definitions from ServletContext resource
> > > [/WEB-INF/applicationContext.xml]
> > > 2016-08-03 09:29:43,381 INFO  [localhost-startStop-1]
> > > xml.XmlBeanDefinitionReader (XmlBeanDefinitionReader.java:317) -
> > > Loading XML bean definitions from class path resource
> > > [META-INF/cxf/cxf.xml]
> > > 2016-08-03 09:29:43,409 INFO  [localhost-startStop-1]
> > > xml.XmlBeanDefinitionReader (XmlBeanDefinitionReader.java:317) -
> > > Loading XML bean definitions from class path resource
> > > [META-INF/cxf/cxf-servlet.xml]
> > > 2016-08-03 09:29:43,490 INFO  [localhost-startStop-1]
> > > support.DefaultListableBeanFactory
> > > (DefaultListableBeanFactory.java:843) - Overriding bean definition for
> > bean 'webproj' with a different definition:
> > > replacing [Generic bean: class
> > > [org.apache.cxf.jaxrs.spring.JAXRSServerFactoryBeanDefinitionParser$Sp
> > > ringJAXRSServerFactoryBean]; scope=; abstract=false; lazyInit=false;
> > > autowireMode=0; dependencyCheck=0; autowireCandidate=true;
> > > primary=false; factoryBeanName=null; factoryMethodName=null;
> > > initMethodName=create; destroyMethodName=destroy] with [Generic bean:
> > > class [com.att.webproj.services.WebProjController];
> > > scope=; abstract=false; lazyInit=false; autowireMode=0;
> > > dependencyCheck=0; autowireCandidate=true; primary=false;
> > > factoryBeanName=null; factoryMethodName=null; initMethodName=null;
> > > destroyMethodName=null; defined in ServletContext resource
> > > [/WEB-INF/applicationContext.xml]]
> > > 2016-08-03 09:29:43,512 DEBUG [localhost-startStop-1]
> > > support.AbstractApplicationContext
> > > (AbstractApplicationContext.java:615) - Bean factory for Root
> > WebApplicationContext:
> > >
> > org.springframework.beans.factory.support.DefaultListableBeanFactory@693
> > a3417:
> > > defining beans
> > > [cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.a
> > > pache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring
> > > .BusExtensionPostProcessor,webproj,sus2ds,com.att.webproj.dao.OrdersDA
> > > O#0];
> > > root of factory hierarchy
> > > 2016-08-03 09:29:43,633 DEBUG [localhost-startStop-1]
> > > support.AbstractApplicationContext
> > > (AbstractApplicationContext.java:728) - Unable to locate MessageSource
> > > with name 'messageSource': using default
> > > [org.springframework.context.support.DelegatingMessageSource@741ac774]
> > > 2016-08-03 09:29:43,637 DEBUG [localhost-startStop-1]
> > > support.AbstractApplicationContext
> > > (AbstractApplicationContext.java:752) - Unable to locate
> > > ApplicationEventMulticaster with name
> > > 'applicationEventMulticaster': using default
> > > [org.springframework.context.event.SimpleApplicationEventMulticaster@a
> > > 6b8658
> > > ]
> > > 2016-08-03 09:29:43,864 WARN  [localhost-startStop-1]
> > > support.AbstractApplicationContext
> > > (AbstractApplicationContext.java:549) - Exception encountered during
> > > context initialization - cancelling refresh
> > > attempt: org.springframework.beans.factory.BeanCreationException:
> > > Error creating bean with name 'sus2ds': Invocation of init method
> > > failed; nested exception is javax.naming.NameNotFoundException: Name
> > > [sus2] is not bound in this Context. Unable to find [sus2].
> > > 2016-08-03 09:29:43,868 ERROR [localhost-startStop-1]
> > > context.ContextLoader (ContextLoader.java:351) - Context
> > > initialization failed
> > > org.springframework.beans.factory.BeanCreationException: Error
> > > creating bean with name 'sus2ds': Invocation of init method failed;
> > > nested exception is javax.naming.NameNotFoundException: Name [sus2] is
> > > not bound in this Context. Unable to find [sus2].
> > > ---------------
> > >
> > > > - about maven: ${user.home}/.m2/repository is the default base, you
> > > > can override it to openejb.m2.home system property (in
> > > > conf/system.properties for instance). If this folder doesn't exist
> > > > we'll read the default settings.xml to get the localRespository
> > value.
> > >
> > > Ok, so just to be clear, the "mvn:" prefix is only going to search a
> > > local repository.  It's not going to go to MavenCentral or anything
> > like that.
> > > The doc doesn't say anything at all about this.  We need to find a
> > > reasonable way to document this.
> > >
> > >
> > It does a http request if the local lookup fails. Default http base is
> > central if the version is a release and apache snapshot one if the
> > version is a snapshot. This repo url can be customized specifying it in
> > the mvn url
> > (mv:http://company.com/maven2!groupId:artifactId:version)
> >
> >
> > > Please give me more information about everything that happens after
> > > "if this folder doesn't exist".
> > >
> >
> > The very detail can be found
> > in org.apache.openejb.loader.provisining.MavenResolver#quickMvnUrl
> > method.
> >
> >
> > >
> > > > - about your "strange" error: tomee Resource attributes are about
> > > > the resource factory and body of Resource tag is the list of
> > > > properties used to set instance attributes. Tomcat put everything as
> > > > attributes. This is why you got this error.
> > >
> > > Understood.  The notion of "attributes" vs. "properties" is lost on
> > > many people.  I understand that they are different, but it needs to be
> > > clear in the doc and in the messages.
> > >
> > > > - last point: we support some bridge between historical tomee
> > > > definitions and tomcat datasources (to make the migration smooth) so
> > > > you can still use JdbcDriver, UserName, Password, JdbcUrl:
> > > >
> > > > <Resource id="jdbc/sus2" type="DataSource"
> > classpath="mvn:oracle:ojdbc6:
> > > > 11.2.0.3">
> > > >     JdbcDriver = oracle.jdbc.driver.OracleDriver
> > > >     MaxActive = 5
> > > >     MaxIdle = 2
> > > >     MaxWait = 10000
> > > >     JdbcUrl = jdbc:oracle:thin:@<host>:1521:<sid>
> > > >     UserName = <userid>
> > > >     Password = <password>
> > > >   </Resource>
> > > >
> > > > Advantage of keeping these properties is the same definition will
> > > > run with openejb (understand tomee without tomcat and embedded)
> > > > which is a great way to debug a weird case reusing the same data as
> > in tomee.
> > >
> > > And what parts of this are "historical tome definitions" and "tomcat
> > > datasources"?  How would someone know which properties/attributes are
> > > "historical"?  Many people using Tomcat or TomEE for the first time
> > > know nothing about this history.
> > >
> > >
> > The conversion is done there -
> > https://github.com/apache/tomee/blob/master/tomee/tomee-
> > jdbc/src/main/java/org/apache/tomee/jdbc/TomEEDataSourceCreator.java#L87
> > - and as you can see we try to override if missing only making both
> > cases working.
> >
> >
> > > > 2016-08-03 1:21 GMT+02:00 KARR, DAVID <dk...@att.com>:
> > > >
> > > > > I may be making some progress.  Working from
> > > > > http://tomee.apache.org/tomee-and-eclipse.html , it appears that
> > > > > the "tomeee.xml" file that I edited in the Tomee distro is not
> > > > > used in Eclipse.  I used the "Import" feature as described to copy
> > > > > the file
> > > > into
> > > > > the server defined in Eclipse.   At that point, I got an error
> > like
> > > > this:
> > > > > ---------------------
> > > > > org.apache.openejb.OpenEJBException:
> > > > > Unable to read OpenEJB configuration file at
> > > > >
> > > > <workspace>\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf
> > > > \tom
> > > > ee.xml:
> > > > > Unsupported Attribute(s): maxActive, maxIdle, maxWait,
> > > > > driverClassName, url, username, password.
> > > > > Supported Attributes are: type, jar, provider, id, class-name,
> > > > > constructor, factory-name, classpath, jndi, aliases,
> > > > > properties-provider, property-provider, depends-on.  If the
> > > > > setting is a configuration property it must be placed inside the
> > element body.
> > > > > ---------------------
> > > > >
> > > > > Really strange.
> > > > >
> > > > > I then modified the imported "tomee.xml" file, resulting in the
> > > > > following approximate Resource definition:
> > > > > --------------------
> > > > > <Resource id="jdbc/sus2" type="DataSource"
> > > > > classpath="mvn:oracle:ojdbc6:11.2.0.3"
> > > > >             class-name="oracle.jdbc.driver.OracleDriver">
> > > > >             maxActive = 5
> > > > >             maxIdle = 2
> > > > >             maxWait = 10000
> > > > >             url = jdbc:oracle:thin:@<host>:1521:<sid>
> > > > >             username = <userid>
> > > > >             password = <password>
> > > > >   </Resource>
> > > > > --------------
> > > > >
> > > > > When I start up the server, I see the following in the console:
> > > > > ------------------
> > > > > Aug 02, 2016 4:13:03 PM
> > > > > org.apache.openejb.config.ConfigurationFactory
> > > > > configureService
> > > > > INFO: Configuring Service(id=jdbc/sus2, type=Resource,
> > > > > provider-id=jdbc/sus2)
> > > > > Aug 02, 2016 4:13:03 PM org.apache.openejb.util.OptionsLog info
> > > > > INFO: Using 'openejb.deployments.classpath=false'
> > > > > Aug 02, 2016 4:13:03 PM
> > > > > org.apache.openejb.assembler.classic.Assembler
> > > > > createRecipe
> > > > > INFO: Creating TransactionManager(id=Default Transaction Manager)
> > > > > Aug 02, 2016 4:13:03 PM
> > > > > org.apache.openejb.assembler.classic.Assembler
> > > > > createRecipe
> > > > > INFO: Creating SecurityService(id=Tomcat Security Service) Aug 02,
> > > > > 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> > > > > createRecipe
> > > > > INFO: Creating Resource(id=jdbc/sus2) Aug 02, 2016 4:13:03 PM
> > > > > org.apache.openejb.assembler.classic.Assembler
> > > > > unusedProperty
> > > > > WARNING: unusedProperty maxActive - jdbc/sus2 Aug 02, 2016 4:13:03
> > > > > PM org.apache.openejb.assembler.classic.Assembler
> > > > > unusedProperty
> > > > > WARNING: unusedProperty maxIdle - jdbc/sus2 Aug 02, 2016 4:13:03
> > > > > PM org.apache.openejb.assembler.classic.Assembler
> > > > > unusedProperty
> > > > > WARNING: unusedProperty maxWait - jdbc/sus2 Aug 02, 2016 4:13:03
> > > > > PM org.apache.openejb.assembler.classic.Assembler
> > > > > unusedProperty
> > > > > WARNING: unusedProperty url - jdbc/sus2 Aug 02, 2016 4:13:03 PM
> > > > > org.apache.openejb.assembler.classic.Assembler
> > > > > unusedProperty
> > > > > WARNING: unusedProperty username - jdbc/sus2 Aug 02, 2016 4:13:03
> > > > > PM org.apache.openejb.assembler.classic.Assembler
> > > > > unusedProperty
> > > > > WARNING: unusedProperty password - jdbc/sus2
> > > > > -----------------
> > > > >
> > > > > I don't understand what "unusedProperty" means (weird that it's
> > > > > just one word).
> > > > >
> > > > > When I later try to reference that resource, I get the following:
> > > > > --------------------
> > > > > javax.naming.NameNotFoundException: Name [jdbc/sus2] is not bound
> > > > > in this Context. Unable to find [jdbc].
> > > > > --------------------
> > > > >
> > > > > It's not clear to me whether that Resource definition put anything
> > > > > into the JNDI context, or whether I'm just using the wrong JNDI
> > > > > path to reference it.
> > > > >
> > > > > -----Original Message-----
> > > > > From: Daniel Cunha [mailto:danielsoro@gmail.com]
> > > > > Sent: Tuesday, August 02, 2016 2:10 PM
> > > > > To: TomEE Users <us...@tomee.apache.org>
> > > > > Subject: Re: Define datasource, reference JDBC driver, and see
> > > > > init in console
> > > > >
> > > > > Hi David,
> > > > >
> > > > > yea, resources on TomEE is a mix (XML/Properties) Your definition
> > > > > should following the pattern:
> > > > >  <Resource id="jdbc/sus2" type="DataSource">
> > > > >             maxActive = 5
> > > > >             maxIdle = 2
> > > > >             maxWait = 10000
> > > > >             driverClassName = oracle.jdbc.driver.OracleDriver
> > > > >             url = jdbc:oracle:thin:@<host>:1521:<sid>
> > > > >             username = <user>
> > > > >             password = <password>
> > > > > </Resource>
> > > > >
> > > > > References you can see here:
> > > > > http://tomee.apache.org/datasource-config.html
> > > > > About maven, should be enough have the configuration in your
> > > > settings.xml.
> > > > > :)
> > > > >
> > > > > On Tue, Aug 2, 2016 at 5:52 PM, KARR, DAVID <dk...@att.com>
> > wrote:
> > > > >
> > > > > > (I posted this first to tomcat-user, but I realized technically
> > > > > > it should go to tomee-user.  I apologize if this is a duplicate
> > > > > > for
> > > > you.
> > > > > > In any case, this note has a little more info than the first
> > > > > > note.)
> > > > > >
> > > > > > I'm attempting to use Tomcat(tomee) to run a REST service that
> > > > > > will return some data from some SQL queries (Oracle).  I've
> > > > > > installed Tomee 7.0.1, which uses Tomcat 8.5.3.
> > > > > >
> > > > > > The JDBC driver is available from a private enterprise maven
> > repo.
> > > > > > I'd prefer to get it from there, as opposed to storing it
> > locally.
> > > > > > I noticed at
> > > > > > http://tomee.apache.org/configuring-datasources.html , there is
> > the possible notation of "mvn:g:a:v" for the "classpath"
> > > > > > attribute.  However, I don't see any way to configure the Maven
> > > > > repositories this will reference.
> > > > > > How do I tell it to look in a particular repo for this?  Would
> > > > > > it just implicitly use my $HOME/.m2/settings.xml file?
> > > > > >
> > > > > > My Resource definition in "conf/tomee.xml" looks something like
> > > > this:
> > > > > > -----------------------
> > > > > >   <Resource id="jdbc/sus2" type="DataSource"
> > > > > >             maxActive="5" maxIdle="2" maxWait="10000"
> > > > > >             driverClassName="oracle.jdbc.driver.OracleDriver"
> > > > > >             url="jdbc:oracle:thin:@<host>:1521:<sid>"
> > > > > >             username="<user>" password="<password>"/>
> > > > > > ----------------
> > > > > >
> > > > > > Does this look correct?  I find the Tomcat docs confusing, with
> > > > > > respect to the required syntax for this.  It's not clear whether
> > > > > > a pure XML syntax is required, or a mixed XML/property syntax.
> > > > > >
> > > > > > If I start the instance, should I see any default output that
> > > > > > will show Tomcat connecting to this datasource?  If it doesn't
> > > > > > show this by default, is there a way to turn this on?
> > > > > >
> > > > > > I tried writing the code to obtain the JNDI resource (Spring
> > > > > > context references), but it just says it can't find it (fails at
> > > > > > "jdbc"), so perhaps my Resource definition was ignored, or my
> > > > > > JNDI path is
> > > > wrong.
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Daniel Cunha
> > > > > https://twitter.com/dvlc_
> > > > > http://www.tomitribe.com
> > > > > http://www.tomitribe.io
> > > > >
> > >
>

RE: Define datasource, reference JDBC driver, and see init in console

Posted by "KARR, DAVID" <dk...@att.com>.
> -----Original Message-----
> From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> Sent: Wednesday, August 03, 2016 10:25 AM
> To: users@tomee.apache.org
> Subject: Re: Define datasource, reference JDBC driver, and see init in
> console
> 
> 2016-08-03 18:41 GMT+02:00 KARR, DAVID <dk...@att.com>:
> 
> > > -----Original Message-----
> > > From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> > > Sent: Tuesday, August 02, 2016 11:53 PM
> > > To: users@tomee.apache.org
> > > Subject: Re: Define datasource, reference JDBC driver, and see init
> > > in console
> > >
> 
> > > - using jdbc/sus2 you can use @Resource(name = "jdbc/sus2")
> > > DataSource ds; or do a lookup on openejb:Resource/jdbc/sus2 or
> > > java:openejb/Resource/
> > > jdbc/sus2
> >
> > This is my core problem, which I have to solve.  This is a VFAQ about
> > JNDI, in my view.  It's easy to define a name for something, but all
> > JNDI systems put "magic prefixes" on all the entities that go into the
> > JNDI registry, that make it difficult for users to figure out what the
> > actual names are.
> >
> >
> you can use id="global/foo/bar" to get java:global/foo/bar jndi name if
> it helps.

Just for kicks, I just tried using exactly that name, and I changed my resource definition to more closely match what you described earlier.  It's still failing to find the datasource, but I'm now getting different errors.

Here's my Resource:
--------------
  <Resource id="global/foo/bar" type="DataSource" classpath="mvn:oracle:ojdbc6:11.2.0.3">
	    JdbcDriver = oracle.jdbc.driver.OracleDriver
	    MaxActive = 5
	    MinIdle = 2
	    MaxIdle = 2 
	    MaxWait = 10000
	    JdbcUrl = jdbc:oracle:thin:@b2csusdblh1.bodc.att.com:1521:sus2
	    UserName = dk068x
	    Password = Futility00
  </Resource>
---------------

My Spring context excerpt:
----------------
	<jee:jndi-lookup jndi-name="java:global/foo/bar" id="sus2ds"/>
----------------

My (truncated) Tomcat console output:
----------------
INFO: Configuring Service(id=global/foo/bar, type=Resource, provider-id=Default JDBC Database)
...
INFO: Creating Resource(id=global/foo/bar)
Aug 03, 2016 10:49:41 AM org.apache.tomcat.jdbc.pool.ConnectionPool checkPoolConfiguration
WARNING: initialSize is larger than maxActive, setting initialSize to: 5
Aug 03, 2016 10:49:42 AM org.apache.tomcat.jdbc.pool.ConnectionPool init
SEVERE: Unable to create initial connections of pool.
org.apache.tomcat.jdbc.pool.PoolExhaustedException: [main] NoWait: Pool empty. Unable to fetch a connection, none available[5 in use].
	at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:679)
	at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:468)
	at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:143)
	at org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEConnectionPool.<init>(TomEEDataSourceCreator.java:221)
...

Aug 03, 2016 10:49:42 AM org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEDataSource <init>
SEVERE: Can't create DataSource
org.apache.tomcat.jdbc.pool.PoolExhaustedException: [main] NoWait: Pool empty. Unable to fetch a connection, none available[5 in use].
	at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:679)
	at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:468)
	at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:143)
	at org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEConnectionPool.<init>(TomEEDataSourceCreator.java:221)
	at org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEDataSource.createPool(TomEEDataSourceCreator.java:154)
...

...
2016-08-03 10:49:44,918 WARN  [localhost-startStop-1] support.AbstractApplicationContext (AbstractApplicationContext.java:549) - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sus2ds': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name "foo/bar" not found.
2016-08-03 10:49:44,922 ERROR [localhost-startStop-1] context.ContextLoader (ContextLoader.java:351) - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sus2ds': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name "foo/bar" not found.
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
...
Caused by: javax.naming.NameNotFoundException: Name "foo/bar" not found.
	at org.apache.openejb.core.ivm.naming.IvmContext.federate(IvmContext.java:199)
	at org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:151)
	at org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:291)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:828)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:174)
	at org.apache.naming.SelectorContext.lookup(SelectorContext.java:163)
	at javax.naming.InitialContext.lookup(Unknown Source)
	at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:155)
...
Aug 03, 2016 10:49:44 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sus2ds': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name "foo/bar" not found.
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
...
Caused by: javax.naming.NameNotFoundException: Name "foo/bar" not found.
	at org.apache.openejb.core.ivm.naming.IvmContext.federate(IvmContext.java:199)
	at org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:151)
	at org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:291)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:828)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:174)
	at org.apache.naming.SelectorContext.lookup(SelectorContext.java:163)
	at javax.naming.InitialContext.lookup(Unknown Source)
...
----------------

I don't know why I'm now seeing the pool errors when I didn't before.  I suppose the change to the Resource definition did that.

> 
> 
> > I originally tried "jdbc/sus2".  That failed to find "jdbc".  I tried
> > changing the resource name to just "sus2" and tried looking up
> > "java:comp/env/sus2".  That says it failed to find "sus2".
> >
> >
> context.xml resources are bound to comp/env tree (by webapp), tomee.xml
> ones are bound to openejb:Resource tree (global).
> 
> 
> > I'm including here an excerpt of the console output, which shows the
> > "sus2" resource being defined, and the later looking for
> > "java:comp/env/sus2", saying that "sus2" is not found.
> > --------------------------
> > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context}
> > Setting property 'source' to 'org.eclipse.jst.jee.server:webproj' did
> > not find a matching property.
> > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context}
> > Setting property 'source' to 'org.eclipse.jst.jee.server:dumpjndi' did
> > not find a matching property.
> > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > INFO: Server version:        Apache Tomcat (TomEE)/8.0.8.5.3 (7.0.1)
> > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > INFO: Server built:          Jun 9 2016 11:16:29 UTC
> > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > INFO: Server number:         8.5.3.0
> > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > INFO: OS Name:               Windows 7
> > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > INFO: OS Version:            6.1
> > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > INFO: Architecture:          amd64
> > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > INFO: Java Home:             C:\Program Files\Java\jre1.8.0_102
> > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > INFO: JVM Version:           1.8.0_102-b14
> > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > INFO: JVM Vendor:            Oracle Corporation
> > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > INFO: CATALINA_BASE:
> >
> > <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tm
> > p0 Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > INFO: CATALINA_HOME:
> >
> > <homepath>\frameworks\apache-tomee-7.0.1-webprofile\apache-tomee-webpr
> > ofile-7.0.1 Aug 03, 2016 9:29:40 AM
> > sun.reflect.NativeMethodAccessorImpl invoke
> > INFO: Command line argument:
> > -Dcatalina.base=<homepath>\workspace\.metadata\.plugins\org.eclipse.ws
> > t.server.core\tmp0 Aug 03, 2016 9:29:40 AM
> > sun.reflect.NativeMethodAccessorImpl invoke
> > INFO: Command line argument:
> > -Dcatalina.home=<homepath>\frameworks\apache-tomee-7.0.1-webprofile\ap
> > ache-tomee-webprofile-7.0.1 Aug 03, 2016 9:29:40 AM
> > sun.reflect.NativeMethodAccessorImpl invoke
> > INFO: Command line argument:
> > -Dwtp.deploy=<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.s
> > erver.core\tmp0\wtpwebapps Aug 03, 2016 9:29:40 AM
> > sun.reflect.NativeMethodAccessorImpl invoke
> > INFO: Command line argument:
> > -Djava.endorsed.dirs=<homepath>\frameworks\apache-tomee-7.0.1-webprofi
> > le\apache-tomee-webprofile-7.0.1\endorsed
> > Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> > INFO: Command line argument: -Dfile.encoding=Cp1252 Aug 03, 2016
> > 9:29:40 AM sun.reflect.DelegatingMethodAccessorImpl invoke
> > INFO: The APR based Apache Tomcat Native library which allows optimal
> > performance in production environments was not found on the
> > java.library.path: C:\Program
> > Files\Java\jre1.8.0_102\bin;C:\Windows\Sun\Java\bin;C:\Windows\system3
> > 2;C:\Windows;c:/Program
> > Files/Java/jdk1.8.0_102/bin/../jre/bin/server;c:/Program
> > Files/Java/jdk1.8.0_102/bin/../jre/bin;c:/Program
> > Files/Java/jdk1.8.0_102/bin/../jre/lib/amd64;c:\Program
> > Files\Java\jdk1.8.0_102\bin;C:\Program Files (x86)\RSA SecurID Token
> > Common;C:\Program Files (x86)\NVIDIA
> > Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\Sys
> > tem32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\Syst
> > em32\WindowsPowerShell\v1.0\;C:\Program
> > Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;C:\Program Files
> > (x86)\Intel\OpenCL SDK\3.0\bin\x64;C:\Program
> > Files\1E\NomadBranch\;C:\Program Files (x86)\Enterprise
> > Vault\EVClient\;c:\Program Files\Java\jdk1.8.0_102\bin;C:\Program
> > Files\nodejs\;c:\Users\dk068x\frameworks\gradle-2.14.1-all\gradle-
> 2.14.1\bin;c:\Users\dk068x\frameworks\apache-groovy-sdk-2.4.7\groovy-
> 2.4.7\bin;<homepath>\AppData\Roaming\npm;<homepath>\Desktop;;.
> > Aug 03, 2016 9:29:40 AM sun.reflect.DelegatingMethodAccessorImpl
> > invoke
> > INFO: Initializing ProtocolHandler ["http-nio-8080"] Aug 03, 2016
> > 9:29:41 AM sun.reflect.DelegatingMethodAccessorImpl invoke
> > INFO: Using a shared selector for servlet write/read Aug 03, 2016
> > 9:29:41 AM sun.reflect.DelegatingMethodAccessorImpl invoke
> > INFO: Initializing ProtocolHandler ["ajp-nio-8009"] Aug 03, 2016
> > 9:29:41 AM sun.reflect.DelegatingMethodAccessorImpl invoke
> > INFO: Using a shared selector for servlet write/read Aug 03, 2016
> > 9:29:41 AM org.apache.openejb.util.OptionsLog info
> > INFO: Using
> > 'openejb.jdbc.datasource-
> creator=org.apache.tomee.jdbc.TomEEDataSourceCreator'
> > Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
> > INFO:
> > **********************************************************************
> > ********** Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance
> > <init>
> > INFO: OpenEJB http://tomee.apache.org/ Aug 03, 2016 9:29:41 AM
> > org.apache.openejb.OpenEJB$Instance <init>
> > INFO: Startup: Wed Aug 03 09:29:41 PDT 2016 Aug 03, 2016 9:29:41 AM
> > org.apache.openejb.OpenEJB$Instance <init>
> > INFO: Copyright 1999-2016 (C) Apache OpenEJB Project, All Rights
> Reserved.
> > Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
> > INFO: Version: 7.0.1
> > Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
> > INFO: Build date: 20160623
> > Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
> > INFO: Build time: 12:04
> > Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
> > INFO:
> > **********************************************************************
> > ********** Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance
> > <init>
> > INFO: openejb.home =
> > <homepath>\frameworks\apache-tomee-7.0.1-webprofile\apache-tomee-webpr
> > ofile-7.0.1 Aug 03, 2016 9:29:41 AM
> > org.apache.openejb.OpenEJB$Instance <init>
> > INFO: openejb.base =
> > <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tm
> > p0 Aug 03, 2016 9:29:41 AM org.apache.openejb.cdi.CdiBuilder
> > initializeOWB
> > INFO: Created new singletonService
> > org.apache.openejb.cdi.ThreadSingletonServiceImpl@37e547da
> > Aug 03, 2016 9:29:41 AM org.apache.openejb.cdi.CdiBuilder
> > initializeOWB
> > INFO: Succeeded in installing singleton service Aug 03, 2016 9:29:41
> > AM org.apache.openejb.config.ConfigurationFactory init
> > INFO: TomEE configuration file is
> >
> '<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp
> 0\conf\tomee.xml'
> > Aug 03, 2016 9:29:41 AM org.apache.openejb.config.ConfigurationFactory
> > configureService
> > INFO: Configuring Service(id=Tomcat Security Service,
> > type=SecurityService, provider-id=Tomcat Security Service) Aug 03,
> > 2016 9:29:41 AM org.apache.openejb.config.ConfigurationFactory
> > configureService
> > INFO: Configuring Service(id=Default Transaction Manager,
> > type=TransactionManager, provider-id=Default Transaction Manager) Aug
> > 03, 2016 9:29:41 AM org.apache.openejb.config.ConfigurationFactory
> > configureService
> > INFO: Configuring Service(id=sus2, type=Resource, provider-id=sus2)
> > Aug 03, 2016 9:29:41 AM org.apache.openejb.util.OptionsLog info
> > INFO: Using 'openejb.deployments.classpath=false'
> > Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> > createRecipe
> > INFO: Creating TransactionManager(id=Default Transaction Manager) Aug
> > 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> > createRecipe
> > INFO: Creating SecurityService(id=Tomcat Security Service) Aug 03,
> > 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> > createRecipe
> > INFO: Creating Resource(id=sus2)
> > Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> > unusedProperty
> > WARNING: unusedProperty maxActive - sus2 Aug 03, 2016 9:29:41 AM
> > org.apache.openejb.assembler.classic.Assembler
> > unusedProperty
> > WARNING: unusedProperty maxIdle - sus2 Aug 03, 2016 9:29:41 AM
> > org.apache.openejb.assembler.classic.Assembler
> > unusedProperty
> > WARNING: unusedProperty maxWait - sus2 Aug 03, 2016 9:29:41 AM
> > org.apache.openejb.assembler.classic.Assembler
> > unusedProperty
> > WARNING: unusedProperty url - sus2
> > Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> > unusedProperty
> > WARNING: unusedProperty username - sus2 Aug 03, 2016 9:29:41 AM
> > org.apache.openejb.assembler.classic.Assembler
> > unusedProperty
> > WARNING: unusedProperty password - sus2 Aug 03, 2016 9:29:41 AM
> > org.apache.openejb.server.ServiceManager initServer
> > INFO: Creating ServerService(id=cxf-rs) Aug 03, 2016 9:29:41 AM
> > org.apache.openejb.server.SimpleServiceManager
> > start
> > INFO:   ** Bound Services **
> > Aug 03, 2016 9:29:41 AM org.apache.openejb.server.SimpleServiceManager
> > printRow
> > INFO:   NAME                 IP              PORT
> > Aug 03, 2016 9:29:41 AM org.apache.openejb.server.SimpleServiceManager
> > start
> > INFO: -------
> > Aug 03, 2016 9:29:41 AM org.apache.openejb.server.SimpleServiceManager
> > start
> > INFO: Ready!
> > Aug 03, 2016 9:29:41 AM sun.reflect.DelegatingMethodAccessorImpl
> > invoke
> > INFO: Initialization processed in 1542 ms Aug 03, 2016 9:29:41 AM
> > org.apache.tomee.catalina.OpenEJBNamingContextListener bindResource
> > INFO: Importing a Tomcat Resource with id 'UserDatabase' of type
> > 'org.apache.catalina.UserDatabase'.
> > Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> > createRecipe
> > INFO: Creating Resource(id=UserDatabase) Aug 03, 2016 9:29:41 AM
> > sun.reflect.DelegatingMethodAccessorImpl invoke
> > INFO: Starting service Catalina
> > Aug 03, 2016 9:29:41 AM sun.reflect.DelegatingMethodAccessorImpl
> > invoke
> > INFO: Starting Servlet Engine: Apache Tomcat (TomEE)/8.0.8.5.3 (7.0.1)
> > Aug 03, 2016 9:29:41 AM org.apache.tomee.catalina.TomcatWebAppBuilder
> > init
> > INFO: ------------------------- localhost -> / Aug 03, 2016 9:29:41 AM
> > org.apache.openejb.config.ConfigurationFactory
> > configureApplication
> > INFO: Configuring enterprise application:
> > <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tm
> > p0\wtpwebapps\ROOT Aug 03, 2016 9:29:41 AM
> > org.apache.openejb.config.ConfigurationFactory
> > configureService
> > INFO: Configuring Service(id=Default Managed Container,
> > type=Container, provider-id=Default Managed Container) Aug 03, 2016
> > 9:29:41 AM org.apache.openejb.config.AutoConfig
> > createContainer
> > INFO: Auto-creating a container for bean .Comp483003755:
> > Container(type=MANAGED, id=Default Managed Container) Aug 03, 2016
> > 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> > createRecipe
> > INFO: Creating Container(id=Default Managed Container) Aug 03, 2016
> > 9:29:42 AM org.apache.openejb.core.managed.SimplePassivater
> > init
> > INFO: Using directory <homepath>\AppData\Local\Temp for stateful
> > session passivation Aug 03, 2016 9:29:42 AM
> > org.apache.openejb.config.AppInfoBuilder build
> > INFO: Enterprise application
> >
> "<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp
> 0\wtpwebapps\ROOT"
> > loaded.
> > Aug 03, 2016 9:29:42 AM org.apache.openejb.assembler.classic.Assembler
> > createApplication
> > INFO: Assembling app:
> > <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tm
> > p0\wtpwebapps\ROOT Aug 03, 2016 9:29:42 AM
> > org.apache.openejb.assembler.classic.Assembler
> > createApplication
> > INFO: Deployed
> > Application(path=<homepath>\workspace\.metadata\.plugins\org.eclipse.w
> > st.server.core\tmp0\wtpwebapps\ROOT)
> > Aug 03, 2016 9:29:42 AM org.apache.tomee.catalina.TomcatWebAppBuilder
> > init
> > INFO: ------------------------- localhost -> /dumpjndi Aug 03, 2016
> > 9:29:42 AM org.apache.openejb.config.ConfigurationFactory
> > configureApplication
> > INFO: Configuring enterprise application:
> > <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tm
> > p0\wtpwebapps\dumpjndi Aug 03, 2016 9:29:42 AM
> > org.apache.openejb.config.AppInfoBuilder build
> > INFO: Enterprise application
> >
> "<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp
> 0\wtpwebapps\dumpjndi"
> > loaded.
> > Aug 03, 2016 9:29:42 AM org.apache.openejb.assembler.classic.Assembler
> > createApplication
> > INFO: Assembling app:
> > <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tm
> > p0\wtpwebapps\dumpjndi Aug 03, 2016 9:29:42 AM
> > org.apache.openejb.assembler.classic.Assembler
> > createApplication
> > INFO: Deployed
> > Application(path=<homepath>\workspace\.metadata\.plugins\org.eclipse.w
> > st.server.core\tmp0\wtpwebapps\dumpjndi)
> > Aug 03, 2016 9:29:42 AM org.apache.tomee.catalina.TomcatWebAppBuilder
> > init
> > INFO: ------------------------- localhost -> /webproj Aug 03, 2016
> > 9:29:42 AM org.apache.openejb.config.ConfigurationFactory
> > configureApplication
> > INFO: Configuring enterprise application:
> > <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tm
> > p0\wtpwebapps\webproj Aug 03, 2016 9:29:42 AM
> > org.apache.openejb.config.AppInfoBuilder build
> > INFO: Enterprise application
> >
> "<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp
> 0\wtpwebapps\webproj"
> > loaded.
> > Aug 03, 2016 9:29:42 AM org.apache.openejb.assembler.classic.Assembler
> > createApplication
> > INFO: Assembling app:
> > <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tm
> > p0\wtpwebapps\webproj Aug 03, 2016 9:29:42 AM
> > org.apache.openejb.assembler.classic.Assembler
> > createApplication
> > INFO: Deployed
> > Application(path=<homepath>\workspace\.metadata\.plugins\org.eclipse.w
> > st.server.core\tmp0\wtpwebapps\webproj)
> > Aug 03, 2016 9:29:42 AM sun.reflect.DelegatingMethodAccessorImpl
> > invoke
> > INFO: At least one JAR was scanned for TLDs yet contained no TLDs.
> > Enable debug logging for this logger for a complete list of JARs that
> > were scanned but no TLDs were found in them. Skipping unneeded JARs
> > during scanning can improve startup time and JSP compilation time.
> > Aug 03, 2016 9:29:42 AM org.apache.catalina.core.ApplicationContext
> > log
> > INFO: No Spring WebApplicationInitializer types detected on classpath
> > Aug 03, 2016 9:29:43 AM org.apache.catalina.core.ApplicationContext
> > log
> > INFO: Initializing Spring root WebApplicationContext
> > 2016-08-03 09:29:43,001 INFO  [localhost-startStop-1]
> > context.ContextLoader (ContextLoader.java:305) - Root
> > WebApplicationContext: initialization started
> > 2016-08-03 09:29:43,180 DEBUG [localhost-startStop-1]
> > env.MutablePropertySources (MutablePropertySources.java:109) - Adding
> > [servletConfigInitParams] PropertySource with lowest search precedence
> > 2016-08-03 09:29:43,181 DEBUG [localhost-startStop-1]
> > env.MutablePropertySources (MutablePropertySources.java:109) - Adding
> > [servletContextInitParams] PropertySource with lowest search
> > precedence
> > 2016-08-03 09:29:43,189 DEBUG [localhost-startStop-1]
> > env.MutablePropertySources (MutablePropertySources.java:109) - Adding
> > [jndiProperties] PropertySource with lowest search precedence
> > 2016-08-03 09:29:43,190 DEBUG [localhost-startStop-1]
> > env.MutablePropertySources (MutablePropertySources.java:109) - Adding
> > [systemProperties] PropertySource with lowest search precedence
> > 2016-08-03 09:29:43,190 DEBUG [localhost-startStop-1]
> > env.MutablePropertySources (MutablePropertySources.java:109) - Adding
> > [systemEnvironment] PropertySource with lowest search precedence
> > 2016-08-03 09:29:43,190 DEBUG [localhost-startStop-1]
> > env.AbstractEnvironment (AbstractEnvironment.java:127) - Initialized
> > StandardServletEnvironment with PropertySources
> > [servletConfigInitParams,servletContextInitParams,jndiProperties,syste
> > mProperties,systemEnvironment]
> > 2016-08-03 09:29:43,204 DEBUG [localhost-startStop-1]
> > env.MutablePropertySources (MutablePropertySources.java:174) -
> > Replacing [servletContextInitParams] PropertySource with
> > [servletContextInitParams]
> > 2016-08-03 09:29:43,210 INFO  [localhost-startStop-1]
> > support.AbstractApplicationContext
> > (AbstractApplicationContext.java:581) - Refreshing Root
> > WebApplicationContext: startup date [Wed Aug 03 09:29:43 PDT 2016];
> > root of context hierarchy
> > 2016-08-03 09:29:43,293 INFO  [localhost-startStop-1]
> > xml.XmlBeanDefinitionReader (XmlBeanDefinitionReader.java:317) -
> > Loading XML bean definitions from ServletContext resource
> > [/WEB-INF/applicationContext.xml]
> > 2016-08-03 09:29:43,381 INFO  [localhost-startStop-1]
> > xml.XmlBeanDefinitionReader (XmlBeanDefinitionReader.java:317) -
> > Loading XML bean definitions from class path resource
> > [META-INF/cxf/cxf.xml]
> > 2016-08-03 09:29:43,409 INFO  [localhost-startStop-1]
> > xml.XmlBeanDefinitionReader (XmlBeanDefinitionReader.java:317) -
> > Loading XML bean definitions from class path resource
> > [META-INF/cxf/cxf-servlet.xml]
> > 2016-08-03 09:29:43,490 INFO  [localhost-startStop-1]
> > support.DefaultListableBeanFactory
> > (DefaultListableBeanFactory.java:843) - Overriding bean definition for
> bean 'webproj' with a different definition:
> > replacing [Generic bean: class
> > [org.apache.cxf.jaxrs.spring.JAXRSServerFactoryBeanDefinitionParser$Sp
> > ringJAXRSServerFactoryBean]; scope=; abstract=false; lazyInit=false;
> > autowireMode=0; dependencyCheck=0; autowireCandidate=true;
> > primary=false; factoryBeanName=null; factoryMethodName=null;
> > initMethodName=create; destroyMethodName=destroy] with [Generic bean:
> > class [com.att.webproj.services.WebProjController];
> > scope=; abstract=false; lazyInit=false; autowireMode=0;
> > dependencyCheck=0; autowireCandidate=true; primary=false;
> > factoryBeanName=null; factoryMethodName=null; initMethodName=null;
> > destroyMethodName=null; defined in ServletContext resource
> > [/WEB-INF/applicationContext.xml]]
> > 2016-08-03 09:29:43,512 DEBUG [localhost-startStop-1]
> > support.AbstractApplicationContext
> > (AbstractApplicationContext.java:615) - Bean factory for Root
> WebApplicationContext:
> >
> org.springframework.beans.factory.support.DefaultListableBeanFactory@693
> a3417:
> > defining beans
> > [cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.a
> > pache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring
> > .BusExtensionPostProcessor,webproj,sus2ds,com.att.webproj.dao.OrdersDA
> > O#0];
> > root of factory hierarchy
> > 2016-08-03 09:29:43,633 DEBUG [localhost-startStop-1]
> > support.AbstractApplicationContext
> > (AbstractApplicationContext.java:728) - Unable to locate MessageSource
> > with name 'messageSource': using default
> > [org.springframework.context.support.DelegatingMessageSource@741ac774]
> > 2016-08-03 09:29:43,637 DEBUG [localhost-startStop-1]
> > support.AbstractApplicationContext
> > (AbstractApplicationContext.java:752) - Unable to locate
> > ApplicationEventMulticaster with name
> > 'applicationEventMulticaster': using default
> > [org.springframework.context.event.SimpleApplicationEventMulticaster@a
> > 6b8658
> > ]
> > 2016-08-03 09:29:43,864 WARN  [localhost-startStop-1]
> > support.AbstractApplicationContext
> > (AbstractApplicationContext.java:549) - Exception encountered during
> > context initialization - cancelling refresh
> > attempt: org.springframework.beans.factory.BeanCreationException:
> > Error creating bean with name 'sus2ds': Invocation of init method
> > failed; nested exception is javax.naming.NameNotFoundException: Name
> > [sus2] is not bound in this Context. Unable to find [sus2].
> > 2016-08-03 09:29:43,868 ERROR [localhost-startStop-1]
> > context.ContextLoader (ContextLoader.java:351) - Context
> > initialization failed
> > org.springframework.beans.factory.BeanCreationException: Error
> > creating bean with name 'sus2ds': Invocation of init method failed;
> > nested exception is javax.naming.NameNotFoundException: Name [sus2] is
> > not bound in this Context. Unable to find [sus2].
> > ---------------
> >
> > > - about maven: ${user.home}/.m2/repository is the default base, you
> > > can override it to openejb.m2.home system property (in
> > > conf/system.properties for instance). If this folder doesn't exist
> > > we'll read the default settings.xml to get the localRespository
> value.
> >
> > Ok, so just to be clear, the "mvn:" prefix is only going to search a
> > local repository.  It's not going to go to MavenCentral or anything
> like that.
> > The doc doesn't say anything at all about this.  We need to find a
> > reasonable way to document this.
> >
> >
> It does a http request if the local lookup fails. Default http base is
> central if the version is a release and apache snapshot one if the
> version is a snapshot. This repo url can be customized specifying it in
> the mvn url
> (mv:http://company.com/maven2!groupId:artifactId:version)
> 
> 
> > Please give me more information about everything that happens after
> > "if this folder doesn't exist".
> >
> 
> The very detail can be found
> in org.apache.openejb.loader.provisining.MavenResolver#quickMvnUrl
> method.
> 
> 
> >
> > > - about your "strange" error: tomee Resource attributes are about
> > > the resource factory and body of Resource tag is the list of
> > > properties used to set instance attributes. Tomcat put everything as
> > > attributes. This is why you got this error.
> >
> > Understood.  The notion of "attributes" vs. "properties" is lost on
> > many people.  I understand that they are different, but it needs to be
> > clear in the doc and in the messages.
> >
> > > - last point: we support some bridge between historical tomee
> > > definitions and tomcat datasources (to make the migration smooth) so
> > > you can still use JdbcDriver, UserName, Password, JdbcUrl:
> > >
> > > <Resource id="jdbc/sus2" type="DataSource"
> classpath="mvn:oracle:ojdbc6:
> > > 11.2.0.3">
> > >     JdbcDriver = oracle.jdbc.driver.OracleDriver
> > >     MaxActive = 5
> > >     MaxIdle = 2
> > >     MaxWait = 10000
> > >     JdbcUrl = jdbc:oracle:thin:@<host>:1521:<sid>
> > >     UserName = <userid>
> > >     Password = <password>
> > >   </Resource>
> > >
> > > Advantage of keeping these properties is the same definition will
> > > run with openejb (understand tomee without tomcat and embedded)
> > > which is a great way to debug a weird case reusing the same data as
> in tomee.
> >
> > And what parts of this are "historical tome definitions" and "tomcat
> > datasources"?  How would someone know which properties/attributes are
> > "historical"?  Many people using Tomcat or TomEE for the first time
> > know nothing about this history.
> >
> >
> The conversion is done there -
> https://github.com/apache/tomee/blob/master/tomee/tomee-
> jdbc/src/main/java/org/apache/tomee/jdbc/TomEEDataSourceCreator.java#L87
> - and as you can see we try to override if missing only making both
> cases working.
> 
> 
> > > 2016-08-03 1:21 GMT+02:00 KARR, DAVID <dk...@att.com>:
> > >
> > > > I may be making some progress.  Working from
> > > > http://tomee.apache.org/tomee-and-eclipse.html , it appears that
> > > > the "tomeee.xml" file that I edited in the Tomee distro is not
> > > > used in Eclipse.  I used the "Import" feature as described to copy
> > > > the file
> > > into
> > > > the server defined in Eclipse.   At that point, I got an error
> like
> > > this:
> > > > ---------------------
> > > > org.apache.openejb.OpenEJBException:
> > > > Unable to read OpenEJB configuration file at
> > > >
> > > <workspace>\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf
> > > \tom
> > > ee.xml:
> > > > Unsupported Attribute(s): maxActive, maxIdle, maxWait,
> > > > driverClassName, url, username, password.
> > > > Supported Attributes are: type, jar, provider, id, class-name,
> > > > constructor, factory-name, classpath, jndi, aliases,
> > > > properties-provider, property-provider, depends-on.  If the
> > > > setting is a configuration property it must be placed inside the
> element body.
> > > > ---------------------
> > > >
> > > > Really strange.
> > > >
> > > > I then modified the imported "tomee.xml" file, resulting in the
> > > > following approximate Resource definition:
> > > > --------------------
> > > > <Resource id="jdbc/sus2" type="DataSource"
> > > > classpath="mvn:oracle:ojdbc6:11.2.0.3"
> > > >             class-name="oracle.jdbc.driver.OracleDriver">
> > > >             maxActive = 5
> > > >             maxIdle = 2
> > > >             maxWait = 10000
> > > >             url = jdbc:oracle:thin:@<host>:1521:<sid>
> > > >             username = <userid>
> > > >             password = <password>
> > > >   </Resource>
> > > > --------------
> > > >
> > > > When I start up the server, I see the following in the console:
> > > > ------------------
> > > > Aug 02, 2016 4:13:03 PM
> > > > org.apache.openejb.config.ConfigurationFactory
> > > > configureService
> > > > INFO: Configuring Service(id=jdbc/sus2, type=Resource,
> > > > provider-id=jdbc/sus2)
> > > > Aug 02, 2016 4:13:03 PM org.apache.openejb.util.OptionsLog info
> > > > INFO: Using 'openejb.deployments.classpath=false'
> > > > Aug 02, 2016 4:13:03 PM
> > > > org.apache.openejb.assembler.classic.Assembler
> > > > createRecipe
> > > > INFO: Creating TransactionManager(id=Default Transaction Manager)
> > > > Aug 02, 2016 4:13:03 PM
> > > > org.apache.openejb.assembler.classic.Assembler
> > > > createRecipe
> > > > INFO: Creating SecurityService(id=Tomcat Security Service) Aug 02,
> > > > 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> > > > createRecipe
> > > > INFO: Creating Resource(id=jdbc/sus2) Aug 02, 2016 4:13:03 PM
> > > > org.apache.openejb.assembler.classic.Assembler
> > > > unusedProperty
> > > > WARNING: unusedProperty maxActive - jdbc/sus2 Aug 02, 2016 4:13:03
> > > > PM org.apache.openejb.assembler.classic.Assembler
> > > > unusedProperty
> > > > WARNING: unusedProperty maxIdle - jdbc/sus2 Aug 02, 2016 4:13:03
> > > > PM org.apache.openejb.assembler.classic.Assembler
> > > > unusedProperty
> > > > WARNING: unusedProperty maxWait - jdbc/sus2 Aug 02, 2016 4:13:03
> > > > PM org.apache.openejb.assembler.classic.Assembler
> > > > unusedProperty
> > > > WARNING: unusedProperty url - jdbc/sus2 Aug 02, 2016 4:13:03 PM
> > > > org.apache.openejb.assembler.classic.Assembler
> > > > unusedProperty
> > > > WARNING: unusedProperty username - jdbc/sus2 Aug 02, 2016 4:13:03
> > > > PM org.apache.openejb.assembler.classic.Assembler
> > > > unusedProperty
> > > > WARNING: unusedProperty password - jdbc/sus2
> > > > -----------------
> > > >
> > > > I don't understand what "unusedProperty" means (weird that it's
> > > > just one word).
> > > >
> > > > When I later try to reference that resource, I get the following:
> > > > --------------------
> > > > javax.naming.NameNotFoundException: Name [jdbc/sus2] is not bound
> > > > in this Context. Unable to find [jdbc].
> > > > --------------------
> > > >
> > > > It's not clear to me whether that Resource definition put anything
> > > > into the JNDI context, or whether I'm just using the wrong JNDI
> > > > path to reference it.
> > > >
> > > > -----Original Message-----
> > > > From: Daniel Cunha [mailto:danielsoro@gmail.com]
> > > > Sent: Tuesday, August 02, 2016 2:10 PM
> > > > To: TomEE Users <us...@tomee.apache.org>
> > > > Subject: Re: Define datasource, reference JDBC driver, and see
> > > > init in console
> > > >
> > > > Hi David,
> > > >
> > > > yea, resources on TomEE is a mix (XML/Properties) Your definition
> > > > should following the pattern:
> > > >  <Resource id="jdbc/sus2" type="DataSource">
> > > >             maxActive = 5
> > > >             maxIdle = 2
> > > >             maxWait = 10000
> > > >             driverClassName = oracle.jdbc.driver.OracleDriver
> > > >             url = jdbc:oracle:thin:@<host>:1521:<sid>
> > > >             username = <user>
> > > >             password = <password>
> > > > </Resource>
> > > >
> > > > References you can see here:
> > > > http://tomee.apache.org/datasource-config.html
> > > > About maven, should be enough have the configuration in your
> > > settings.xml.
> > > > :)
> > > >
> > > > On Tue, Aug 2, 2016 at 5:52 PM, KARR, DAVID <dk...@att.com>
> wrote:
> > > >
> > > > > (I posted this first to tomcat-user, but I realized technically
> > > > > it should go to tomee-user.  I apologize if this is a duplicate
> > > > > for
> > > you.
> > > > > In any case, this note has a little more info than the first
> > > > > note.)
> > > > >
> > > > > I'm attempting to use Tomcat(tomee) to run a REST service that
> > > > > will return some data from some SQL queries (Oracle).  I've
> > > > > installed Tomee 7.0.1, which uses Tomcat 8.5.3.
> > > > >
> > > > > The JDBC driver is available from a private enterprise maven
> repo.
> > > > > I'd prefer to get it from there, as opposed to storing it
> locally.
> > > > > I noticed at
> > > > > http://tomee.apache.org/configuring-datasources.html , there is
> the possible notation of "mvn:g:a:v" for the "classpath"
> > > > > attribute.  However, I don't see any way to configure the Maven
> > > > repositories this will reference.
> > > > > How do I tell it to look in a particular repo for this?  Would
> > > > > it just implicitly use my $HOME/.m2/settings.xml file?
> > > > >
> > > > > My Resource definition in "conf/tomee.xml" looks something like
> > > this:
> > > > > -----------------------
> > > > >   <Resource id="jdbc/sus2" type="DataSource"
> > > > >             maxActive="5" maxIdle="2" maxWait="10000"
> > > > >             driverClassName="oracle.jdbc.driver.OracleDriver"
> > > > >             url="jdbc:oracle:thin:@<host>:1521:<sid>"
> > > > >             username="<user>" password="<password>"/>
> > > > > ----------------
> > > > >
> > > > > Does this look correct?  I find the Tomcat docs confusing, with
> > > > > respect to the required syntax for this.  It's not clear whether
> > > > > a pure XML syntax is required, or a mixed XML/property syntax.
> > > > >
> > > > > If I start the instance, should I see any default output that
> > > > > will show Tomcat connecting to this datasource?  If it doesn't
> > > > > show this by default, is there a way to turn this on?
> > > > >
> > > > > I tried writing the code to obtain the JNDI resource (Spring
> > > > > context references), but it just says it can't find it (fails at
> > > > > "jdbc"), so perhaps my Resource definition was ignored, or my
> > > > > JNDI path is
> > > wrong.
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Daniel Cunha
> > > > https://twitter.com/dvlc_
> > > > http://www.tomitribe.com
> > > > http://www.tomitribe.io
> > > >
> >

Re: Define datasource, reference JDBC driver, and see init in console

Posted by Romain Manni-Bucau <rm...@gmail.com>.
2016-08-03 18:41 GMT+02:00 KARR, DAVID <dk...@att.com>:

> > -----Original Message-----
> > From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> > Sent: Tuesday, August 02, 2016 11:53 PM
> > To: users@tomee.apache.org
> > Subject: Re: Define datasource, reference JDBC driver, and see init in
> > console
> >
> > Hello
>
> Thanks for replying.  There's a lot of information and questions in my
> reply.  My priority is getting the JNDI reference working.
>
> > Before digging deeper in your problem a small note on this one: since
> > you encounter some issue with the doc I would love you to try to
> > enrich/rewrite some part of it to make it smoother for next newcomer.
> > Would it be possible?
>
> Sure, it's possible.  I've worked on the docs for many frameworks that
> I've only been a user for.  Just as long as you realize that I can only
> write what I know about.  My only source of knowledge is the docs
> themselves, and what I learn here.  I'll never forget the unnamed framework
> I was using, where I discovered accidentally that there was at least one
> completely undocumented feature, and the author stated that I'm welcome to
> submit PRs, which I responded to with "Sure, any other undocumented
> features you want me to document?"
>
> However, my priority is getting this little app working, so the doc work
> is secondary.
>
> > Next about your issue:
> >
> > - you don't need to set class-name which is intended for custom
> > resources (DataSource are "known" resources)
>
> The message said this attribute is supported.  If you're going to support
> it, you need to say SOMEWHERE what it's for. Except for in this error
> message, I can't find this attribute described anywhere.
>
>
Most of the attributes are explained there
http://tomee.apache.org/ng/admin/configuration/resources.html


> I would say the same thing for every single attribute mentioned in that
> message.  If it's not mentioned in the doc, it needs to be, so I'd like to
> understand what it's for, and where in the docs you THINK it should be
> documented.
>
> Also, I'd like clarification on this distinction between XML attributes
> and properties.  Apparently some things can be set in XML attributes, and
> some things have to be set in properties.  Except by "example", what are
> the details of what goes in an XML attribute, and what goes in a property.
>

attributes = how to create the resource instance
properties = resource configuration

There are few exceptions on that for very advanced cases but they are rare
and most of the time workaround for not friendly resources so the general
rule is the mentionned one.


>
> > - unusedProperty is one word cause it is a method name (we can surely
> > enrich the message BTW). Means you set a property but this one doesn't
> > exist on the created instance (the connection pool there). That's one
> > smooth way to say the configuration is wrong but doesn't prevent to run.
>
> This isn't a doc problem, it's a problem with the message.  That message
> definitely needs to be cleaned up.
>
>
not sure I get it, adding a space would make it cleaned up. Is that what
you propose?


> > - using jdbc/sus2 you can use @Resource(name = "jdbc/sus2") DataSource
> > ds; or do a lookup on openejb:Resource/jdbc/sus2 or
> > java:openejb/Resource/
> > jdbc/sus2
>
> This is my core problem, which I have to solve.  This is a VFAQ about
> JNDI, in my view.  It's easy to define a name for something, but all JNDI
> systems put "magic prefixes" on all the entities that go into the JNDI
> registry, that make it difficult for users to figure out what the actual
> names are.
>
>
you can use id="global/foo/bar" to get java:global/foo/bar jndi name if it
helps.


> I originally tried "jdbc/sus2".  That failed to find "jdbc".  I tried
> changing the resource name to just "sus2" and tried looking up
> "java:comp/env/sus2".  That says it failed to find "sus2".
>
>
context.xml resources are bound to comp/env tree (by webapp), tomee.xml
ones are bound to openejb:Resource tree (global).


> I'm including here an excerpt of the console output, which shows the
> "sus2" resource being defined, and the later looking for
> "java:comp/env/sus2", saying that "sus2" is not found.
> --------------------------
> Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting
> property 'source' to 'org.eclipse.jst.jee.server:webproj' did not find a
> matching property.
> Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting
> property 'source' to 'org.eclipse.jst.jee.server:dumpjndi' did not find a
> matching property.
> Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> INFO: Server version:        Apache Tomcat (TomEE)/8.0.8.5.3 (7.0.1)
> Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> INFO: Server built:          Jun 9 2016 11:16:29 UTC
> Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> INFO: Server number:         8.5.3.0
> Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> INFO: OS Name:               Windows 7
> Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> INFO: OS Version:            6.1
> Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> INFO: Architecture:          amd64
> Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> INFO: Java Home:             C:\Program Files\Java\jre1.8.0_102
> Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> INFO: JVM Version:           1.8.0_102-b14
> Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> INFO: JVM Vendor:            Oracle Corporation
> Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> INFO: CATALINA_BASE:
>  <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
> Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> INFO: CATALINA_HOME:
>  <homepath>\frameworks\apache-tomee-7.0.1-webprofile\apache-tomee-webprofile-7.0.1
> Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> INFO: Command line argument:
> -Dcatalina.base=<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
> Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> INFO: Command line argument:
> -Dcatalina.home=<homepath>\frameworks\apache-tomee-7.0.1-webprofile\apache-tomee-webprofile-7.0.1
> Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> INFO: Command line argument:
> -Dwtp.deploy=<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
> Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> INFO: Command line argument:
> -Djava.endorsed.dirs=<homepath>\frameworks\apache-tomee-7.0.1-webprofile\apache-tomee-webprofile-7.0.1\endorsed
> Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
> INFO: Command line argument: -Dfile.encoding=Cp1252
> Aug 03, 2016 9:29:40 AM sun.reflect.DelegatingMethodAccessorImpl invoke
> INFO: The APR based Apache Tomcat Native library which allows optimal
> performance in production environments was not found on the
> java.library.path: C:\Program
> Files\Java\jre1.8.0_102\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;c:/Program
> Files/Java/jdk1.8.0_102/bin/../jre/bin/server;c:/Program
> Files/Java/jdk1.8.0_102/bin/../jre/bin;c:/Program
> Files/Java/jdk1.8.0_102/bin/../jre/lib/amd64;c:\Program
> Files\Java\jdk1.8.0_102\bin;C:\Program Files (x86)\RSA SecurID Token
> Common;C:\Program Files (x86)\NVIDIA
> Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program
> Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;C:\Program Files
> (x86)\Intel\OpenCL SDK\3.0\bin\x64;C:\Program
> Files\1E\NomadBranch\;C:\Program Files (x86)\Enterprise
> Vault\EVClient\;c:\Program Files\Java\jdk1.8.0_102\bin;C:\Program
> Files\nodejs\;c:\Users\dk068x\frameworks\gradle-2.14.1-all\gradle-2.14.1\bin;c:\Users\dk068x\frameworks\apache-groovy-sdk-2.4.7\groovy-2.4.7\bin;<homepath>\AppData\Roaming\npm;<homepath>\Desktop;;.
> Aug 03, 2016 9:29:40 AM sun.reflect.DelegatingMethodAccessorImpl invoke
> INFO: Initializing ProtocolHandler ["http-nio-8080"]
> Aug 03, 2016 9:29:41 AM sun.reflect.DelegatingMethodAccessorImpl invoke
> INFO: Using a shared selector for servlet write/read
> Aug 03, 2016 9:29:41 AM sun.reflect.DelegatingMethodAccessorImpl invoke
> INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
> Aug 03, 2016 9:29:41 AM sun.reflect.DelegatingMethodAccessorImpl invoke
> INFO: Using a shared selector for servlet write/read
> Aug 03, 2016 9:29:41 AM org.apache.openejb.util.OptionsLog info
> INFO: Using
> 'openejb.jdbc.datasource-creator=org.apache.tomee.jdbc.TomEEDataSourceCreator'
> Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
> INFO:
> ********************************************************************************
> Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
> INFO: OpenEJB http://tomee.apache.org/
> Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
> INFO: Startup: Wed Aug 03 09:29:41 PDT 2016
> Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
> INFO: Copyright 1999-2016 (C) Apache OpenEJB Project, All Rights Reserved.
> Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
> INFO: Version: 7.0.1
> Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
> INFO: Build date: 20160623
> Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
> INFO: Build time: 12:04
> Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
> INFO:
> ********************************************************************************
> Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
> INFO: openejb.home =
> <homepath>\frameworks\apache-tomee-7.0.1-webprofile\apache-tomee-webprofile-7.0.1
> Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
> INFO: openejb.base =
> <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
> Aug 03, 2016 9:29:41 AM org.apache.openejb.cdi.CdiBuilder initializeOWB
> INFO: Created new singletonService
> org.apache.openejb.cdi.ThreadSingletonServiceImpl@37e547da
> Aug 03, 2016 9:29:41 AM org.apache.openejb.cdi.CdiBuilder initializeOWB
> INFO: Succeeded in installing singleton service
> Aug 03, 2016 9:29:41 AM org.apache.openejb.config.ConfigurationFactory init
> INFO: TomEE configuration file is
> '<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\tomee.xml'
> Aug 03, 2016 9:29:41 AM org.apache.openejb.config.ConfigurationFactory
> configureService
> INFO: Configuring Service(id=Tomcat Security Service,
> type=SecurityService, provider-id=Tomcat Security Service)
> Aug 03, 2016 9:29:41 AM org.apache.openejb.config.ConfigurationFactory
> configureService
> INFO: Configuring Service(id=Default Transaction Manager,
> type=TransactionManager, provider-id=Default Transaction Manager)
> Aug 03, 2016 9:29:41 AM org.apache.openejb.config.ConfigurationFactory
> configureService
> INFO: Configuring Service(id=sus2, type=Resource, provider-id=sus2)
> Aug 03, 2016 9:29:41 AM org.apache.openejb.util.OptionsLog info
> INFO: Using 'openejb.deployments.classpath=false'
> Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> createRecipe
> INFO: Creating TransactionManager(id=Default Transaction Manager)
> Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> createRecipe
> INFO: Creating SecurityService(id=Tomcat Security Service)
> Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> createRecipe
> INFO: Creating Resource(id=sus2)
> Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> unusedProperty
> WARNING: unusedProperty maxActive - sus2
> Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> unusedProperty
> WARNING: unusedProperty maxIdle - sus2
> Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> unusedProperty
> WARNING: unusedProperty maxWait - sus2
> Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> unusedProperty
> WARNING: unusedProperty url - sus2
> Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> unusedProperty
> WARNING: unusedProperty username - sus2
> Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> unusedProperty
> WARNING: unusedProperty password - sus2
> Aug 03, 2016 9:29:41 AM org.apache.openejb.server.ServiceManager initServer
> INFO: Creating ServerService(id=cxf-rs)
> Aug 03, 2016 9:29:41 AM org.apache.openejb.server.SimpleServiceManager
> start
> INFO:   ** Bound Services **
> Aug 03, 2016 9:29:41 AM org.apache.openejb.server.SimpleServiceManager
> printRow
> INFO:   NAME                 IP              PORT
> Aug 03, 2016 9:29:41 AM org.apache.openejb.server.SimpleServiceManager
> start
> INFO: -------
> Aug 03, 2016 9:29:41 AM org.apache.openejb.server.SimpleServiceManager
> start
> INFO: Ready!
> Aug 03, 2016 9:29:41 AM sun.reflect.DelegatingMethodAccessorImpl invoke
> INFO: Initialization processed in 1542 ms
> Aug 03, 2016 9:29:41 AM
> org.apache.tomee.catalina.OpenEJBNamingContextListener bindResource
> INFO: Importing a Tomcat Resource with id 'UserDatabase' of type
> 'org.apache.catalina.UserDatabase'.
> Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> createRecipe
> INFO: Creating Resource(id=UserDatabase)
> Aug 03, 2016 9:29:41 AM sun.reflect.DelegatingMethodAccessorImpl invoke
> INFO: Starting service Catalina
> Aug 03, 2016 9:29:41 AM sun.reflect.DelegatingMethodAccessorImpl invoke
> INFO: Starting Servlet Engine: Apache Tomcat (TomEE)/8.0.8.5.3 (7.0.1)
> Aug 03, 2016 9:29:41 AM org.apache.tomee.catalina.TomcatWebAppBuilder init
> INFO: ------------------------- localhost -> /
> Aug 03, 2016 9:29:41 AM org.apache.openejb.config.ConfigurationFactory
> configureApplication
> INFO: Configuring enterprise application:
> <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT
> Aug 03, 2016 9:29:41 AM org.apache.openejb.config.ConfigurationFactory
> configureService
> INFO: Configuring Service(id=Default Managed Container, type=Container,
> provider-id=Default Managed Container)
> Aug 03, 2016 9:29:41 AM org.apache.openejb.config.AutoConfig
> createContainer
> INFO: Auto-creating a container for bean .Comp483003755:
> Container(type=MANAGED, id=Default Managed Container)
> Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler
> createRecipe
> INFO: Creating Container(id=Default Managed Container)
> Aug 03, 2016 9:29:42 AM org.apache.openejb.core.managed.SimplePassivater
> init
> INFO: Using directory <homepath>\AppData\Local\Temp for stateful session
> passivation
> Aug 03, 2016 9:29:42 AM org.apache.openejb.config.AppInfoBuilder build
> INFO: Enterprise application
> "<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT"
> loaded.
> Aug 03, 2016 9:29:42 AM org.apache.openejb.assembler.classic.Assembler
> createApplication
> INFO: Assembling app:
> <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT
> Aug 03, 2016 9:29:42 AM org.apache.openejb.assembler.classic.Assembler
> createApplication
> INFO: Deployed
> Application(path=<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT)
> Aug 03, 2016 9:29:42 AM org.apache.tomee.catalina.TomcatWebAppBuilder init
> INFO: ------------------------- localhost -> /dumpjndi
> Aug 03, 2016 9:29:42 AM org.apache.openejb.config.ConfigurationFactory
> configureApplication
> INFO: Configuring enterprise application:
> <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\dumpjndi
> Aug 03, 2016 9:29:42 AM org.apache.openejb.config.AppInfoBuilder build
> INFO: Enterprise application
> "<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\dumpjndi"
> loaded.
> Aug 03, 2016 9:29:42 AM org.apache.openejb.assembler.classic.Assembler
> createApplication
> INFO: Assembling app:
> <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\dumpjndi
> Aug 03, 2016 9:29:42 AM org.apache.openejb.assembler.classic.Assembler
> createApplication
> INFO: Deployed
> Application(path=<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\dumpjndi)
> Aug 03, 2016 9:29:42 AM org.apache.tomee.catalina.TomcatWebAppBuilder init
> INFO: ------------------------- localhost -> /webproj
> Aug 03, 2016 9:29:42 AM org.apache.openejb.config.ConfigurationFactory
> configureApplication
> INFO: Configuring enterprise application:
> <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\webproj
> Aug 03, 2016 9:29:42 AM org.apache.openejb.config.AppInfoBuilder build
> INFO: Enterprise application
> "<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\webproj"
> loaded.
> Aug 03, 2016 9:29:42 AM org.apache.openejb.assembler.classic.Assembler
> createApplication
> INFO: Assembling app:
> <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\webproj
> Aug 03, 2016 9:29:42 AM org.apache.openejb.assembler.classic.Assembler
> createApplication
> INFO: Deployed
> Application(path=<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\webproj)
> Aug 03, 2016 9:29:42 AM sun.reflect.DelegatingMethodAccessorImpl invoke
> INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable
> debug logging for this logger for a complete list of JARs that were scanned
> but no TLDs were found in them. Skipping unneeded JARs during scanning can
> improve startup time and JSP compilation time.
> Aug 03, 2016 9:29:42 AM org.apache.catalina.core.ApplicationContext log
> INFO: No Spring WebApplicationInitializer types detected on classpath
> Aug 03, 2016 9:29:43 AM org.apache.catalina.core.ApplicationContext log
> INFO: Initializing Spring root WebApplicationContext
> 2016-08-03 09:29:43,001 INFO  [localhost-startStop-1]
> context.ContextLoader (ContextLoader.java:305) - Root
> WebApplicationContext: initialization started
> 2016-08-03 09:29:43,180 DEBUG [localhost-startStop-1]
> env.MutablePropertySources (MutablePropertySources.java:109) - Adding
> [servletConfigInitParams] PropertySource with lowest search precedence
> 2016-08-03 09:29:43,181 DEBUG [localhost-startStop-1]
> env.MutablePropertySources (MutablePropertySources.java:109) - Adding
> [servletContextInitParams] PropertySource with lowest search precedence
> 2016-08-03 09:29:43,189 DEBUG [localhost-startStop-1]
> env.MutablePropertySources (MutablePropertySources.java:109) - Adding
> [jndiProperties] PropertySource with lowest search precedence
> 2016-08-03 09:29:43,190 DEBUG [localhost-startStop-1]
> env.MutablePropertySources (MutablePropertySources.java:109) - Adding
> [systemProperties] PropertySource with lowest search precedence
> 2016-08-03 09:29:43,190 DEBUG [localhost-startStop-1]
> env.MutablePropertySources (MutablePropertySources.java:109) - Adding
> [systemEnvironment] PropertySource with lowest search precedence
> 2016-08-03 09:29:43,190 DEBUG [localhost-startStop-1]
> env.AbstractEnvironment (AbstractEnvironment.java:127) - Initialized
> StandardServletEnvironment with PropertySources
> [servletConfigInitParams,servletContextInitParams,jndiProperties,systemProperties,systemEnvironment]
> 2016-08-03 09:29:43,204 DEBUG [localhost-startStop-1]
> env.MutablePropertySources (MutablePropertySources.java:174) - Replacing
> [servletContextInitParams] PropertySource with [servletContextInitParams]
> 2016-08-03 09:29:43,210 INFO  [localhost-startStop-1]
> support.AbstractApplicationContext (AbstractApplicationContext.java:581) -
> Refreshing Root WebApplicationContext: startup date [Wed Aug 03 09:29:43
> PDT 2016]; root of context hierarchy
> 2016-08-03 09:29:43,293 INFO  [localhost-startStop-1]
> xml.XmlBeanDefinitionReader (XmlBeanDefinitionReader.java:317) - Loading
> XML bean definitions from ServletContext resource
> [/WEB-INF/applicationContext.xml]
> 2016-08-03 09:29:43,381 INFO  [localhost-startStop-1]
> xml.XmlBeanDefinitionReader (XmlBeanDefinitionReader.java:317) - Loading
> XML bean definitions from class path resource [META-INF/cxf/cxf.xml]
> 2016-08-03 09:29:43,409 INFO  [localhost-startStop-1]
> xml.XmlBeanDefinitionReader (XmlBeanDefinitionReader.java:317) - Loading
> XML bean definitions from class path resource [META-INF/cxf/cxf-servlet.xml]
> 2016-08-03 09:29:43,490 INFO  [localhost-startStop-1]
> support.DefaultListableBeanFactory (DefaultListableBeanFactory.java:843) -
> Overriding bean definition for bean 'webproj' with a different definition:
> replacing [Generic bean: class
> [org.apache.cxf.jaxrs.spring.JAXRSServerFactoryBeanDefinitionParser$SpringJAXRSServerFactoryBean];
> scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0;
> autowireCandidate=true; primary=false; factoryBeanName=null;
> factoryMethodName=null; initMethodName=create; destroyMethodName=destroy]
> with [Generic bean: class [com.att.webproj.services.WebProjController];
> scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0;
> autowireCandidate=true; primary=false; factoryBeanName=null;
> factoryMethodName=null; initMethodName=null; destroyMethodName=null;
> defined in ServletContext resource [/WEB-INF/applicationContext.xml]]
> 2016-08-03 09:29:43,512 DEBUG [localhost-startStop-1]
> support.AbstractApplicationContext (AbstractApplicationContext.java:615) -
> Bean factory for Root WebApplicationContext:
> org.springframework.beans.factory.support.DefaultListableBeanFactory@693a3417:
> defining beans
> [cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,webproj,sus2ds,com.att.webproj.dao.OrdersDAO#0];
> root of factory hierarchy
> 2016-08-03 09:29:43,633 DEBUG [localhost-startStop-1]
> support.AbstractApplicationContext (AbstractApplicationContext.java:728) -
> Unable to locate MessageSource with name 'messageSource': using default
> [org.springframework.context.support.DelegatingMessageSource@741ac774]
> 2016-08-03 09:29:43,637 DEBUG [localhost-startStop-1]
> support.AbstractApplicationContext (AbstractApplicationContext.java:752) -
> Unable to locate ApplicationEventMulticaster with name
> 'applicationEventMulticaster': using default
> [org.springframework.context.event.SimpleApplicationEventMulticaster@a6b8658
> ]
> 2016-08-03 09:29:43,864 WARN  [localhost-startStop-1]
> support.AbstractApplicationContext (AbstractApplicationContext.java:549) -
> Exception encountered during context initialization - cancelling refresh
> attempt: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'sus2ds': Invocation of init method failed; nested
> exception is javax.naming.NameNotFoundException: Name [sus2] is not bound
> in this Context. Unable to find [sus2].
> 2016-08-03 09:29:43,868 ERROR [localhost-startStop-1]
> context.ContextLoader (ContextLoader.java:351) - Context initialization
> failed
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'sus2ds': Invocation of init method failed; nested exception
> is javax.naming.NameNotFoundException: Name [sus2] is not bound in this
> Context. Unable to find [sus2].
> ---------------
>
> > - about maven: ${user.home}/.m2/repository is the default base, you can
> > override it to openejb.m2.home system property (in
> > conf/system.properties for instance). If this folder doesn't exist we'll
> > read the default settings.xml to get the localRespository value.
>
> Ok, so just to be clear, the "mvn:" prefix is only going to search a local
> repository.  It's not going to go to MavenCentral or anything like that.
> The doc doesn't say anything at all about this.  We need to find a
> reasonable way to document this.
>
>
It does a http request if the local lookup fails. Default http base is
central if the version is a release and apache snapshot one if the version
is a snapshot. This repo url can be customized specifying it in the mvn url
(mv:http://company.com/maven2!groupId:artifactId:version)


> Please give me more information about everything that happens after "if
> this folder doesn't exist".
>

The very detail can be found
in org.apache.openejb.loader.provisining.MavenResolver#quickMvnUrl method.


>
> > - about your "strange" error: tomee Resource attributes are about the
> > resource factory and body of Resource tag is the list of properties used
> > to set instance attributes. Tomcat put everything as attributes. This is
> > why you got this error.
>
> Understood.  The notion of "attributes" vs. "properties" is lost on many
> people.  I understand that they are different, but it needs to be clear in
> the doc and in the messages.
>
> > - last point: we support some bridge between historical tomee
> > definitions and tomcat datasources (to make the migration smooth) so you
> > can still use JdbcDriver, UserName, Password, JdbcUrl:
> >
> > <Resource id="jdbc/sus2" type="DataSource" classpath="mvn:oracle:ojdbc6:
> > 11.2.0.3">
> >     JdbcDriver = oracle.jdbc.driver.OracleDriver
> >     MaxActive = 5
> >     MaxIdle = 2
> >     MaxWait = 10000
> >     JdbcUrl = jdbc:oracle:thin:@<host>:1521:<sid>
> >     UserName = <userid>
> >     Password = <password>
> >   </Resource>
> >
> > Advantage of keeping these properties is the same definition will run
> > with openejb (understand tomee without tomcat and embedded) which is a
> > great way to debug a weird case reusing the same data as in tomee.
>
> And what parts of this are "historical tome definitions" and "tomcat
> datasources"?  How would someone know which properties/attributes are
> "historical"?  Many people using Tomcat or TomEE for the first time know
> nothing about this history.
>
>
The conversion is done there -
https://github.com/apache/tomee/blob/master/tomee/tomee-jdbc/src/main/java/org/apache/tomee/jdbc/TomEEDataSourceCreator.java#L87
- and as you can see we try to override if missing only making both cases
working.


> > 2016-08-03 1:21 GMT+02:00 KARR, DAVID <dk...@att.com>:
> >
> > > I may be making some progress.  Working from
> > > http://tomee.apache.org/tomee-and-eclipse.html , it appears that the
> > > "tomeee.xml" file that I edited in the Tomee distro is not used in
> > > Eclipse.  I used the "Import" feature as described to copy the file
> > into
> > > the server defined in Eclipse.   At that point, I got an error like
> > this:
> > > ---------------------
> > > org.apache.openejb.OpenEJBException:
> > > Unable to read OpenEJB configuration file at
> > >
> > <workspace>\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\tom
> > ee.xml:
> > > Unsupported Attribute(s): maxActive, maxIdle, maxWait,
> > > driverClassName, url, username, password.
> > > Supported Attributes are: type, jar, provider, id, class-name,
> > > constructor, factory-name, classpath, jndi, aliases,
> > > properties-provider, property-provider, depends-on.  If the setting is
> > > a configuration property it must be placed inside the element body.
> > > ---------------------
> > >
> > > Really strange.
> > >
> > > I then modified the imported "tomee.xml" file, resulting in the
> > > following approximate Resource definition:
> > > --------------------
> > > <Resource id="jdbc/sus2" type="DataSource"
> > > classpath="mvn:oracle:ojdbc6:11.2.0.3"
> > >             class-name="oracle.jdbc.driver.OracleDriver">
> > >             maxActive = 5
> > >             maxIdle = 2
> > >             maxWait = 10000
> > >             url = jdbc:oracle:thin:@<host>:1521:<sid>
> > >             username = <userid>
> > >             password = <password>
> > >   </Resource>
> > > --------------
> > >
> > > When I start up the server, I see the following in the console:
> > > ------------------
> > > Aug 02, 2016 4:13:03 PM org.apache.openejb.config.ConfigurationFactory
> > > configureService
> > > INFO: Configuring Service(id=jdbc/sus2, type=Resource,
> > > provider-id=jdbc/sus2)
> > > Aug 02, 2016 4:13:03 PM org.apache.openejb.util.OptionsLog info
> > > INFO: Using 'openejb.deployments.classpath=false'
> > > Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> > > createRecipe
> > > INFO: Creating TransactionManager(id=Default Transaction Manager) Aug
> > > 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> > > createRecipe
> > > INFO: Creating SecurityService(id=Tomcat Security Service) Aug 02,
> > > 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> > > createRecipe
> > > INFO: Creating Resource(id=jdbc/sus2)
> > > Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> > > unusedProperty
> > > WARNING: unusedProperty maxActive - jdbc/sus2 Aug 02, 2016 4:13:03 PM
> > > org.apache.openejb.assembler.classic.Assembler
> > > unusedProperty
> > > WARNING: unusedProperty maxIdle - jdbc/sus2 Aug 02, 2016 4:13:03 PM
> > > org.apache.openejb.assembler.classic.Assembler
> > > unusedProperty
> > > WARNING: unusedProperty maxWait - jdbc/sus2 Aug 02, 2016 4:13:03 PM
> > > org.apache.openejb.assembler.classic.Assembler
> > > unusedProperty
> > > WARNING: unusedProperty url - jdbc/sus2 Aug 02, 2016 4:13:03 PM
> > > org.apache.openejb.assembler.classic.Assembler
> > > unusedProperty
> > > WARNING: unusedProperty username - jdbc/sus2 Aug 02, 2016 4:13:03 PM
> > > org.apache.openejb.assembler.classic.Assembler
> > > unusedProperty
> > > WARNING: unusedProperty password - jdbc/sus2
> > > -----------------
> > >
> > > I don't understand what "unusedProperty" means (weird that it's just
> > > one word).
> > >
> > > When I later try to reference that resource, I get the following:
> > > --------------------
> > > javax.naming.NameNotFoundException: Name [jdbc/sus2] is not bound in
> > > this Context. Unable to find [jdbc].
> > > --------------------
> > >
> > > It's not clear to me whether that Resource definition put anything
> > > into the JNDI context, or whether I'm just using the wrong JNDI path
> > > to reference it.
> > >
> > > -----Original Message-----
> > > From: Daniel Cunha [mailto:danielsoro@gmail.com]
> > > Sent: Tuesday, August 02, 2016 2:10 PM
> > > To: TomEE Users <us...@tomee.apache.org>
> > > Subject: Re: Define datasource, reference JDBC driver, and see init in
> > > console
> > >
> > > Hi David,
> > >
> > > yea, resources on TomEE is a mix (XML/Properties) Your definition
> > > should following the pattern:
> > >  <Resource id="jdbc/sus2" type="DataSource">
> > >             maxActive = 5
> > >             maxIdle = 2
> > >             maxWait = 10000
> > >             driverClassName = oracle.jdbc.driver.OracleDriver
> > >             url = jdbc:oracle:thin:@<host>:1521:<sid>
> > >             username = <user>
> > >             password = <password>
> > > </Resource>
> > >
> > > References you can see here:
> > > http://tomee.apache.org/datasource-config.html
> > > About maven, should be enough have the configuration in your
> > settings.xml.
> > > :)
> > >
> > > On Tue, Aug 2, 2016 at 5:52 PM, KARR, DAVID <dk...@att.com> wrote:
> > >
> > > > (I posted this first to tomcat-user, but I realized technically it
> > > > should go to tomee-user.  I apologize if this is a duplicate for
> > you.
> > > > In any case, this note has a little more info than the first note.)
> > > >
> > > > I'm attempting to use Tomcat(tomee) to run a REST service that will
> > > > return some data from some SQL queries (Oracle).  I've installed
> > > > Tomee 7.0.1, which uses Tomcat 8.5.3.
> > > >
> > > > The JDBC driver is available from a private enterprise maven repo.
> > > > I'd prefer to get it from there, as opposed to storing it locally.
> > > > I noticed at http://tomee.apache.org/configuring-datasources.html ,
> > > > there is the possible notation of "mvn:g:a:v" for the "classpath"
> > > > attribute.  However, I don't see any way to configure the Maven
> > > repositories this will reference.
> > > > How do I tell it to look in a particular repo for this?  Would it
> > > > just implicitly use my $HOME/.m2/settings.xml file?
> > > >
> > > > My Resource definition in "conf/tomee.xml" looks something like
> > this:
> > > > -----------------------
> > > >   <Resource id="jdbc/sus2" type="DataSource"
> > > >             maxActive="5" maxIdle="2" maxWait="10000"
> > > >             driverClassName="oracle.jdbc.driver.OracleDriver"
> > > >             url="jdbc:oracle:thin:@<host>:1521:<sid>"
> > > >             username="<user>" password="<password>"/>
> > > > ----------------
> > > >
> > > > Does this look correct?  I find the Tomcat docs confusing, with
> > > > respect to the required syntax for this.  It's not clear whether a
> > > > pure XML syntax is required, or a mixed XML/property syntax.
> > > >
> > > > If I start the instance, should I see any default output that will
> > > > show Tomcat connecting to this datasource?  If it doesn't show this
> > > > by default, is there a way to turn this on?
> > > >
> > > > I tried writing the code to obtain the JNDI resource (Spring context
> > > > references), but it just says it can't find it (fails at "jdbc"), so
> > > > perhaps my Resource definition was ignored, or my JNDI path is
> > wrong.
> > > >
> > >
> > >
> > >
> > > --
> > > Daniel Cunha
> > > https://twitter.com/dvlc_
> > > http://www.tomitribe.com
> > > http://www.tomitribe.io
> > >
>

RE: Define datasource, reference JDBC driver, and see init in console

Posted by "KARR, DAVID" <dk...@att.com>.
> -----Original Message-----
> From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> Sent: Tuesday, August 02, 2016 11:53 PM
> To: users@tomee.apache.org
> Subject: Re: Define datasource, reference JDBC driver, and see init in
> console
> 
> Hello

Thanks for replying.  There's a lot of information and questions in my reply.  My priority is getting the JNDI reference working.

> Before digging deeper in your problem a small note on this one: since
> you encounter some issue with the doc I would love you to try to
> enrich/rewrite some part of it to make it smoother for next newcomer.
> Would it be possible?

Sure, it's possible.  I've worked on the docs for many frameworks that I've only been a user for.  Just as long as you realize that I can only write what I know about.  My only source of knowledge is the docs themselves, and what I learn here.  I'll never forget the unnamed framework I was using, where I discovered accidentally that there was at least one completely undocumented feature, and the author stated that I'm welcome to submit PRs, which I responded to with "Sure, any other undocumented features you want me to document?"

However, my priority is getting this little app working, so the doc work is secondary.

> Next about your issue:
> 
> - you don't need to set class-name which is intended for custom
> resources (DataSource are "known" resources)

The message said this attribute is supported.  If you're going to support it, you need to say SOMEWHERE what it's for. Except for in this error message, I can't find this attribute described anywhere.

I would say the same thing for every single attribute mentioned in that message.  If it's not mentioned in the doc, it needs to be, so I'd like to understand what it's for, and where in the docs you THINK it should be documented.

Also, I'd like clarification on this distinction between XML attributes and properties.  Apparently some things can be set in XML attributes, and some things have to be set in properties.  Except by "example", what are the details of what goes in an XML attribute, and what goes in a property.

> - unusedProperty is one word cause it is a method name (we can surely
> enrich the message BTW). Means you set a property but this one doesn't
> exist on the created instance (the connection pool there). That's one
> smooth way to say the configuration is wrong but doesn't prevent to run.

This isn't a doc problem, it's a problem with the message.  That message definitely needs to be cleaned up.

> - using jdbc/sus2 you can use @Resource(name = "jdbc/sus2") DataSource
> ds; or do a lookup on openejb:Resource/jdbc/sus2 or
> java:openejb/Resource/
> jdbc/sus2

This is my core problem, which I have to solve.  This is a VFAQ about JNDI, in my view.  It's easy to define a name for something, but all JNDI systems put "magic prefixes" on all the entities that go into the JNDI registry, that make it difficult for users to figure out what the actual names are.

I originally tried "jdbc/sus2".  That failed to find "jdbc".  I tried changing the resource name to just "sus2" and tried looking up "java:comp/env/sus2".  That says it failed to find "sus2".

I'm including here an excerpt of the console output, which shows the "sus2" resource being defined, and the later looking for "java:comp/env/sus2", saying that "sus2" is not found.
--------------------------
Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:webproj' did not find a matching property.
Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:dumpjndi' did not find a matching property.
Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
INFO: Server version:        Apache Tomcat (TomEE)/8.0.8.5.3 (7.0.1)
Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
INFO: Server built:          Jun 9 2016 11:16:29 UTC
Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
INFO: Server number:         8.5.3.0
Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
INFO: OS Name:               Windows 7
Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
INFO: OS Version:            6.1
Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
INFO: Architecture:          amd64
Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
INFO: Java Home:             C:\Program Files\Java\jre1.8.0_102
Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
INFO: JVM Version:           1.8.0_102-b14
Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
INFO: JVM Vendor:            Oracle Corporation
Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
INFO: CATALINA_BASE:         <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
INFO: CATALINA_HOME:         <homepath>\frameworks\apache-tomee-7.0.1-webprofile\apache-tomee-webprofile-7.0.1
Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
INFO: Command line argument: -Dcatalina.base=<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
INFO: Command line argument: -Dcatalina.home=<homepath>\frameworks\apache-tomee-7.0.1-webprofile\apache-tomee-webprofile-7.0.1
Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
INFO: Command line argument: -Dwtp.deploy=<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
INFO: Command line argument: -Djava.endorsed.dirs=<homepath>\frameworks\apache-tomee-7.0.1-webprofile\apache-tomee-webprofile-7.0.1\endorsed
Aug 03, 2016 9:29:40 AM sun.reflect.NativeMethodAccessorImpl invoke
INFO: Command line argument: -Dfile.encoding=Cp1252
Aug 03, 2016 9:29:40 AM sun.reflect.DelegatingMethodAccessorImpl invoke
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.8.0_102\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;c:/Program Files/Java/jdk1.8.0_102/bin/../jre/bin/server;c:/Program Files/Java/jdk1.8.0_102/bin/../jre/bin;c:/Program Files/Java/jdk1.8.0_102/bin/../jre/lib/amd64;c:\Program Files\Java\jdk1.8.0_102\bin;C:\Program Files (x86)\RSA SecurID Token Common;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;C:\Program Files\1E\NomadBranch\;C:\Program Files (x86)\Enterprise Vault\EVClient\;c:\Program Files\Java\jdk1.8.0_102\bin;C:\Program Files\nodejs\;c:\Users\dk068x\frameworks\gradle-2.14.1-all\gradle-2.14.1\bin;c:\Users\dk068x\frameworks\apache-groovy-sdk-2.4.7\groovy-2.4.7\bin;<homepath>\AppData\Roaming\npm;<homepath>\Desktop;;.
Aug 03, 2016 9:29:40 AM sun.reflect.DelegatingMethodAccessorImpl invoke
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Aug 03, 2016 9:29:41 AM sun.reflect.DelegatingMethodAccessorImpl invoke
INFO: Using a shared selector for servlet write/read
Aug 03, 2016 9:29:41 AM sun.reflect.DelegatingMethodAccessorImpl invoke
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
Aug 03, 2016 9:29:41 AM sun.reflect.DelegatingMethodAccessorImpl invoke
INFO: Using a shared selector for servlet write/read
Aug 03, 2016 9:29:41 AM org.apache.openejb.util.OptionsLog info
INFO: Using 'openejb.jdbc.datasource-creator=org.apache.tomee.jdbc.TomEEDataSourceCreator'
Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
INFO: ********************************************************************************
Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
INFO: OpenEJB http://tomee.apache.org/
Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
INFO: Startup: Wed Aug 03 09:29:41 PDT 2016
Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
INFO: Copyright 1999-2016 (C) Apache OpenEJB Project, All Rights Reserved.
Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
INFO: Version: 7.0.1
Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
INFO: Build date: 20160623
Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
INFO: Build time: 12:04
Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
INFO: ********************************************************************************
Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
INFO: openejb.home = <homepath>\frameworks\apache-tomee-7.0.1-webprofile\apache-tomee-webprofile-7.0.1
Aug 03, 2016 9:29:41 AM org.apache.openejb.OpenEJB$Instance <init>
INFO: openejb.base = <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Aug 03, 2016 9:29:41 AM org.apache.openejb.cdi.CdiBuilder initializeOWB
INFO: Created new singletonService org.apache.openejb.cdi.ThreadSingletonServiceImpl@37e547da
Aug 03, 2016 9:29:41 AM org.apache.openejb.cdi.CdiBuilder initializeOWB
INFO: Succeeded in installing singleton service
Aug 03, 2016 9:29:41 AM org.apache.openejb.config.ConfigurationFactory init
INFO: TomEE configuration file is '<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\tomee.xml'
Aug 03, 2016 9:29:41 AM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=Tomcat Security Service, type=SecurityService, provider-id=Tomcat Security Service)
Aug 03, 2016 9:29:41 AM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
Aug 03, 2016 9:29:41 AM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=sus2, type=Resource, provider-id=sus2)
Aug 03, 2016 9:29:41 AM org.apache.openejb.util.OptionsLog info
INFO: Using 'openejb.deployments.classpath=false'
Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating TransactionManager(id=Default Transaction Manager)
Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating SecurityService(id=Tomcat Security Service)
Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Resource(id=sus2)
Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler unusedProperty
WARNING: unusedProperty maxActive - sus2
Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler unusedProperty
WARNING: unusedProperty maxIdle - sus2
Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler unusedProperty
WARNING: unusedProperty maxWait - sus2
Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler unusedProperty
WARNING: unusedProperty url - sus2
Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler unusedProperty
WARNING: unusedProperty username - sus2
Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler unusedProperty
WARNING: unusedProperty password - sus2
Aug 03, 2016 9:29:41 AM org.apache.openejb.server.ServiceManager initServer
INFO: Creating ServerService(id=cxf-rs)
Aug 03, 2016 9:29:41 AM org.apache.openejb.server.SimpleServiceManager start
INFO:   ** Bound Services **
Aug 03, 2016 9:29:41 AM org.apache.openejb.server.SimpleServiceManager printRow
INFO:   NAME                 IP              PORT  
Aug 03, 2016 9:29:41 AM org.apache.openejb.server.SimpleServiceManager start
INFO: -------
Aug 03, 2016 9:29:41 AM org.apache.openejb.server.SimpleServiceManager start
INFO: Ready!
Aug 03, 2016 9:29:41 AM sun.reflect.DelegatingMethodAccessorImpl invoke
INFO: Initialization processed in 1542 ms
Aug 03, 2016 9:29:41 AM org.apache.tomee.catalina.OpenEJBNamingContextListener bindResource
INFO: Importing a Tomcat Resource with id 'UserDatabase' of type 'org.apache.catalina.UserDatabase'.
Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Resource(id=UserDatabase)
Aug 03, 2016 9:29:41 AM sun.reflect.DelegatingMethodAccessorImpl invoke
INFO: Starting service Catalina
Aug 03, 2016 9:29:41 AM sun.reflect.DelegatingMethodAccessorImpl invoke
INFO: Starting Servlet Engine: Apache Tomcat (TomEE)/8.0.8.5.3 (7.0.1)
Aug 03, 2016 9:29:41 AM org.apache.tomee.catalina.TomcatWebAppBuilder init
INFO: ------------------------- localhost -> /
Aug 03, 2016 9:29:41 AM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT
Aug 03, 2016 9:29:41 AM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container)
Aug 03, 2016 9:29:41 AM org.apache.openejb.config.AutoConfig createContainer
INFO: Auto-creating a container for bean .Comp483003755: Container(type=MANAGED, id=Default Managed Container)
Aug 03, 2016 9:29:41 AM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Container(id=Default Managed Container)
Aug 03, 2016 9:29:42 AM org.apache.openejb.core.managed.SimplePassivater init
INFO: Using directory <homepath>\AppData\Local\Temp for stateful session passivation
Aug 03, 2016 9:29:42 AM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application "<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT" loaded.
Aug 03, 2016 9:29:42 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Assembling app: <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT
Aug 03, 2016 9:29:42 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Deployed Application(path=<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT)
Aug 03, 2016 9:29:42 AM org.apache.tomee.catalina.TomcatWebAppBuilder init
INFO: ------------------------- localhost -> /dumpjndi
Aug 03, 2016 9:29:42 AM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\dumpjndi
Aug 03, 2016 9:29:42 AM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application "<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\dumpjndi" loaded.
Aug 03, 2016 9:29:42 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Assembling app: <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\dumpjndi
Aug 03, 2016 9:29:42 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Deployed Application(path=<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\dumpjndi)
Aug 03, 2016 9:29:42 AM org.apache.tomee.catalina.TomcatWebAppBuilder init
INFO: ------------------------- localhost -> /webproj
Aug 03, 2016 9:29:42 AM org.apache.openejb.config.ConfigurationFactory configureApplication
INFO: Configuring enterprise application: <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\webproj
Aug 03, 2016 9:29:42 AM org.apache.openejb.config.AppInfoBuilder build
INFO: Enterprise application "<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\webproj" loaded.
Aug 03, 2016 9:29:42 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Assembling app: <homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\webproj
Aug 03, 2016 9:29:42 AM org.apache.openejb.assembler.classic.Assembler createApplication
INFO: Deployed Application(path=<homepath>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\webproj)
Aug 03, 2016 9:29:42 AM sun.reflect.DelegatingMethodAccessorImpl invoke
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Aug 03, 2016 9:29:42 AM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Aug 03, 2016 9:29:43 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
2016-08-03 09:29:43,001 INFO  [localhost-startStop-1] context.ContextLoader (ContextLoader.java:305) - Root WebApplicationContext: initialization started
2016-08-03 09:29:43,180 DEBUG [localhost-startStop-1] env.MutablePropertySources (MutablePropertySources.java:109) - Adding [servletConfigInitParams] PropertySource with lowest search precedence
2016-08-03 09:29:43,181 DEBUG [localhost-startStop-1] env.MutablePropertySources (MutablePropertySources.java:109) - Adding [servletContextInitParams] PropertySource with lowest search precedence
2016-08-03 09:29:43,189 DEBUG [localhost-startStop-1] env.MutablePropertySources (MutablePropertySources.java:109) - Adding [jndiProperties] PropertySource with lowest search precedence
2016-08-03 09:29:43,190 DEBUG [localhost-startStop-1] env.MutablePropertySources (MutablePropertySources.java:109) - Adding [systemProperties] PropertySource with lowest search precedence
2016-08-03 09:29:43,190 DEBUG [localhost-startStop-1] env.MutablePropertySources (MutablePropertySources.java:109) - Adding [systemEnvironment] PropertySource with lowest search precedence
2016-08-03 09:29:43,190 DEBUG [localhost-startStop-1] env.AbstractEnvironment (AbstractEnvironment.java:127) - Initialized StandardServletEnvironment with PropertySources [servletConfigInitParams,servletContextInitParams,jndiProperties,systemProperties,systemEnvironment]
2016-08-03 09:29:43,204 DEBUG [localhost-startStop-1] env.MutablePropertySources (MutablePropertySources.java:174) - Replacing [servletContextInitParams] PropertySource with [servletContextInitParams]
2016-08-03 09:29:43,210 INFO  [localhost-startStop-1] support.AbstractApplicationContext (AbstractApplicationContext.java:581) - Refreshing Root WebApplicationContext: startup date [Wed Aug 03 09:29:43 PDT 2016]; root of context hierarchy
2016-08-03 09:29:43,293 INFO  [localhost-startStop-1] xml.XmlBeanDefinitionReader (XmlBeanDefinitionReader.java:317) - Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
2016-08-03 09:29:43,381 INFO  [localhost-startStop-1] xml.XmlBeanDefinitionReader (XmlBeanDefinitionReader.java:317) - Loading XML bean definitions from class path resource [META-INF/cxf/cxf.xml]
2016-08-03 09:29:43,409 INFO  [localhost-startStop-1] xml.XmlBeanDefinitionReader (XmlBeanDefinitionReader.java:317) - Loading XML bean definitions from class path resource [META-INF/cxf/cxf-servlet.xml]
2016-08-03 09:29:43,490 INFO  [localhost-startStop-1] support.DefaultListableBeanFactory (DefaultListableBeanFactory.java:843) - Overriding bean definition for bean 'webproj' with a different definition: replacing [Generic bean: class [org.apache.cxf.jaxrs.spring.JAXRSServerFactoryBeanDefinitionParser$SpringJAXRSServerFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=create; destroyMethodName=destroy] with [Generic bean: class [com.att.webproj.services.WebProjController]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext.xml]]
2016-08-03 09:29:43,512 DEBUG [localhost-startStop-1] support.AbstractApplicationContext (AbstractApplicationContext.java:615) - Bean factory for Root WebApplicationContext: org.springframework.beans.factory.support.DefaultListableBeanFactory@693a3417: defining beans [cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,webproj,sus2ds,com.att.webproj.dao.OrdersDAO#0]; root of factory hierarchy
2016-08-03 09:29:43,633 DEBUG [localhost-startStop-1] support.AbstractApplicationContext (AbstractApplicationContext.java:728) - Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@741ac774]
2016-08-03 09:29:43,637 DEBUG [localhost-startStop-1] support.AbstractApplicationContext (AbstractApplicationContext.java:752) - Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@a6b8658]
2016-08-03 09:29:43,864 WARN  [localhost-startStop-1] support.AbstractApplicationContext (AbstractApplicationContext.java:549) - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sus2ds': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [sus2] is not bound in this Context. Unable to find [sus2].
2016-08-03 09:29:43,868 ERROR [localhost-startStop-1] context.ContextLoader (ContextLoader.java:351) - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sus2ds': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [sus2] is not bound in this Context. Unable to find [sus2].
---------------

> - about maven: ${user.home}/.m2/repository is the default base, you can
> override it to openejb.m2.home system property (in
> conf/system.properties for instance). If this folder doesn't exist we'll
> read the default settings.xml to get the localRespository value.

Ok, so just to be clear, the "mvn:" prefix is only going to search a local repository.  It's not going to go to MavenCentral or anything like that.  The doc doesn't say anything at all about this.  We need to find a reasonable way to document this.

Please give me more information about everything that happens after "if this folder doesn't exist".

> - about your "strange" error: tomee Resource attributes are about the
> resource factory and body of Resource tag is the list of properties used
> to set instance attributes. Tomcat put everything as attributes. This is
> why you got this error.

Understood.  The notion of "attributes" vs. "properties" is lost on many people.  I understand that they are different, but it needs to be clear in the doc and in the messages.

> - last point: we support some bridge between historical tomee
> definitions and tomcat datasources (to make the migration smooth) so you
> can still use JdbcDriver, UserName, Password, JdbcUrl:
> 
> <Resource id="jdbc/sus2" type="DataSource" classpath="mvn:oracle:ojdbc6:
> 11.2.0.3">
>     JdbcDriver = oracle.jdbc.driver.OracleDriver
>     MaxActive = 5
>     MaxIdle = 2
>     MaxWait = 10000
>     JdbcUrl = jdbc:oracle:thin:@<host>:1521:<sid>
>     UserName = <userid>
>     Password = <password>
>   </Resource>
> 
> Advantage of keeping these properties is the same definition will run
> with openejb (understand tomee without tomcat and embedded) which is a
> great way to debug a weird case reusing the same data as in tomee.

And what parts of this are "historical tome definitions" and "tomcat datasources"?  How would someone know which properties/attributes are "historical"?  Many people using Tomcat or TomEE for the first time know nothing about this history.

> 2016-08-03 1:21 GMT+02:00 KARR, DAVID <dk...@att.com>:
> 
> > I may be making some progress.  Working from
> > http://tomee.apache.org/tomee-and-eclipse.html , it appears that the
> > "tomeee.xml" file that I edited in the Tomee distro is not used in
> > Eclipse.  I used the "Import" feature as described to copy the file
> into
> > the server defined in Eclipse.   At that point, I got an error like
> this:
> > ---------------------
> > org.apache.openejb.OpenEJBException:
> > Unable to read OpenEJB configuration file at
> >
> <workspace>\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\tom
> ee.xml:
> > Unsupported Attribute(s): maxActive, maxIdle, maxWait,
> > driverClassName, url, username, password.
> > Supported Attributes are: type, jar, provider, id, class-name,
> > constructor, factory-name, classpath, jndi, aliases,
> > properties-provider, property-provider, depends-on.  If the setting is
> > a configuration property it must be placed inside the element body.
> > ---------------------
> >
> > Really strange.
> >
> > I then modified the imported "tomee.xml" file, resulting in the
> > following approximate Resource definition:
> > --------------------
> > <Resource id="jdbc/sus2" type="DataSource"
> > classpath="mvn:oracle:ojdbc6:11.2.0.3"
> >             class-name="oracle.jdbc.driver.OracleDriver">
> >             maxActive = 5
> >             maxIdle = 2
> >             maxWait = 10000
> >             url = jdbc:oracle:thin:@<host>:1521:<sid>
> >             username = <userid>
> >             password = <password>
> >   </Resource>
> > --------------
> >
> > When I start up the server, I see the following in the console:
> > ------------------
> > Aug 02, 2016 4:13:03 PM org.apache.openejb.config.ConfigurationFactory
> > configureService
> > INFO: Configuring Service(id=jdbc/sus2, type=Resource,
> > provider-id=jdbc/sus2)
> > Aug 02, 2016 4:13:03 PM org.apache.openejb.util.OptionsLog info
> > INFO: Using 'openejb.deployments.classpath=false'
> > Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> > createRecipe
> > INFO: Creating TransactionManager(id=Default Transaction Manager) Aug
> > 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> > createRecipe
> > INFO: Creating SecurityService(id=Tomcat Security Service) Aug 02,
> > 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> > createRecipe
> > INFO: Creating Resource(id=jdbc/sus2)
> > Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> > unusedProperty
> > WARNING: unusedProperty maxActive - jdbc/sus2 Aug 02, 2016 4:13:03 PM
> > org.apache.openejb.assembler.classic.Assembler
> > unusedProperty
> > WARNING: unusedProperty maxIdle - jdbc/sus2 Aug 02, 2016 4:13:03 PM
> > org.apache.openejb.assembler.classic.Assembler
> > unusedProperty
> > WARNING: unusedProperty maxWait - jdbc/sus2 Aug 02, 2016 4:13:03 PM
> > org.apache.openejb.assembler.classic.Assembler
> > unusedProperty
> > WARNING: unusedProperty url - jdbc/sus2 Aug 02, 2016 4:13:03 PM
> > org.apache.openejb.assembler.classic.Assembler
> > unusedProperty
> > WARNING: unusedProperty username - jdbc/sus2 Aug 02, 2016 4:13:03 PM
> > org.apache.openejb.assembler.classic.Assembler
> > unusedProperty
> > WARNING: unusedProperty password - jdbc/sus2
> > -----------------
> >
> > I don't understand what "unusedProperty" means (weird that it's just
> > one word).
> >
> > When I later try to reference that resource, I get the following:
> > --------------------
> > javax.naming.NameNotFoundException: Name [jdbc/sus2] is not bound in
> > this Context. Unable to find [jdbc].
> > --------------------
> >
> > It's not clear to me whether that Resource definition put anything
> > into the JNDI context, or whether I'm just using the wrong JNDI path
> > to reference it.
> >
> > -----Original Message-----
> > From: Daniel Cunha [mailto:danielsoro@gmail.com]
> > Sent: Tuesday, August 02, 2016 2:10 PM
> > To: TomEE Users <us...@tomee.apache.org>
> > Subject: Re: Define datasource, reference JDBC driver, and see init in
> > console
> >
> > Hi David,
> >
> > yea, resources on TomEE is a mix (XML/Properties) Your definition
> > should following the pattern:
> >  <Resource id="jdbc/sus2" type="DataSource">
> >             maxActive = 5
> >             maxIdle = 2
> >             maxWait = 10000
> >             driverClassName = oracle.jdbc.driver.OracleDriver
> >             url = jdbc:oracle:thin:@<host>:1521:<sid>
> >             username = <user>
> >             password = <password>
> > </Resource>
> >
> > References you can see here:
> > http://tomee.apache.org/datasource-config.html
> > About maven, should be enough have the configuration in your
> settings.xml.
> > :)
> >
> > On Tue, Aug 2, 2016 at 5:52 PM, KARR, DAVID <dk...@att.com> wrote:
> >
> > > (I posted this first to tomcat-user, but I realized technically it
> > > should go to tomee-user.  I apologize if this is a duplicate for
> you.
> > > In any case, this note has a little more info than the first note.)
> > >
> > > I'm attempting to use Tomcat(tomee) to run a REST service that will
> > > return some data from some SQL queries (Oracle).  I've installed
> > > Tomee 7.0.1, which uses Tomcat 8.5.3.
> > >
> > > The JDBC driver is available from a private enterprise maven repo.
> > > I'd prefer to get it from there, as opposed to storing it locally.
> > > I noticed at http://tomee.apache.org/configuring-datasources.html ,
> > > there is the possible notation of "mvn:g:a:v" for the "classpath"
> > > attribute.  However, I don't see any way to configure the Maven
> > repositories this will reference.
> > > How do I tell it to look in a particular repo for this?  Would it
> > > just implicitly use my $HOME/.m2/settings.xml file?
> > >
> > > My Resource definition in "conf/tomee.xml" looks something like
> this:
> > > -----------------------
> > >   <Resource id="jdbc/sus2" type="DataSource"
> > >             maxActive="5" maxIdle="2" maxWait="10000"
> > >             driverClassName="oracle.jdbc.driver.OracleDriver"
> > >             url="jdbc:oracle:thin:@<host>:1521:<sid>"
> > >             username="<user>" password="<password>"/>
> > > ----------------
> > >
> > > Does this look correct?  I find the Tomcat docs confusing, with
> > > respect to the required syntax for this.  It's not clear whether a
> > > pure XML syntax is required, or a mixed XML/property syntax.
> > >
> > > If I start the instance, should I see any default output that will
> > > show Tomcat connecting to this datasource?  If it doesn't show this
> > > by default, is there a way to turn this on?
> > >
> > > I tried writing the code to obtain the JNDI resource (Spring context
> > > references), but it just says it can't find it (fails at "jdbc"), so
> > > perhaps my Resource definition was ignored, or my JNDI path is
> wrong.
> > >
> >
> >
> >
> > --
> > Daniel Cunha
> > https://twitter.com/dvlc_
> > http://www.tomitribe.com
> > http://www.tomitribe.io
> >

Re: Define datasource, reference JDBC driver, and see init in console

Posted by Romain Manni-Bucau <rm...@gmail.com>.
well the openejb lookup clearly works even with spring (see
https://github.com/rmannibucau/lookup-from-spring-in-tomee/blob/master/src/main/webapp/WEB-INF/applicationContext.xml#L13)
so there should be something linked to your setup. Listing JNDI is a more
complicated task than doing a list() on a context cause several contexts
are aggregated.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-08-03 18:47 GMT+02:00 KARR, DAVID <dk...@att.com>:

> > -----Original Message-----
> > From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> > Sent: Tuesday, August 02, 2016 11:53 PM
> > To: users@tomee.apache.org
> > Subject: Re: Define datasource, reference JDBC driver, and see init in
> > console
> >
> > Hello
> >
> > Before digging deeper in your problem a small note on this one: since
> > you encounter some issue with the doc I would love you to try to
> > enrich/rewrite some part of it to make it smoother for next newcomer.
> > Would it be possible?
> >
> > Next about your issue:
> >
> > - using jdbc/sus2 you can use @Resource(name = "jdbc/sus2") DataSource
> > ds; or do a lookup on openejb:Resource/jdbc/sus2 or
> > java:openejb/Resource/
> > jdbc/sus2
>
> None of these lookup patterns worked.  Is there some way I can get a list
> of what was finally registered?  I tried executing some code like this:
> ----------
>         List<NameClassPair>     nameClassPairList       = new
> ArrayList<>();
>         InitialContext  context = new InitialContext();
>         NamingEnumeration<NameClassPair>        contextNames    =
> context.list("java:comp/env");
>         while (contextNames.hasMore()) {
> nameClassPairList.add(contextNames.next()); }
>         return nameClassPairList;
> ---------------
>
> With various expressions in the "list()" parameter, but I haven't found
> any trace of "sus2" anywhere.
>
> > 2016-08-03 1:21 GMT+02:00 KARR, DAVID <dk...@att.com>:
> >
> > > I may be making some progress.  Working from
> > > http://tomee.apache.org/tomee-and-eclipse.html , it appears that the
> > > "tomeee.xml" file that I edited in the Tomee distro is not used in
> > > Eclipse.  I used the "Import" feature as described to copy the file
> > into
> > > the server defined in Eclipse.   At that point, I got an error like
> > this:
> > > ---------------------
> > > org.apache.openejb.OpenEJBException:
> > > Unable to read OpenEJB configuration file at
> > >
> > <workspace>\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\tom
> > ee.xml:
> > > Unsupported Attribute(s): maxActive, maxIdle, maxWait,
> > > driverClassName, url, username, password.
> > > Supported Attributes are: type, jar, provider, id, class-name,
> > > constructor, factory-name, classpath, jndi, aliases,
> > > properties-provider, property-provider, depends-on.  If the setting is
> > > a configuration property it must be placed inside the element body.
> > > ---------------------
> > >
> > > Really strange.
> > >
> > > I then modified the imported "tomee.xml" file, resulting in the
> > > following approximate Resource definition:
> > > --------------------
> > > <Resource id="jdbc/sus2" type="DataSource"
> > > classpath="mvn:oracle:ojdbc6:11.2.0.3"
> > >             class-name="oracle.jdbc.driver.OracleDriver">
> > >             maxActive = 5
> > >             maxIdle = 2
> > >             maxWait = 10000
> > >             url = jdbc:oracle:thin:@<host>:1521:<sid>
> > >             username = <userid>
> > >             password = <password>
> > >   </Resource>
> > > --------------
> > >
> > > When I start up the server, I see the following in the console:
> > > ------------------
> > > Aug 02, 2016 4:13:03 PM org.apache.openejb.config.ConfigurationFactory
> > > configureService
> > > INFO: Configuring Service(id=jdbc/sus2, type=Resource,
> > > provider-id=jdbc/sus2)
> > > Aug 02, 2016 4:13:03 PM org.apache.openejb.util.OptionsLog info
> > > INFO: Using 'openejb.deployments.classpath=false'
> > > Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> > > createRecipe
> > > INFO: Creating TransactionManager(id=Default Transaction Manager) Aug
> > > 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> > > createRecipe
> > > INFO: Creating SecurityService(id=Tomcat Security Service) Aug 02,
> > > 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> > > createRecipe
> > > INFO: Creating Resource(id=jdbc/sus2)
> > > Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> > > unusedProperty
> > > WARNING: unusedProperty maxActive - jdbc/sus2 Aug 02, 2016 4:13:03 PM
> > > org.apache.openejb.assembler.classic.Assembler
> > > unusedProperty
> > > WARNING: unusedProperty maxIdle - jdbc/sus2 Aug 02, 2016 4:13:03 PM
> > > org.apache.openejb.assembler.classic.Assembler
> > > unusedProperty
> > > WARNING: unusedProperty maxWait - jdbc/sus2 Aug 02, 2016 4:13:03 PM
> > > org.apache.openejb.assembler.classic.Assembler
> > > unusedProperty
> > > WARNING: unusedProperty url - jdbc/sus2 Aug 02, 2016 4:13:03 PM
> > > org.apache.openejb.assembler.classic.Assembler
> > > unusedProperty
> > > WARNING: unusedProperty username - jdbc/sus2 Aug 02, 2016 4:13:03 PM
> > > org.apache.openejb.assembler.classic.Assembler
> > > unusedProperty
> > > WARNING: unusedProperty password - jdbc/sus2
> > > -----------------
> > >
> > > I don't understand what "unusedProperty" means (weird that it's just
> > > one word).
> > >
> > > When I later try to reference that resource, I get the following:
> > > --------------------
> > > javax.naming.NameNotFoundException: Name [jdbc/sus2] is not bound in
> > > this Context. Unable to find [jdbc].
> > > --------------------
> > >
> > > It's not clear to me whether that Resource definition put anything
> > > into the JNDI context, or whether I'm just using the wrong JNDI path
> > > to reference it.
> > >
> > > -----Original Message-----
> > > From: Daniel Cunha [mailto:danielsoro@gmail.com]
> > > Sent: Tuesday, August 02, 2016 2:10 PM
> > > To: TomEE Users <us...@tomee.apache.org>
> > > Subject: Re: Define datasource, reference JDBC driver, and see init in
> > > console
> > >
> > > Hi David,
> > >
> > > yea, resources on TomEE is a mix (XML/Properties) Your definition
> > > should following the pattern:
> > >  <Resource id="jdbc/sus2" type="DataSource">
> > >             maxActive = 5
> > >             maxIdle = 2
> > >             maxWait = 10000
> > >             driverClassName = oracle.jdbc.driver.OracleDriver
> > >             url = jdbc:oracle:thin:@<host>:1521:<sid>
> > >             username = <user>
> > >             password = <password>
> > > </Resource>
> > >
> > > References you can see here:
> > > http://tomee.apache.org/datasource-config.html
> > > About maven, should be enough have the configuration in your
> > settings.xml.
> > > :)
> > >
> > > On Tue, Aug 2, 2016 at 5:52 PM, KARR, DAVID <dk...@att.com> wrote:
> > >
> > > > (I posted this first to tomcat-user, but I realized technically it
> > > > should go to tomee-user.  I apologize if this is a duplicate for
> > you.
> > > > In any case, this note has a little more info than the first note.)
> > > >
> > > > I'm attempting to use Tomcat(tomee) to run a REST service that will
> > > > return some data from some SQL queries (Oracle).  I've installed
> > > > Tomee 7.0.1, which uses Tomcat 8.5.3.
> > > >
> > > > The JDBC driver is available from a private enterprise maven repo.
> > > > I'd prefer to get it from there, as opposed to storing it locally.
> > > > I noticed at http://tomee.apache.org/configuring-datasources.html ,
> > > > there is the possible notation of "mvn:g:a:v" for the "classpath"
> > > > attribute.  However, I don't see any way to configure the Maven
> > > repositories this will reference.
> > > > How do I tell it to look in a particular repo for this?  Would it
> > > > just implicitly use my $HOME/.m2/settings.xml file?
> > > >
> > > > My Resource definition in "conf/tomee.xml" looks something like
> > this:
> > > > -----------------------
> > > >   <Resource id="jdbc/sus2" type="DataSource"
> > > >             maxActive="5" maxIdle="2" maxWait="10000"
> > > >             driverClassName="oracle.jdbc.driver.OracleDriver"
> > > >             url="jdbc:oracle:thin:@<host>:1521:<sid>"
> > > >             username="<user>" password="<password>"/>
> > > > ----------------
> > > >
> > > > Does this look correct?  I find the Tomcat docs confusing, with
> > > > respect to the required syntax for this.  It's not clear whether a
> > > > pure XML syntax is required, or a mixed XML/property syntax.
> > > >
> > > > If I start the instance, should I see any default output that will
> > > > show Tomcat connecting to this datasource?  If it doesn't show this
> > > > by default, is there a way to turn this on?
> > > >
> > > > I tried writing the code to obtain the JNDI resource (Spring context
> > > > references), but it just says it can't find it (fails at "jdbc"), so
> > > > perhaps my Resource definition was ignored, or my JNDI path is
> > wrong.
> > > >
> > >
> > >
> > >
> > > --
> > > Daniel Cunha
> > > https://twitter.com/dvlc_
> > > http://www.tomitribe.com
> > > http://www.tomitribe.io
> > >
>

RE: Define datasource, reference JDBC driver, and see init in console

Posted by "KARR, DAVID" <dk...@att.com>.
> -----Original Message-----
> From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> Sent: Tuesday, August 02, 2016 11:53 PM
> To: users@tomee.apache.org
> Subject: Re: Define datasource, reference JDBC driver, and see init in
> console
> 
> Hello
> 
> Before digging deeper in your problem a small note on this one: since
> you encounter some issue with the doc I would love you to try to
> enrich/rewrite some part of it to make it smoother for next newcomer.
> Would it be possible?
> 
> Next about your issue:
> 
> - using jdbc/sus2 you can use @Resource(name = "jdbc/sus2") DataSource
> ds; or do a lookup on openejb:Resource/jdbc/sus2 or
> java:openejb/Resource/
> jdbc/sus2

None of these lookup patterns worked.  Is there some way I can get a list of what was finally registered?  I tried executing some code like this:
----------
    	List<NameClassPair>	nameClassPairList	= new ArrayList<>();
    	InitialContext	context	= new InitialContext();
    	NamingEnumeration<NameClassPair>	contextNames	= context.list("java:comp/env");
    	while (contextNames.hasMore()) { nameClassPairList.add(contextNames.next()); }
    	return nameClassPairList;
---------------

With various expressions in the "list()" parameter, but I haven't found any trace of "sus2" anywhere.

> 2016-08-03 1:21 GMT+02:00 KARR, DAVID <dk...@att.com>:
> 
> > I may be making some progress.  Working from
> > http://tomee.apache.org/tomee-and-eclipse.html , it appears that the
> > "tomeee.xml" file that I edited in the Tomee distro is not used in
> > Eclipse.  I used the "Import" feature as described to copy the file
> into
> > the server defined in Eclipse.   At that point, I got an error like
> this:
> > ---------------------
> > org.apache.openejb.OpenEJBException:
> > Unable to read OpenEJB configuration file at
> >
> <workspace>\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\tom
> ee.xml:
> > Unsupported Attribute(s): maxActive, maxIdle, maxWait,
> > driverClassName, url, username, password.
> > Supported Attributes are: type, jar, provider, id, class-name,
> > constructor, factory-name, classpath, jndi, aliases,
> > properties-provider, property-provider, depends-on.  If the setting is
> > a configuration property it must be placed inside the element body.
> > ---------------------
> >
> > Really strange.
> >
> > I then modified the imported "tomee.xml" file, resulting in the
> > following approximate Resource definition:
> > --------------------
> > <Resource id="jdbc/sus2" type="DataSource"
> > classpath="mvn:oracle:ojdbc6:11.2.0.3"
> >             class-name="oracle.jdbc.driver.OracleDriver">
> >             maxActive = 5
> >             maxIdle = 2
> >             maxWait = 10000
> >             url = jdbc:oracle:thin:@<host>:1521:<sid>
> >             username = <userid>
> >             password = <password>
> >   </Resource>
> > --------------
> >
> > When I start up the server, I see the following in the console:
> > ------------------
> > Aug 02, 2016 4:13:03 PM org.apache.openejb.config.ConfigurationFactory
> > configureService
> > INFO: Configuring Service(id=jdbc/sus2, type=Resource,
> > provider-id=jdbc/sus2)
> > Aug 02, 2016 4:13:03 PM org.apache.openejb.util.OptionsLog info
> > INFO: Using 'openejb.deployments.classpath=false'
> > Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> > createRecipe
> > INFO: Creating TransactionManager(id=Default Transaction Manager) Aug
> > 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> > createRecipe
> > INFO: Creating SecurityService(id=Tomcat Security Service) Aug 02,
> > 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> > createRecipe
> > INFO: Creating Resource(id=jdbc/sus2)
> > Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> > unusedProperty
> > WARNING: unusedProperty maxActive - jdbc/sus2 Aug 02, 2016 4:13:03 PM
> > org.apache.openejb.assembler.classic.Assembler
> > unusedProperty
> > WARNING: unusedProperty maxIdle - jdbc/sus2 Aug 02, 2016 4:13:03 PM
> > org.apache.openejb.assembler.classic.Assembler
> > unusedProperty
> > WARNING: unusedProperty maxWait - jdbc/sus2 Aug 02, 2016 4:13:03 PM
> > org.apache.openejb.assembler.classic.Assembler
> > unusedProperty
> > WARNING: unusedProperty url - jdbc/sus2 Aug 02, 2016 4:13:03 PM
> > org.apache.openejb.assembler.classic.Assembler
> > unusedProperty
> > WARNING: unusedProperty username - jdbc/sus2 Aug 02, 2016 4:13:03 PM
> > org.apache.openejb.assembler.classic.Assembler
> > unusedProperty
> > WARNING: unusedProperty password - jdbc/sus2
> > -----------------
> >
> > I don't understand what "unusedProperty" means (weird that it's just
> > one word).
> >
> > When I later try to reference that resource, I get the following:
> > --------------------
> > javax.naming.NameNotFoundException: Name [jdbc/sus2] is not bound in
> > this Context. Unable to find [jdbc].
> > --------------------
> >
> > It's not clear to me whether that Resource definition put anything
> > into the JNDI context, or whether I'm just using the wrong JNDI path
> > to reference it.
> >
> > -----Original Message-----
> > From: Daniel Cunha [mailto:danielsoro@gmail.com]
> > Sent: Tuesday, August 02, 2016 2:10 PM
> > To: TomEE Users <us...@tomee.apache.org>
> > Subject: Re: Define datasource, reference JDBC driver, and see init in
> > console
> >
> > Hi David,
> >
> > yea, resources on TomEE is a mix (XML/Properties) Your definition
> > should following the pattern:
> >  <Resource id="jdbc/sus2" type="DataSource">
> >             maxActive = 5
> >             maxIdle = 2
> >             maxWait = 10000
> >             driverClassName = oracle.jdbc.driver.OracleDriver
> >             url = jdbc:oracle:thin:@<host>:1521:<sid>
> >             username = <user>
> >             password = <password>
> > </Resource>
> >
> > References you can see here:
> > http://tomee.apache.org/datasource-config.html
> > About maven, should be enough have the configuration in your
> settings.xml.
> > :)
> >
> > On Tue, Aug 2, 2016 at 5:52 PM, KARR, DAVID <dk...@att.com> wrote:
> >
> > > (I posted this first to tomcat-user, but I realized technically it
> > > should go to tomee-user.  I apologize if this is a duplicate for
> you.
> > > In any case, this note has a little more info than the first note.)
> > >
> > > I'm attempting to use Tomcat(tomee) to run a REST service that will
> > > return some data from some SQL queries (Oracle).  I've installed
> > > Tomee 7.0.1, which uses Tomcat 8.5.3.
> > >
> > > The JDBC driver is available from a private enterprise maven repo.
> > > I'd prefer to get it from there, as opposed to storing it locally.
> > > I noticed at http://tomee.apache.org/configuring-datasources.html ,
> > > there is the possible notation of "mvn:g:a:v" for the "classpath"
> > > attribute.  However, I don't see any way to configure the Maven
> > repositories this will reference.
> > > How do I tell it to look in a particular repo for this?  Would it
> > > just implicitly use my $HOME/.m2/settings.xml file?
> > >
> > > My Resource definition in "conf/tomee.xml" looks something like
> this:
> > > -----------------------
> > >   <Resource id="jdbc/sus2" type="DataSource"
> > >             maxActive="5" maxIdle="2" maxWait="10000"
> > >             driverClassName="oracle.jdbc.driver.OracleDriver"
> > >             url="jdbc:oracle:thin:@<host>:1521:<sid>"
> > >             username="<user>" password="<password>"/>
> > > ----------------
> > >
> > > Does this look correct?  I find the Tomcat docs confusing, with
> > > respect to the required syntax for this.  It's not clear whether a
> > > pure XML syntax is required, or a mixed XML/property syntax.
> > >
> > > If I start the instance, should I see any default output that will
> > > show Tomcat connecting to this datasource?  If it doesn't show this
> > > by default, is there a way to turn this on?
> > >
> > > I tried writing the code to obtain the JNDI resource (Spring context
> > > references), but it just says it can't find it (fails at "jdbc"), so
> > > perhaps my Resource definition was ignored, or my JNDI path is
> wrong.
> > >
> >
> >
> >
> > --
> > Daniel Cunha
> > https://twitter.com/dvlc_
> > http://www.tomitribe.com
> > http://www.tomitribe.io
> >

Re: Define datasource, reference JDBC driver, and see init in console

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hello

Before digging deeper in your problem a small note on this one: since you
encounter some issue with the doc I would love you to try to enrich/rewrite
some part of it to make it smoother for next newcomer. Would it be possible?

Next about your issue:

- you don't need to set class-name which is intended for custom resources
(DataSource are "known" resources)
- unusedProperty is one word cause it is a method name (we can surely
enrich the message BTW). Means you set a property but this one doesn't
exist on the created instance (the connection pool there). That's one
smooth way to say the configuration is wrong but doesn't prevent to run.
- using jdbc/sus2 you can use @Resource(name = "jdbc/sus2") DataSource ds;
or do a lookup on openejb:Resource/jdbc/sus2 or java:openejb/Resource/
jdbc/sus2
- about maven: ${user.home}/.m2/repository is the default base, you can
override it to openejb.m2.home system property (in conf/system.properties
for instance). If this folder doesn't exist we'll read the default
settings.xml to get the localRespository value.
- about your "strange" error: tomee Resource attributes are about the
resource factory and body of Resource tag is the list of properties used to
set instance attributes. Tomcat put everything as attributes. This is why
you got this error.
- last point: we support some bridge between historical tomee definitions
and tomcat datasources (to make the migration smooth) so you can still use
JdbcDriver, UserName, Password, JdbcUrl:

<Resource id="jdbc/sus2" type="DataSource" classpath="mvn:oracle:ojdbc6:
11.2.0.3">
    JdbcDriver = oracle.jdbc.driver.OracleDriver
    MaxActive = 5
    MaxIdle = 2
    MaxWait = 10000
    JdbcUrl = jdbc:oracle:thin:@<host>:1521:<sid>
    UserName = <userid>
    Password = <password>
  </Resource>

Advantage of keeping these properties is the same definition will run with
openejb (understand tomee without tomcat and embedded) which is a great way
to debug a weird case reusing the same data as in tomee.



Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-08-03 1:21 GMT+02:00 KARR, DAVID <dk...@att.com>:

> I may be making some progress.  Working from
> http://tomee.apache.org/tomee-and-eclipse.html , it appears that the
> "tomeee.xml" file that I edited in the Tomee distro is not used in
> Eclipse.  I used the "Import" feature as described to copy the file into
> the server defined in Eclipse.   At that point, I got an error like this:
> ---------------------
> org.apache.openejb.OpenEJBException:
> Unable to read OpenEJB configuration file at
> <workspace>\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\tomee.xml:
> Unsupported Attribute(s): maxActive, maxIdle, maxWait, driverClassName,
> url, username, password.
> Supported Attributes are: type, jar, provider, id, class-name,
> constructor, factory-name, classpath, jndi, aliases, properties-provider,
> property-provider, depends-on.  If the setting is a configuration property
> it must be placed inside the element body.
> ---------------------
>
> Really strange.
>
> I then modified the imported "tomee.xml" file, resulting in the following
> approximate Resource definition:
> --------------------
> <Resource id="jdbc/sus2" type="DataSource"
> classpath="mvn:oracle:ojdbc6:11.2.0.3"
>             class-name="oracle.jdbc.driver.OracleDriver">
>             maxActive = 5
>             maxIdle = 2
>             maxWait = 10000
>             url = jdbc:oracle:thin:@<host>:1521:<sid>
>             username = <userid>
>             password = <password>
>   </Resource>
> --------------
>
> When I start up the server, I see the following in the console:
> ------------------
> Aug 02, 2016 4:13:03 PM org.apache.openejb.config.ConfigurationFactory
> configureService
> INFO: Configuring Service(id=jdbc/sus2, type=Resource,
> provider-id=jdbc/sus2)
> Aug 02, 2016 4:13:03 PM org.apache.openejb.util.OptionsLog info
> INFO: Using 'openejb.deployments.classpath=false'
> Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> createRecipe
> INFO: Creating TransactionManager(id=Default Transaction Manager)
> Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> createRecipe
> INFO: Creating SecurityService(id=Tomcat Security Service)
> Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> createRecipe
> INFO: Creating Resource(id=jdbc/sus2)
> Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> unusedProperty
> WARNING: unusedProperty maxActive - jdbc/sus2
> Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> unusedProperty
> WARNING: unusedProperty maxIdle - jdbc/sus2
> Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> unusedProperty
> WARNING: unusedProperty maxWait - jdbc/sus2
> Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> unusedProperty
> WARNING: unusedProperty url - jdbc/sus2
> Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> unusedProperty
> WARNING: unusedProperty username - jdbc/sus2
> Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler
> unusedProperty
> WARNING: unusedProperty password - jdbc/sus2
> -----------------
>
> I don't understand what "unusedProperty" means (weird that it's just one
> word).
>
> When I later try to reference that resource, I get the following:
> --------------------
> javax.naming.NameNotFoundException: Name [jdbc/sus2] is not bound in this
> Context. Unable to find [jdbc].
> --------------------
>
> It's not clear to me whether that Resource definition put anything into
> the JNDI context, or whether I'm just using the wrong JNDI path to
> reference it.
>
> -----Original Message-----
> From: Daniel Cunha [mailto:danielsoro@gmail.com]
> Sent: Tuesday, August 02, 2016 2:10 PM
> To: TomEE Users <us...@tomee.apache.org>
> Subject: Re: Define datasource, reference JDBC driver, and see init in
> console
>
> Hi David,
>
> yea, resources on TomEE is a mix (XML/Properties) Your definition should
> following the pattern:
>  <Resource id="jdbc/sus2" type="DataSource">
>             maxActive = 5
>             maxIdle = 2
>             maxWait = 10000
>             driverClassName = oracle.jdbc.driver.OracleDriver
>             url = jdbc:oracle:thin:@<host>:1521:<sid>
>             username = <user>
>             password = <password>
> </Resource>
>
> References you can see here:
> http://tomee.apache.org/datasource-config.html
> About maven, should be enough have the configuration in your settings.xml.
> :)
>
> On Tue, Aug 2, 2016 at 5:52 PM, KARR, DAVID <dk...@att.com> wrote:
>
> > (I posted this first to tomcat-user, but I realized technically it
> > should go to tomee-user.  I apologize if this is a duplicate for you.
> > In any case, this note has a little more info than the first note.)
> >
> > I'm attempting to use Tomcat(tomee) to run a REST service that will
> > return some data from some SQL queries (Oracle).  I've installed Tomee
> > 7.0.1, which uses Tomcat 8.5.3.
> >
> > The JDBC driver is available from a private enterprise maven repo.
> > I'd prefer to get it from there, as opposed to storing it locally.  I
> > noticed at http://tomee.apache.org/configuring-datasources.html ,
> > there is the possible notation of "mvn:g:a:v" for the "classpath"
> > attribute.  However, I don't see any way to configure the Maven
> repositories this will reference.
> > How do I tell it to look in a particular repo for this?  Would it just
> > implicitly use my $HOME/.m2/settings.xml file?
> >
> > My Resource definition in "conf/tomee.xml" looks something like this:
> > -----------------------
> >   <Resource id="jdbc/sus2" type="DataSource"
> >             maxActive="5" maxIdle="2" maxWait="10000"
> >             driverClassName="oracle.jdbc.driver.OracleDriver"
> >             url="jdbc:oracle:thin:@<host>:1521:<sid>"
> >             username="<user>" password="<password>"/>
> > ----------------
> >
> > Does this look correct?  I find the Tomcat docs confusing, with
> > respect to the required syntax for this.  It's not clear whether a
> > pure XML syntax is required, or a mixed XML/property syntax.
> >
> > If I start the instance, should I see any default output that will
> > show Tomcat connecting to this datasource?  If it doesn't show this by
> > default, is there a way to turn this on?
> >
> > I tried writing the code to obtain the JNDI resource (Spring context
> > references), but it just says it can't find it (fails at "jdbc"), so
> > perhaps my Resource definition was ignored, or my JNDI path is wrong.
> >
>
>
>
> --
> Daniel Cunha
> https://twitter.com/dvlc_
> http://www.tomitribe.com
> http://www.tomitribe.io
>

RE: Define datasource, reference JDBC driver, and see init in console

Posted by "KARR, DAVID" <dk...@att.com>.
I may be making some progress.  Working from http://tomee.apache.org/tomee-and-eclipse.html , it appears that the "tomeee.xml" file that I edited in the Tomee distro is not used in Eclipse.  I used the "Import" feature as described to copy the file into the server defined in Eclipse.   At that point, I got an error like this:
---------------------
org.apache.openejb.OpenEJBException:
Unable to read OpenEJB configuration file at <workspace>\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\tomee.xml:
Unsupported Attribute(s): maxActive, maxIdle, maxWait, driverClassName, url, username, password.
Supported Attributes are: type, jar, provider, id, class-name, constructor, factory-name, classpath, jndi, aliases, properties-provider, property-provider, depends-on.  If the setting is a configuration property it must be placed inside the element body.
---------------------

Really strange.

I then modified the imported "tomee.xml" file, resulting in the following approximate Resource definition:
--------------------
<Resource id="jdbc/sus2" type="DataSource" classpath="mvn:oracle:ojdbc6:11.2.0.3"
	    class-name="oracle.jdbc.driver.OracleDriver">
	    maxActive = 5
	    maxIdle = 2 
	    maxWait = 10000
	    url = jdbc:oracle:thin:@<host>:1521:<sid>
	    username = <userid>
	    password = <password>
  </Resource>
--------------

When I start up the server, I see the following in the console:
------------------
Aug 02, 2016 4:13:03 PM org.apache.openejb.config.ConfigurationFactory configureService
INFO: Configuring Service(id=jdbc/sus2, type=Resource, provider-id=jdbc/sus2)
Aug 02, 2016 4:13:03 PM org.apache.openejb.util.OptionsLog info
INFO: Using 'openejb.deployments.classpath=false'
Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating TransactionManager(id=Default Transaction Manager)
Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating SecurityService(id=Tomcat Security Service)
Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Resource(id=jdbc/sus2)
Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler unusedProperty
WARNING: unusedProperty maxActive - jdbc/sus2
Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler unusedProperty
WARNING: unusedProperty maxIdle - jdbc/sus2
Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler unusedProperty
WARNING: unusedProperty maxWait - jdbc/sus2
Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler unusedProperty
WARNING: unusedProperty url - jdbc/sus2
Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler unusedProperty
WARNING: unusedProperty username - jdbc/sus2
Aug 02, 2016 4:13:03 PM org.apache.openejb.assembler.classic.Assembler unusedProperty
WARNING: unusedProperty password - jdbc/sus2
-----------------

I don't understand what "unusedProperty" means (weird that it's just one word).

When I later try to reference that resource, I get the following:
--------------------
javax.naming.NameNotFoundException: Name [jdbc/sus2] is not bound in this Context. Unable to find [jdbc].
--------------------

It's not clear to me whether that Resource definition put anything into the JNDI context, or whether I'm just using the wrong JNDI path to reference it.

-----Original Message-----
From: Daniel Cunha [mailto:danielsoro@gmail.com] 
Sent: Tuesday, August 02, 2016 2:10 PM
To: TomEE Users <us...@tomee.apache.org>
Subject: Re: Define datasource, reference JDBC driver, and see init in console

Hi David,

yea, resources on TomEE is a mix (XML/Properties) Your definition should following the pattern:
 <Resource id="jdbc/sus2" type="DataSource">
            maxActive = 5
            maxIdle = 2
            maxWait = 10000
            driverClassName = oracle.jdbc.driver.OracleDriver
            url = jdbc:oracle:thin:@<host>:1521:<sid>
            username = <user>
            password = <password>
</Resource>

References you can see here: http://tomee.apache.org/datasource-config.html
About maven, should be enough have the configuration in your settings.xml.
:)

On Tue, Aug 2, 2016 at 5:52 PM, KARR, DAVID <dk...@att.com> wrote:

> (I posted this first to tomcat-user, but I realized technically it 
> should go to tomee-user.  I apologize if this is a duplicate for you. 
> In any case, this note has a little more info than the first note.)
>
> I'm attempting to use Tomcat(tomee) to run a REST service that will 
> return some data from some SQL queries (Oracle).  I've installed Tomee 
> 7.0.1, which uses Tomcat 8.5.3.
>
> The JDBC driver is available from a private enterprise maven repo.  
> I'd prefer to get it from there, as opposed to storing it locally.  I 
> noticed at http://tomee.apache.org/configuring-datasources.html , 
> there is the possible notation of "mvn:g:a:v" for the "classpath" 
> attribute.  However, I don't see any way to configure the Maven repositories this will reference.
> How do I tell it to look in a particular repo for this?  Would it just 
> implicitly use my $HOME/.m2/settings.xml file?
>
> My Resource definition in "conf/tomee.xml" looks something like this:
> -----------------------
>   <Resource id="jdbc/sus2" type="DataSource"
>             maxActive="5" maxIdle="2" maxWait="10000"
>             driverClassName="oracle.jdbc.driver.OracleDriver"
>             url="jdbc:oracle:thin:@<host>:1521:<sid>"
>             username="<user>" password="<password>"/>
> ----------------
>
> Does this look correct?  I find the Tomcat docs confusing, with 
> respect to the required syntax for this.  It's not clear whether a 
> pure XML syntax is required, or a mixed XML/property syntax.
>
> If I start the instance, should I see any default output that will 
> show Tomcat connecting to this datasource?  If it doesn't show this by 
> default, is there a way to turn this on?
>
> I tried writing the code to obtain the JNDI resource (Spring context 
> references), but it just says it can't find it (fails at "jdbc"), so 
> perhaps my Resource definition was ignored, or my JNDI path is wrong.
>



--
Daniel Cunha
https://twitter.com/dvlc_
http://www.tomitribe.com
http://www.tomitribe.io

RE: Define datasource, reference JDBC driver, and see init in console

Posted by "KARR, DAVID" <dk...@att.com>.
Although http://tomee.apache.org/configuring-datasources.html mentions the "classpath" attribute, this is not mentioned in the "Supported Properties" list at http://tomee.apache.org/datasource-config.html .

-----Original Message-----
From: Daniel Cunha [mailto:danielsoro@gmail.com] 
Sent: Tuesday, August 02, 2016 2:10 PM
To: TomEE Users <us...@tomee.apache.org>
Subject: Re: Define datasource, reference JDBC driver, and see init in console

Hi David,

yea, resources on TomEE is a mix (XML/Properties) Your definition should following the pattern:
 <Resource id="jdbc/sus2" type="DataSource">
            maxActive = 5
            maxIdle = 2
            maxWait = 10000
            driverClassName = oracle.jdbc.driver.OracleDriver
            url = jdbc:oracle:thin:@<host>:1521:<sid>
            username = <user>
            password = <password>
</Resource>

References you can see here: http://tomee.apache.org/datasource-config.html
About maven, should be enough have the configuration in your settings.xml.
:)

On Tue, Aug 2, 2016 at 5:52 PM, KARR, DAVID <dk...@att.com> wrote:

> (I posted this first to tomcat-user, but I realized technically it 
> should go to tomee-user.  I apologize if this is a duplicate for you. 
> In any case, this note has a little more info than the first note.)
>
> I'm attempting to use Tomcat(tomee) to run a REST service that will 
> return some data from some SQL queries (Oracle).  I've installed Tomee 
> 7.0.1, which uses Tomcat 8.5.3.
>
> The JDBC driver is available from a private enterprise maven repo.  
> I'd prefer to get it from there, as opposed to storing it locally.  I 
> noticed at http://tomee.apache.org/configuring-datasources.html , 
> there is the possible notation of "mvn:g:a:v" for the "classpath" 
> attribute.  However, I don't see any way to configure the Maven repositories this will reference.
> How do I tell it to look in a particular repo for this?  Would it just 
> implicitly use my $HOME/.m2/settings.xml file?
>
> My Resource definition in "conf/tomee.xml" looks something like this:
> -----------------------
>   <Resource id="jdbc/sus2" type="DataSource"
>             maxActive="5" maxIdle="2" maxWait="10000"
>             driverClassName="oracle.jdbc.driver.OracleDriver"
>             url="jdbc:oracle:thin:@<host>:1521:<sid>"
>             username="<user>" password="<password>"/>
> ----------------
>
> Does this look correct?  I find the Tomcat docs confusing, with 
> respect to the required syntax for this.  It's not clear whether a 
> pure XML syntax is required, or a mixed XML/property syntax.
>
> If I start the instance, should I see any default output that will 
> show Tomcat connecting to this datasource?  If it doesn't show this by 
> default, is there a way to turn this on?
>
> I tried writing the code to obtain the JNDI resource (Spring context 
> references), but it just says it can't find it (fails at "jdbc"), so 
> perhaps my Resource definition was ignored, or my JNDI path is wrong.
>



--
Daniel Cunha
https://twitter.com/dvlc_
http://www.tomitribe.com
http://www.tomitribe.io

RE: Define datasource, reference JDBC driver, and see init in console

Posted by "KARR, DAVID" <dk...@att.com>.
Also, I repeat the question about what Tomcat does with this.  When I see the instance start up, I see no console information about this datasource.  Does that mean I did something wrong, or does it simply not report what it's doing with this, or what?

-----Original Message-----
From: Daniel Cunha [mailto:danielsoro@gmail.com] 
Sent: Tuesday, August 02, 2016 2:10 PM
To: TomEE Users <us...@tomee.apache.org>
Subject: Re: Define datasource, reference JDBC driver, and see init in console

Hi David,

yea, resources on TomEE is a mix (XML/Properties) Your definition should following the pattern:
 <Resource id="jdbc/sus2" type="DataSource">
            maxActive = 5
            maxIdle = 2
            maxWait = 10000
            driverClassName = oracle.jdbc.driver.OracleDriver
            url = jdbc:oracle:thin:@<host>:1521:<sid>
            username = <user>
            password = <password>
</Resource>

References you can see here: http://tomee.apache.org/datasource-config.html
About maven, should be enough have the configuration in your settings.xml.
:)

On Tue, Aug 2, 2016 at 5:52 PM, KARR, DAVID <dk...@att.com> wrote:

> (I posted this first to tomcat-user, but I realized technically it 
> should go to tomee-user.  I apologize if this is a duplicate for you. 
> In any case, this note has a little more info than the first note.)
>
> I'm attempting to use Tomcat(tomee) to run a REST service that will 
> return some data from some SQL queries (Oracle).  I've installed Tomee 
> 7.0.1, which uses Tomcat 8.5.3.
>
> The JDBC driver is available from a private enterprise maven repo.  
> I'd prefer to get it from there, as opposed to storing it locally.  I 
> noticed at http://tomee.apache.org/configuring-datasources.html , 
> there is the possible notation of "mvn:g:a:v" for the "classpath" 
> attribute.  However, I don't see any way to configure the Maven repositories this will reference.
> How do I tell it to look in a particular repo for this?  Would it just 
> implicitly use my $HOME/.m2/settings.xml file?
>
> My Resource definition in "conf/tomee.xml" looks something like this:
> -----------------------
>   <Resource id="jdbc/sus2" type="DataSource"
>             maxActive="5" maxIdle="2" maxWait="10000"
>             driverClassName="oracle.jdbc.driver.OracleDriver"
>             url="jdbc:oracle:thin:@<host>:1521:<sid>"
>             username="<user>" password="<password>"/>
> ----------------
>
> Does this look correct?  I find the Tomcat docs confusing, with 
> respect to the required syntax for this.  It's not clear whether a 
> pure XML syntax is required, or a mixed XML/property syntax.
>
> If I start the instance, should I see any default output that will 
> show Tomcat connecting to this datasource?  If it doesn't show this by 
> default, is there a way to turn this on?
>
> I tried writing the code to obtain the JNDI resource (Spring context 
> references), but it just says it can't find it (fails at "jdbc"), so 
> perhaps my Resource definition was ignored, or my JNDI path is wrong.
>



--
Daniel Cunha
https://twitter.com/dvlc_
http://www.tomitribe.com
http://www.tomitribe.io

Re: Define datasource, reference JDBC driver, and see init in console

Posted by Daniel Cunha <da...@gmail.com>.
Hi David,

yea, resources on TomEE is a mix (XML/Properties)
Your definition should following the pattern:
 <Resource id="jdbc/sus2" type="DataSource">
            maxActive = 5
            maxIdle = 2
            maxWait = 10000
            driverClassName = oracle.jdbc.driver.OracleDriver
            url = jdbc:oracle:thin:@<host>:1521:<sid>
            username = <user>
            password = <password>
</Resource>

References you can see here: http://tomee.apache.org/datasource-config.html
About maven, should be enough have the configuration in your settings.xml.
:)

On Tue, Aug 2, 2016 at 5:52 PM, KARR, DAVID <dk...@att.com> wrote:

> (I posted this first to tomcat-user, but I realized technically it should
> go to tomee-user.  I apologize if this is a duplicate for you. In any case,
> this note has a little more info than the first note.)
>
> I'm attempting to use Tomcat(tomee) to run a REST service that will return
> some data from some SQL queries (Oracle).  I've installed Tomee 7.0.1,
> which uses Tomcat 8.5.3.
>
> The JDBC driver is available from a private enterprise maven repo.  I'd
> prefer to get it from there, as opposed to storing it locally.  I noticed
> at http://tomee.apache.org/configuring-datasources.html , there is the
> possible notation of "mvn:g:a:v" for the "classpath" attribute.  However, I
> don't see any way to configure the Maven repositories this will reference.
> How do I tell it to look in a particular repo for this?  Would it just
> implicitly use my $HOME/.m2/settings.xml file?
>
> My Resource definition in "conf/tomee.xml" looks something like this:
> -----------------------
>   <Resource id="jdbc/sus2" type="DataSource"
>             maxActive="5" maxIdle="2" maxWait="10000"
>             driverClassName="oracle.jdbc.driver.OracleDriver"
>             url="jdbc:oracle:thin:@<host>:1521:<sid>"
>             username="<user>" password="<password>"/>
> ----------------
>
> Does this look correct?  I find the Tomcat docs confusing, with respect to
> the required syntax for this.  It's not clear whether a pure XML syntax is
> required, or a mixed XML/property syntax.
>
> If I start the instance, should I see any default output that will show
> Tomcat connecting to this datasource?  If it doesn't show this by default,
> is there a way to turn this on?
>
> I tried writing the code to obtain the JNDI resource (Spring context
> references), but it just says it can't find it (fails at "jdbc"), so
> perhaps my Resource definition was ignored, or my JNDI path is wrong.
>



-- 
Daniel Cunha
https://twitter.com/dvlc_
http://www.tomitribe.com
http://www.tomitribe.io