CPAS.XML Database setup

CPAS Forum (Inactive)
CPAS.XML Database setup kimsm  2005-12-20 16:25
Status: Closed
 
I went with a Postgres 8.0 install, but I am now having problems with the cpas.xml setup. The error messages from my cpas.log and webpage (cpas.webError.txt) are attached. I am suspecting it's my Postgres and Tomcat setup:

Tomcat 5.5.14 on port 8090

Postgres 8.0.5

My cpas.xml DB section:

<Resource name="jdbc/cpasDataSource" auth="Container"

type="javax.sql.DataSource"

username="postgres"

password=""

driverClassName="org.postgresql.Driver"

url="jdbc:postgresql://localhost:8090/cpas"

maxActive="20"

maxIdle="10"/>

I'm a postgres rookie, so I am wondering how CPAS, during the first time you run it on tomcat, creates databases and tables in postgres. In addition, what database should be setup in postgres prior to install - a database with the same name as the user?

BTW - I noticed in my Java1.5SE install that it did not include the javaMail API, which is required for CPAS. I thought it might be helpful to others if this could be updated in the documentation.

Thanks in advance,

S.

 
 
jeckels responded:  2005-12-20 16:43
It looks like the URL in your <Resource/> element is probably not configured correctly. It needs the URL on which Postgres will be listening, and you're pointing it at your Tomcat installation. Assuming that Postgres is running on the same machine as Tomcat, the URL should probably just be "jdbc:postgresql://localhost/cpas". If you're running Postgres on a different port from the default (5432), enter that as the port number. I assume you removed the password from your posting so as to not share it with the world.

When Tomcat starts up, CPAS attempts to connect to the database URL specified in cpas.xml. If it can't find the database, it attempts to create it by creating a JDBC connection to the Postgres master database, which is installed by default and called 'template1', and allows us to create the CPAS database and associated schemas.

As for the JavaMail installation, we do have a note tucked in our manual installation instructions at https://cpas.fhcrc.org/Wiki/home/help/page.view?name=config%2Fmaninstall under the "Move the CPAS Libraries" heading. Sorry for the confusion.

Thanks, Josh

 
arauch responded:  2005-12-20 17:28
When CPAS starts up it attempts a connection to the "cpas" database. If this connection attempt fails with a "3D000" error (invalid catalog name) we assume that means the username, password, url, etc. are all correct but the database doesn't exist (it's a new install). In that case, we connect to the "template1" database (which should always be present in PostgreSQL), create the "cpas" database, then create the schema. If we get some other error on the initial connect we give up.

Your log shows that this initial connection is failing with an "08001" error which is listed as "SQLCLIENT UNABLE TO ESTABLISH SQLCONNECTION." My experience has been this means there's a problem with the JDBC URL.

Your log also shows that CPAS is trying this connection URL: jdbc:postgresql://otrs.genophobe.org:8090/cpas. Yet the cpas.xml you posted above is set to //localhost. Not sure if this discrepancy has anything to do with the problem.

I've attached a very simple PostgreSQL JDBC test app you can run from the command line. This will eliminate CPAS and Tomcat from the equation entirely. The cmd file is a Windows batch file, but it should be obvious how to modify this for Linux.

You should use PGTest to attempt to connect to "template1" -- you should get a successful connection. Then attempt a connection to "cpas" and see what error message is returned.

Thanks for the note about JavaMail; we'll get that added.

Adam

 
kimsm responded:  2005-12-21 11:13
Thank you both for your lightening quick responses!

I used Adam's program and found that my postgres was fine. Then I followed Josh's instructions (which are the same instructions as the docs that come w/ CPAS) and took out the port number from the jdbc parameter. Everything worked fine after that. I guess I thought I was a smarty by anticipating a change in the jdbc URL just because I had a atypical Tomcat port...

So now I can log in and create my account. I chose the advanced installation, but ran into some snags. During the MouseModels install, it dies and gives me this error:

An error has occurred:
org.apache.struts.action.EXCEPTION :
java.lang.NoClassDefFoundError
       at MouseModel.MouseModelModule.afterSchemaUpdate(MouseModelModule.java:137)
       at org.fhcrc.cpas.module.DefaultCpasModule.versionUpdate(DefaultCpasModule.java:108)
       at admin.AdminController.moduleUpgrade(AdminController.java:559)
       at sun.reflect.GeneratedMethodAccessor195.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.apache.beehive.netui.pageflow.FlowController.invokeActionMethod(FlowController.java:811)
       at org.apache.beehive.netui.pageflow.FlowController.getActionMethodForward(FlowController.java:750)
       at org.apache.beehive.netui.pageflow.FlowController.internalExecute(FlowController.java:425)
       at org.apache.beehive.netui.pageflow.PageFlowController.internalExecute(PageFlowController.java:282)
       at org.apache.beehive.netui.pageflow.FlowController.execute(FlowController.java:306)
       at org.apache.beehive.netui.pageflow.internal.FlowControllerAction.execute(FlowControllerAction.java:48)
       at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
       at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.access$201(PageFlowRequestProcessor.java:109)
       at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor$ActionRunner.execute(PageFlowRequestProcessor.java:1979)
       at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors$WrapActionInterceptorChain.continueChain(ActionInterceptors.java:63)
       at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors.wrapAction(ActionInterceptors.java:86)
       at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processActionPerform(PageFlowRequestProcessor.java:2048)
       at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
       at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInternal(PageFlowRequestProcessor.java:592)
       at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:856)
       at org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:600)
       at org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:163)
       at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
       at org.fhcrc.cpas.view.ViewServlet.service(ViewServlet.java:90)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.fhcrc.cpas.data.TransactionFilter.doFilter(TransactionFilter.java:36)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:123)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.fhcrc.cpas.security.AuthFilter.doFilter(AuthFilter.java:53)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.fhcrc.cpas.module.ModuleLoader.doFilter(ModuleLoader.java:219)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
       at java.lang.Thread.run(Thread.java:595)


javax.servlet.error.exception :


javax.servlet.ServletException
       at org.apache.beehive.netui.pageflow.internal.DefaultExceptionsHandler.handleException(DefaultExceptionsHandler.java:188)
       at org.apache.beehive.netui.pageflow.FlowController.handleException(FlowController.java:258)
       at org.apache.beehive.netui.pageflow.FlowController.internalExecute(FlowController.java:442)
       at org.apache.beehive.netui.pageflow.PageFlowController.internalExecute(PageFlowController.java:282)
       at org.apache.beehive.netui.pageflow.FlowController.execute(FlowController.java:306)
       at org.apache.beehive.netui.pageflow.internal.FlowControllerAction.execute(FlowControllerAction.java:48)
       at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
       at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.access$201(PageFlowRequestProcessor.java:109)
       at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor$ActionRunner.execute(PageFlowRequestProcessor.java:1979)
       at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors$WrapActionInterceptorChain.continueChain(ActionInterceptors.java:63)
       at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors.wrapAction(ActionInterceptors.java:86)
       at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processActionPerform(PageFlowRequestProcessor.java:2048)
       at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
       at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInternal(PageFlowRequestProcessor.java:592)
       at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:856)
       at org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:600)
       at org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:163)
       at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
       at org.fhcrc.cpas.view.ViewServlet.service(ViewServlet.java:90)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.fhcrc.cpas.data.TransactionFilter.doFilter(TransactionFilter.java:36)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:123)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.fhcrc.cpas.security.AuthFilter.doFilter(AuthFilter.java:53)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.fhcrc.cpas.module.ModuleLoader.doFilter(ModuleLoader.java:219)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
       at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.NoClassDefFoundError
       at MouseModel.MouseModelModule.afterSchemaUpdate(MouseModelModule.java:137)
       at org.fhcrc.cpas.module.DefaultCpasModule.versionUpdate(DefaultCpasModule.java:108)
       at admin.AdminController.moduleUpgrade(AdminController.java:559)
       at sun.reflect.GeneratedMethodAccessor195.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.apache.beehive.netui.pageflow.FlowController.invokeActionMethod(FlowController.java:811)
       at org.apache.beehive.netui.pageflow.FlowController.getActionMethodForward(FlowController.java:750)
       at org.apache.beehive.netui.pageflow.FlowController.internalExecute(FlowController.java:425)
       ... 51 more


request attributes
javax.servlet.forward.request_uri = /cpas/admin/moduleUpgrade.view
javax.servlet.forward.context_path = /cpas
javax.servlet.forward.servlet_path = /admin/moduleUpgrade.view
javax.servlet.forward.path_info = /error.gm
javax.servlet.error.message =
javax.servlet.error.exception = javax.servlet.ServletException
_netui:_actionURI = /cpas/admin/moduleUpgrade.do
upgradeStatusForm = admin.AdminController$UpgradeStatusForm@9c62da
javax.servlet.error.request_uri = /cpas/admin/moduleUpgrade.view
javax.servlet.error.status_code = 500
org.apache.struts.action.EXCEPTION = java.lang.NoClassDefFoundError
sharedFlow = [:]
url_rewriters = [org.apache.beehive.netui.pageflow.internal.DefaultURLRewriter@0]
globalApp = global.Global@1dbc8b
javax.servlet.error.servlet_name = ViewServlet
pageInput = [:]
_defaultValidationMessages = org.apache.beehive.netui.pageflow.internal.ExpressionAwareMessageResources@11e05b6
org.apache.struts.action.mapping.instance = ActionConfig[path=/moduleUpgrade,name=upgradeStatusForm,parameter=admin.AdminController,scope=request,type=org.apache.beehive.netui.pageflow.internal.FlowControllerAction
bundle = [Suppressed due to Beehive problem]
pageFlow = admin.AdminController@1a826c5
org.apache.beehive.controls.runtime.servlet.ServletBeanContext = []
_netui:servletContext = org.apache.catalina.core.ApplicationContextFacade@4a9dcd
org.apache.struts.action.MODULE = org.apache.struts.config.impl.ModuleConfigImpl@bf83ad
 
kimsm responded:  2005-12-21 11:17
I also wanted to clear up the JavaMail comment: as Josh pointed out, it was included in the CPAS jar files and I copied the .jar file into my Tomcat/common/lib. However, I still got the NoClassDefFoundError, so I installed it separately. So I'm not 100% sure if it was something wrong w/ my CLASSPATH or CPAS.

Cheers.

 
jeckels responded:  2005-12-21 13:43
Can you attach the current contents of your cpas.log file? I'm hoping that it contains information about a previous failure that could put your installation in this state.

Thanks, Josh

 
kimsm responded:  2005-12-21 13:51
Here is my cpas.log related to the installation.
 
jeckels responded:  2005-12-21 14:57
Thanks for the log.

It turns out there is a problem with the manual installation distributions as posted to the web site. A module that is not working correctly in 1.1 is enabled when it should be disabled.

We're posting new, fixed distributions, but here are the steps on how to correct your existing installation. You'll lose your existing database, but it doesn't yet contain any real data so it shouldn't be a problem.

  • Shut down your Tomcat server.
  • Delete your existing CPAS Postgres database (but not your full Postgres installation). I'm afraid I don't have a Linux installation of Postgres handy, but it looks like you should be able to use the dropdb utility to do this from the shell. http://www.postgresql.org/docs/8.0/static/app-dropdb.html
  • Edit cpasroot/cpaswebapp/WEB-INF/classes/cpasProperties/modules.properties. You need to comment out the MouseModel module, so its line looks like:
#MouseModels=MouseModel.MouseModelModule This is the change we're making to the distributions.
  • Restart Tomcat.
  • Access the website. This will let you recreate your user account and such.
Sorry for the hassle, and thanks for helping us track down the root problem!

Josh

 
kimsm responded:  2005-12-21 15:45
Thanks for all the help. Install finally went through.

Something that also might help in the documentation (especially for first time postGres people) is to install the PL/PGSQL: "postgres/bin/createlang plpgsql -d template1"

 
adam responded:  2006-12-04 21:16