TeamCity does not work after restarting the server

When I install TeamCity on a windows 2003 server it works fine. But once I restart the server, it is gone, I need to reinstall to make it work once again and only until next restart.
After restarting the server, I am manually executing "runall.bat start" and tomcat window fails.

In localhost.2009-05-06.log I am seeing this line:


SEVERE: Exception sending context initialized event to listener instance of class jetbrains.buildServer.web.impl.ServerContextLoaderListener
java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'StatisticsPublisher' defined in URL [jar:file:/C:/TeamCity/webapps/ROOT/WEB-INF/lib/server.jar!/META-INF/buildServerSpring.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [jetbrains.buildServer.serverSide.statistics.impl.StatisticsPublisher]: Constructor threw exception; nested exception is org.springframework.jdbc.BadSqlGrammarException: ConnectionCallback; bad SQL grammar []; nested exception is java.sql.SQLException: Table already exists: STATS_PUBLISHER_STATE in statement [CREATE TABLE stats_publisher_state]



 


How can I fix this?

I am running Windows Server 2003 with the default teamcity database.

14 comments
Comment actions Permalink

Please provide teamcity-server.log file.

0
Comment actions Permalink

I attached the file.

By the way, by "TeamCity does not work" I meant I cannot access the web ui. I see a apache tomcat 404 window instead.



Attachment(s):
teamcity-server.log
0
Comment actions Permalink

When I execute "runall.bat stop" and "runall.bat start", this is the output:


07.May.2009 00:58:06 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performanc
e in production environments was not found on the java.library.path: C:\TeamCity
\jre\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\JavaFX\javafx-sdk1.1\
bin;C:\Program Files\JavaFX\javafx-sdk1.1\emulator\bin;C:\WINDOWS\system32;C:\WI
NDOWS;C:\WINDOWS\System32\Wbem;C:\TeamCity\webapps\ROOT\WEB-INF\lib
07.May.2009 00:58:07 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8111
07.May.2009 00:58:07 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 5126 ms
07.May.2009 00:58:07 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
07.May.2009 00:58:07 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.18
TeamCity data directory: C:/Documents and Settings/sozgel/.BuildServer
Database settings are not specified via C:\Documents and Settings\sozgel\.BuildS
erver\config\database.properties.
Using internal database.
Log4J configuraiton file C:\TeamCity\bin\..\conf\teamcity-server-log4j.xml will
be monitored with interval 10 seconds.
log4j:WARN No appenders could be found for logger (org.springframework.web.conte
xt.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
07.May.2009 00:58:54 org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
07.May.2009 00:58:54 org.apache.catalina.core.StandardContext start
SEVERE: Context [] startup failed due to previous errors
07.May.2009 00:58:56 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8111
07.May.2009 00:58:57 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
07.May.2009 00:58:57 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/78  config=null
07.May.2009 00:58:57 org.apache.catalina.startup.Catalina start
INFO: Server startup in 49978 ms



0
Comment actions Permalink

Could you please attach all logs for the case when server cannot start?

0
Comment actions Permalink

Thank you for your replies. I figured out that maybe it was a problem with the internal database. When I clear the database and restart teamcity, it creates the internal database and works fine again. So I decided to install a standalone database (sql express for now) and try that. But I also was not able to start teamcity with sqlexpress.

I deleted the internaldb, started teamcity so it created .BuildServer folder. I created a db for teamcity. I downloaded jtds driver and copied into WEB-INF\lib (I only copied the jar file, is it correct?). Now when I execute "runall.bat start" I get:

org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Network error IOException: Connection refused: connect)

Sql Express is installed on the same server and configured to allow remote connections both via ip and named pipes. I attached database.properties and all logs that are not empty.



Attachment(s):
teamcity-server.log
localhost.2009-05-07.log
catalina.2009-05-07.log
database.properties
0
Comment actions Permalink

You have a username and password problem.

Login through sql express to the database you created with the username and password you are using.  Try creating a table by hand.

0
Comment actions Permalink

Thanks, I solved the connection problem but that only took me to the initial problem again.

I thought the problem was the internal db and switched to sql express but it still continues. Here is what happens:

When I restart the server, I cannot access TeamCity web interface. I see apache 404 instead. At this point, both TeamCity services are running.

Then I manually stop these services and execute "runall.bat start". It executes successfully and web interface starts to work fine.

When I restart the server, the problem is back again.

I attached all the log files during this process.





Attachment(s):
stdout_20090508.log
jakarta_service_20090508.log
catalina.2009-05-08.log
teamcity-server.log
localhost.2009-05-08.log
0
Comment actions Permalink

Hello,

  Please try running your Windows service under the same user as you run TeamCity in console.
  I suppose there may be some permission issues when TeamCity is run as service.


  Hope this helps,

  KIR

0
Comment actions Permalink

Thanks but the user account the service is running on already has local administrator rights.

0
Comment actions Permalink

This issue is very strange. The problem is "stats_publisher_state" table should be created on server startup only if it does not exist. In your case it seems that condition for table existence is always false even for the case when table has already been created.

0
Comment actions Permalink

Any ideas on how I can fix that?

0
Comment actions Permalink

Could you please try to install TeamCity on another PC with internal database and without your configs (if you have them)?

0
Comment actions Permalink

Do you mean with the current internal database? Because I am no longer using that, I switched to SQL Express (same problem exists on both dbs).

0
Comment actions Permalink

No, just try to install TeamCity from scratch on another server. By default it will use internal database. Then try to start / restart to reproduce the problem. If everything is ok, try to connect this instance of TeamCity to your SQL express database.

0

Please sign in to leave a comment.