Discussion:
[jboss-user] [JBoss Tools] - MSSQL Server datasource cause exception whenever one start up the server
Guillermo López
2013-02-21 22:45:19 UTC
Permalink
Guillermo López [https://community.jboss.org/people/gmlopezdev] created the discussion

"MSSQL Server datasource cause exception whenever one start up the server"

To view the discussion, visit: https://community.jboss.org/message/798971#798971

--------------------------------------------------------------
I have an issue whenever I try to startup the AS7 runtime from eclipse servers view. I've setup an mssql server datasource and it throws an ssl exception. The server is not configured to require ssl. This does not happen when I start it up from command line by issueing a standalone.bat.

Any ideas???

The exception I get is as the following:

java.ext.dirs: C:\Program Files\Java\jdk1.7.0_13\jre\lib\ext;C:\Windows\Sun\Java\lib\ext
20:01:57,191 WARN  [org.hibernate.engine.jdbc.internal.JdbcServicesImpl] (MSC service thread 1-7) HHH000342: Could not obtain connection to query metadata : javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:jboss/datasources/gisDS
20:01:57,204 INFO  [org.hibernate.dialect.Dialect] (MSC service thread 1-7) HHH000400: Using dialect: org.hibernate.dialect.SQLServerDialect
20:01:57,199 WARN  [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (MSC service thread 1-3) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: Could not create connection
          at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:277)
          at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:235)
          at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:761)
          at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:343)
          at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:397)
          at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365)
          at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)
          at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)
          at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)
          at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:129)
          at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:67) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
          at org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:253) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
          at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:119) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
          at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
          at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
          at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
          at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:71) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
          at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2270) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
          at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2266) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1735) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
          at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
          at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_13]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_13]
          at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_13]
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "RSA premaster secret error". ClientConnectionId:98e0dfa4-42e8-42a1-8d37-c0f8ec7098e1
          at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1667)
          at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1668)
          at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1323)
          at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
          at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
          at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
          at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:249)
          ... 30 more
Caused by: javax.net.ssl.SSLKeyException: RSA premaster secret error
          at sun.security.ssl.RSAClientKeyExchange.<init>(Unknown Source) [jsse.jar:1.7.0_13]
          at sun.security.ssl.ClientHandshaker.serverHelloDone(Unknown Source) [jsse.jar:1.7.0_13]
          at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source) [jsse.jar:1.7.0_13]
          at sun.security.ssl.Handshaker.processLoop(Unknown Source) [jsse.jar:1.7.0_13]
          at sun.security.ssl.Handshaker.process_record(Unknown Source) [jsse.jar:1.7.0_13]
          at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source) [jsse.jar:1.7.0_13]
          at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) [jsse.jar:1.7.0_13]
          at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) [jsse.jar:1.7.0_13]
          at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) [jsse.jar:1.7.0_13]
          at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1618)
          ... 35 more
Caused by: java.security.NoSuchAlgorithmException: SunTlsRsaPremasterSecret KeyGenerator not available
          at javax.crypto.KeyGenerator.<init>(KeyGenerator.java:158) [jce.jar:1.7.0_10]
          at javax.crypto.KeyGenerator.getInstance(KeyGenerator.java:207) [jce.jar:1.7.0_10]
          at sun.security.ssl.JsseJce.getKeyGenerator(Unknown Source) [jsse.jar:1.7.0_13]
          ... 45 more
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/798971#798971]

Start a new discussion in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128]
Max Rydahl Andersen
2013-02-22 09:17:01 UTC
Permalink
Max Rydahl Andersen [https://community.jboss.org/people/maxandersen] created the discussion

"Re: MSSQL Server datasource cause exception whenever one start up the server"

To view the discussion, visit: https://community.jboss.org/message/799031#799031

--------------------------------------------------------------
Any chance you are using a JDK on the command line and only a JRE when launching from within eclipse ?

Any chance you are on Mac and recently updated java ? Then you might have the problem described at http://stackoverflow.com/questions/2872520/suntlsrsapremastersecret-keygenerator-not-available http://stackoverflow.com/questions/2872520/suntlsrsapremastersecret-keygenerator-not-available

Solution: remove the JDK/JRE detected in eclipse and add it again.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/799031#799031]

Start a new discussion in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128]
Guillermo L
2013-02-22 13:30:03 UTC
Permalink
Guillermo L [https://community.jboss.org/people/gmlopezdev] created the discussion

"Re: MSSQL Server datasource cause exception whenever one start up the server"

To view the discussion, visit: https://community.jboss.org/message/799069#799069

--------------------------------------------------------------
Great!
I've spent lot of time with this issue :-(.

However I had to follow the procedure as if I had a Mac but I have a Windows 7 64 bits...

Just for the "records". The first thing I tried was to add the jre as possible runtime to the IDE. Switched the server JRE config from jdk to jre. After that the server launched successfully. Switching back to jdk caused the same error again so I removed the jdk, restarted the IDE, added jdk again as runtime, switched the server JRE config from jre7 to jdk7 and started to work :-).

Thank you very much for the hint! It was really really helpful!
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/799069#799069]

Start a new discussion in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128]
Max Rydahl Andersen
2013-02-26 07:55:33 UTC
Permalink
Max Rydahl Andersen [https://community.jboss.org/people/maxandersen] created the discussion

"Re: MSSQL Server datasource cause exception whenever one start up the server"

To view the discussion, visit: https://community.jboss.org/message/799530#799530

--------------------------------------------------------------
Glad it helped :)

But yeah i've seen more than a few horror stories about how oracle's latest updates changes the layout of the JDK runtime, in some cases even remove it.
This of course makes Eclipse kinda "lost" since runtimes are removed or changed "Behind its back" but luckily eclipse JDT is written to handle these things but as you've seen only triggers on reload of the JDK/JRE runtimes.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/799530#799530]

Start a new discussion in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128]
Guillermo L
2013-02-26 10:20:15 UTC
Permalink
Guillermo L [https://community.jboss.org/people/gmlopezdev] created the discussion

"Re: MSSQL Server datasource cause exception whenever one start up the server"

To view the discussion, visit: https://community.jboss.org/message/799570#799570

--------------------------------------------------------------
It was actually weird!

Anyway thanks again for your help!
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/799570#799570]

Start a new discussion in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128]
Loading...