ldstech webapp in non-lds-tomcat

Support and Announcements for the Tech Java Web Application Platform (setup, configuration, bugs, feedback).
Locked
pauldev
New Member
Posts: 28
Joined: Mon Jan 07, 2013 12:42 pm

ldstech webapp in non-lds-tomcat

#1

Post by pauldev »

Hi,
I am trying to run a webapp that the StackStarter created in a new tomcat server.
I get an error below. I was wondering if there is any quick doc on what changes I need to be able to do this? (The reason is so that I can more easily run on generic servers on linux, aix, etc)
(In the error below don't have dataSourcMBean anywhere in my project files, so guessing this is a dependency on lds-tech maven tomcat)


org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceMBean': Cannot resolve reference to bean 'dataSource' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Cannot create inner bean '(inner bean)' of type [org.springframework.jndi.JndiObjectFactoryBean] while setting bean property 'targetDataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jdbc/default/DataSource] is not bound in this Context. Unable to find [jdbc].
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:329)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107)
at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:616)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1035)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:939)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:587)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:925)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:472)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
pauldev
New Member
Posts: 28
Joined: Mon Jan 07, 2013 12:42 pm

Re: ldstech webapp in non-lds-tomcat

#2

Post by pauldev »

I got this working by adding the following to server.xml
<Resource auth="Container"
connectionProperties="oracle.jdbc.ReadTimeout=120000;includeSynonyms=true;v$session.program=${projectName}"
driverClassName="oracle.jdbc.OracleDriver"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
initialSize="0"
jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer;org.apache.tomcat.jdbc.pool.interceptor.StatementDecoratorInterceptor;org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportJmx;org.apache.tomcat.jdbc.pool.interceptor.ResetAbandonedTimer"
jmxEnabled="true"
logAbandoned="true"
maxActive="${ds.maxPoolSize}"
minIdle="0"
name="jdbc/default/DataSource"
password="${ds.password}"
removeAbandoned="true"
removeAbandonedTimeout="120"
testOnBorrow="true"
testOnReturn="false"
testWhileIdle="true"
type="javax.sql.DataSource"
url="${ds.url}"
username="${ds.username}"/>
//could not locate db validator, so just removed it...

And following to catalina.properties:

Add to catalina.properties:
# DataSource Properties
ds.url=jdbc:oracle:thin:@localhost:1521:xe
ds.username=ldstech
ds.password=..
ds.maxPoolSize=25
YoungstromMJ
Member
Posts: 101
Joined: Mon Mar 29, 2010 3:11 pm
Location: Utah, USA

Re: ldstech webapp in non-lds-tomcat

#3

Post by YoungstromMJ »

Good job. :) The configuration of the tomcat server you will find in the "deploy" project of a stack starter project. For documentation on how the files in the deploy project get put into a tomcat server you can refer to this document.

http://code.lds.org/maven-sites/stack/m ... yable.html

We also provide a tomcat maven plugin that can produce a tomcat zip with the app and configuration included. You can find documentation of that here:

http://code.lds.org/maven-sites/stack/m ... eploy.html

Mike
Locked

Return to “Java Web Project Support (Stack)”