4

I get the stack trace below when running start.ps1 to start the Discovery service in the powershell. The database is running on my local MSSQLSERVER instance which I have confirmed is on port 1433.

My storage configuration looks like this:

<Storage Type="persistence" Id="defaultdb" dialect="MSSQL" 
         Class="com.tridion.storage.persistence.JPADAOFactory">
    <Pool Type="jdbc" Size="10" 
          MonitorInterval="60" IdleTimeout="120" CheckoutTimeout="120" />
    <DataSource Class="com.microsoft.sqlserver.jdbc.SQLServerDataSource">
        <Property Name="serverName" Value="(local)" />
        <Property Name="portNumber" Value="1433" />
        <Property Name="databaseName" Value="Tridion_DiscoveryService"/>
        <Property Name="user" Value="TridionBrokerUser" />
        <Property Name="password" Value="It's a secret" />
    </DataSource>
</Storage>

I can connect to the database and execute SQL from a Powershell script that uses the same values as in the properties of the data source.

The exception seems to be telling me that there is a problem making a connection to the database. Having checked the basic details, I am now looking for suggestions as to what else might cause this failure.

Here is the stack trace:

java.exe : Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceFactoryImpl': Injection of autowired dependencies failed; nested exception is org.springframework.bean s.factory.BeanCreationException: Could not autowire field: private java.util.List com.sdl.odata.processor.datasource.fa ctory.DataSourceFactoryImpl.dataSourceProviders; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'tridionConfigDataSourceProvider': Injection of autowired dependencies failed; nes ted exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.sdl.web .discovery.datalayer.TridionConfigDataSource com.sdl.web.discovery.datalayer.TridionConfigDataSourceProvider.dataSource ; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tridionCo nfigDataSource': Invocation of init method failed; nested exception is javax.persistence.PersistenceException: org.hibe rnate.exception.JDBCConnectionException: Could not open connection At C:\SDLWebCDServices\Discovery\bin\start.ps1:42 char:5 + & $java_run $jvmoptions -cp $classpath $className $arguments + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (Exception in th...open connection:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(Auto wiredAnnotationBeanPostProcessor.java:334) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapabl eBeanFactory.java:1210) at ===================== Lots more lines of stack trace... removed for clarity ===================== at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:236) at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1300) at org.hibernate.internal.QueryImpl.list(QueryImpl.java:103) at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:573) at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:449) ... 54 more Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host (local), port 1433 has fa iled. Error: "null. Verify the connection properties. Make sure that an instance of SQL Server is running on the host a nd accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall." . at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:191) at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.j ava:242) at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2280) at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:493) at ============================= More trimmed here

4
  • 2
    Try replacing (local) with localhost. I think it may be a window-ism that java doesn't want to know about.
    – Quirijn
    Mar 23, 2016 at 20:45
  • Thanks Quirijn. I'd already considered this, but still worth checking. It turns out that with (local) I see the stack trace after a timeout of about 50 seconds. With localhost, it appears never to timeout. The script just hangs. Mar 23, 2016 at 22:36
  • 1
    I tried within a working environment changing to "(local)" and gives me the same error. Try with localhost or the hostname, to achieve the database connection, and check the cd_core logs of the discovery service Mar 24, 2016 at 9:10
  • I've just realised that start.ps1 doesn't give any feedback when the service starts, so when I said "The script just hangs", what was actually happening was that Quirijn was right. Raul also deserves a credit for making me look again. Thanks guys... Quirijn - if you make it an answer I'll accept it. Mar 24, 2016 at 20:04

1 Answer 1

5

The solution, as suggested by Quirijn and Raúl, was to replace the string (local) in the serverName property with the machine name.

I've just checked my 2013 server to confirm that I have used (local) in my storage configs there without any problems. It seems this is a new "gotcha".

1
  • I always use "localhost" so I know for sure that works. Mar 31, 2016 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.