Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Giving Tomcat Project under Eclipse a needed config .xml file?  RSS feed

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Someone gave me an Eclipse-based web project. I can export its "workflow.war", and then run that under Tomcat standalone.

I'm trying to do Hot Deploy -
I had a runtime configuration for that Tomcat install, I added a "server" for it, and added the project for that. So far, so good... but when it starts up, the message seems to indicate that it's not reading a certain config file... (i.e. 15:01:27.31 main ERROR context.ContextLoader:215 - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Could not resolve placeholder 'db.driverClassName' )


To get it to run under standalone Tomcat, I was told to go to [TOMCAT_HOME]\conf, and add a directory "Catalina\localhost", and in that put "workflow.xml", which defines things like
<Parameter name="db.driverClassName" value="org.postgresql.Driver"/>

Things I've tried:
* I tried adding the directory containing workflow.xml as an External Class Directory to the project itself
* Someone suggested double clicking the Server entry to get the "Overview", and then changing "Server Locations" to "Use Tomcat Installation" instead of "Use workspace metadata" - I tried this with depoy path set to the "default value" of "wtpwebapps" (PS, huh? 'wtp' webapps?) as well as setting it to the full path c:\dev\tomcat6\webapps.
(also before I realized I could double click to get certain settings for the server, right clicking, going to Properties, I toggled "Switch Location" away from [workspace metadata] to "/Servers/Tomcat v6.0 Server at localhost.server", but that flat out didn't work, tomcat wouldn't start up right at all)

So what do I need to set to get Tomcat to read this Workflow.xml path and make it available to the classes as it boots up?
 
kirk israel
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(here's what I wrote a friend who was trying to help me)

ultimately, it turns out what I was after was just making sure Tomcat
was seeing a big old <Context> tag, with all these name/value pairs...
now in "standalone" mode, they were relying on some weird thing where
Tomcat will look in conf/Catalina/[servername] (in this case
localhost) and I guess readin the xml there, and it didn't really
matter that the context tag was in workflow.xml

in hot deploy, eclipse has a servers project/folder, and the setup
files are there... confusingly, there was a Context tag in server.xml,
as well as one in Context.xml. I think what led to a number of dead
ends was that Context.xml there was overrriding other attempts I
might've been making to establish the correct Context tag and get
tomcat to read it.

Or maybe the secret was taking a break and watching The Big Lebowski.
The Dude Abides!

But seriously, I hope to get better at this pseudo-sysadmin-y crap
'cause I'm so bad at it.

My friend recommended I should try to figure out how to attach a
debugger to Tomcat itself, and watch as it evaluates stuff and does
its setup magic, but that seems kind of brutal, especially when I had
the sense that what I was trying to do was pretty damn simple...
 
Bartender
Posts: 19735
92
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The reason that you found a Context in server.xml is that that's originally where they all went.

However, these days, the recommendation is to place each webapp's context in its own private XML file. This can be in the META-INF directory in the webapp, in the TOMCAT_HOME/conf/Catalina/localhost directory or in the TOMCAT_HOME/webapps directory (although that one I don't recommend).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!