ActiveMQ has correct dialect but the SQL statements are incorrect AUTO_INCREMENT instead of IDENTITY tables creation - jboss

I'm using the following:
JBoss Wildfly 15.0.1.Final
MSSQL JDBC connector (i.e. mssql-jdbc-7.2.2.jre11.jar)
standalone-full.xml
I believe I have setup everything correctly. The MSSQL JDBC jar is in the modules directory with its associated module.xml. The datasource is correctly defined and functional. ActiveMQ Artemis has been setup (works fine using the file system). However when I attempt to have it use JDBC it fails trying to create the necessary tables with the following error:
SQLState: S0001 ErrorCode: 102 Message: Incorrect syntax near AUTO_INCREMENT'.
So I'm wondering what is wrong. ActiveMQ says it supports SQL Server, and it automatically figures out which SQL dialect to use based on the return value of the driver (I've checked that name with an 6.0 version of the driver and it is the same), also in the debug output it says
[org.apache.activemq.artemis.jdbc.store.journal.JDBCJournalImpl] ServerService Thread Pool -- 80) Detect database dialect as 'MSSQL'".
So that looks good. So I'm a bit confused on what is wrong and would like to get it to work. I'm providing the critical elements that I have in the standalone-full.xml. Is there any other setup I need or is this a bug?
Is this also a symptom of a problem? (i.e. see the log output...the broker is not initialized with correct driver/url that was specified by the datasource definition)
AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=false,jdbcDriverClassName=org.apache.derby.jdbc.EmbeddedDriver,jdbcConnectionUrl=null,messageTableName=AMQ_MESSAGES,bindingsTableName=AMQ_BINDINGS,largeMessageTableName=AMQ_LARGE_MESSAGES,pageStoreTableName=AMQ_PSTORE,)
excerpts from the standalone-full.xml settings
<extensions>
<extension module="org.wildfly.extension.messaging-activemq"/>
</extensions>
<datasources>
<datasource jndi-name="java:/RMBM-DEFAULT-DS" pool-name="RMBM-DEFAULT-DS" enabled="true">
<connection-url>jdbc:sqlserver://${rmbm.default.ds.host}:${rmbm.default.ds.port:1433};DatabaseName=${rmbm.default.ds.dbname}
</connection-url>
<driver>SQLSVR</driver>
</datasource>
<drivers>
<driver name="SQLSVR" module="com.microsoft.sqlserver.jdbc">
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver- class>
</driver>
</drivers>
<subsystem xmlns="urn:jboss:domain:messaging-activemq:5.0">
<server name="default">
<journal datasource="RMBM-DEFAULT-DS" messages-table="AMQ_MESSAGES" bindings-table="AMQ_BINDINGS"
jms-bindings-table="AMQ_JMS_BINDINGS" large-messages-table="AMQ_LARGE_MESSAGES" page-store-table="AMQ_PGSTORE"/>
</server>
</subsystem>
Here is a portion of the log output:
18:36:27,116 INFO [org.wildfly.extension.messaging-activemq] (MSC service thread 1-8) WFLYMSGAMQ0001: AIO wasn't located on this platform, it will fall back to using pure Java NIO.
18:36:27,665 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0006: Undertow HTTPS listener https listening on 127.0.0.1:443
18:36:27,808 INFO [org.jboss.ws.common.management] (MSC service thread 1-7) JBWS022052: Starting JBossWS 5.2.4.Final (Apache CXF 3.2.5.jbossorg-1)
18:36:27,964 DEBUG [org.apache.activemq.artemis.jdbc.store.journal.JDBCJournalImpl] (MSC service thread 1-8) Detect database dialect as 'MSSQL'.
18:36:27,968 INFO [org.wildfly.extension.messaging-activemq] (MSC service thread 1-8) use JDBC store for Artemis server, bindingsTable:AMQ_BINDINGS
18:36:28,065 DEBUG [org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl] (ServerService Thread Pool -- 80) Starting server ActiveMQServerImpl::
18:36:28,069 DEBUG [org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl] (ServerService Thread Pool -- 80) Detected no Shared Store HA options on JDBC store
18:36:28,121 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 80) AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=false,jdbcDriverClassName=org.apache.derby.jdbc.EmbeddedDriver,jdbcConnectionUrl=null,messageTableName=AMQ_MESSAGES,bindingsTableName=AMQ_BINDINGS,largeMessageTableName=AMQ_LARGE_MESSAGES,pageStoreTableName=AMQ_PSTORE,)
18:36:28,306 DEBUG [org.apache.activemq.artemis.jdbc.store.journal.JDBCJournalImpl] (ServerService Thread Pool -- 80) Detect database dialect as 'MSSQL'.
18:36:28,398 ERROR [org.apache.activemq.artemis.jdbc.store.drivers.AbstractJDBCDriver] (ServerService Thread Pool -- 80)
SQL STATEMENTS:
CREATE TABLE AMQ_LARGE_MESSAGES (ID BIGINT AUTO_INCREMENT, FILENAME VARCHAR(255), EXTENSION VARCHAR(10), DATA BLOB, PRIMARY KEY(ID))
SQL EXCEPTIONS:
SQLState: S0001 ErrorCode: 102 Message: Incorrect syntax near 'AUTO_INCREMENT'.
18:36:28,425 WARN [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 80) AMQ222010: Critical IO Error, shutting down the server. file=NULL, message=Unable to start database driver: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near 'AUTO_INCREMENT'.
at com.microsoft.sqlserver.jdbc//com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:262)
at com.microsoft.sqlserver.jdbc//com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1621)
at com.microsoft.sqlserver.jdbc//com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:868)
at com.microsoft.sqlserver.jdbc//com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:768)
at com.microsoft.sqlserver.jdbc//com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7194)
at com.microsoft.sqlserver.jdbc//com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2935)
at com.microsoft.sqlserver.jdbc//com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:248)
at com.microsoft.sqlserver.jdbc//com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:223)
at com.microsoft.sqlserver.jdbc//com.microsoft.sqlserver.jdbc.SQLServerStatement.executeUpdate(SQLServerStatement.java:711)
at org.jboss.ironjacamar.jdbcadapters#1.4.11.Final//org.jboss.jca.adapters.jdbc.WrappedStatement.executeUpdate(WrappedStatement.java:430)
at org.apache.activemq.artemis#2.6.3.jbossorg-00014//org.apache.activemq.artemis.jdbc.store.drivers.AbstractJDBCDriver.createTableIfNotExists(AbstractJDBCDriver.java:258)
at org.apache.activemq.artemis#2.6.3.jbossorg-00014//org.apache.activemq.artemis.jdbc.store.drivers.AbstractJDBCDriver.createTable(AbstractJDBCDriver.java:118)
at org.apache.activemq.artemis#2.6.3.jbossorg-00014//org.apache.activemq.artemis.jdbc.store.file.JDBCSequentialFileFactoryDriver.createSchema(JDBCSequentialFileFactoryDriver.java:69)
at org.apache.activemq.artemis#2.6.3.jbossorg-00014//org.apache.activemq.artemis.jdbc.store.drivers.AbstractJDBCDriver.start(AbstractJDBCDriver.java:83)
at org.apache.activemq.artemis#2.6.3.jbossorg-00014//org.apache.activemq.artemis.jdbc.store.file.JDBCSequentialFileFactory.start(JDBCSequentialFileFactory.java:131)
at org.apache.activemq.artemis#2.6.3.jbossorg-00014//org.apache.activemq.artemis.core.persistence.impl.journal.JDBCJournalStorageManager.init(JDBCJournalStorageManager.java:92)
at org.apache.activemq.artemis#2.6.3.jbossorg-00014//org.apache.activemq.artemis.core.persistence.impl.journal.AbstractJournalStorageManager.<init>(AbstractJournalStorageManager.java:229)
at org.apache.activemq.artemis#2.6.3.jbossorg-00014//org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager.<init>(JournalStorageManager.java:106)
at org.apache.activemq.artemis#2.6.3.jbossorg-00014//org.apache.activemq.artemis.core.persistence.impl.journal.JDBCJournalStorageManager.<init>(JDBCJournalStorageManager.java:55)
at org.apache.activemq.artemis#2.6.3.jbossorg-00014//org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.createStorageManager(ActiveMQServerImpl.java:2155)
at org.apache.activemq.artemis#2.6.3.jbossorg-00014//org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.initialisePart1(ActiveMQServerImpl.java:2296)
at org.apache.activemq.artemis#2.6.3.jbossorg-00014//org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation.run(LiveOnlyActivation.java:64)
at org.apache.activemq.artemis#2.6.3.jbossorg-00014//org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.internalStart(ActiveMQServerImpl.java:535)
at org.apache.activemq.artemis#2.6.3.jbossorg-00014//org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.start(ActiveMQServerImpl.java:474)
at org.apache.activemq.artemis#2.6.3.jbossorg-00014//org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl.start(JMSServerManagerImpl.java:376)
at org.wildfly.extension.messaging-activemq//org.wildfly.extension.messaging.activemq.jms.JMSService.doStart(JMSService.java:206)
at org.wildfly.extension.messaging-activemq//org.wildfly.extension.messaging.activemq.jms.JMSService.access$000(JMSService.java:65)
at org.wildfly.extension.messaging-activemq//org.wildfly.extension.messaging.activemq.jms.JMSService$1.run(JMSService.java:100)

It appears that even though the dialect is correctly detected as MSSQL the broker doesn't have the corresponding SQL statements to properly support it. The SQL statements for MSSQL were added in ActiveMQ Artemis 2.6.4 via ARTEMIS-2202. You're using 2.6.3 so you don't have those.
Upgrading ActiveMQ Artemis in Wildfly can sometimes fail due to the tight coupling between the two so if you don't want to try upgrading you could theoretically crack open the artemis-jdbc-store jar file and add/replace these lines to journal-sql.properties
# MSSQL SQL statements
create-file-table.mssql=CREATE TABLE %s (ID BIGINT NOT NULL IDENTITY, FILENAME VARCHAR(255), EXTENSION VARCHAR(10), DATA VARBINARY(max), PRIMARY KEY(ID))
create-journal-table.mssql=CREATE TABLE %s(id BIGINT,recordType SMALLINT,compactCount SMALLINT,txId BIGINT,userRecordType SMALLINT,variableSize INTEGER,record VARBINARY(max),txDataSize INTEGER,txData VARBINARY(max),txCheckNoRecords INTEGER,seq BIGINT NOT NULL, PRIMARY KEY(seq))
max-blob-size.mssql=2147483647
Regarding the AMQ221000 log message that indicates there is an incorrect JDBC driver configuration...This is due to the fact that the ActiveMQ Artemis broker has its own JDBC driver configuration for when it's running standalone. When it's embedded in Wildfly and configured to use a datasource via JNDI then the standalone JDBC driver configuration isn't used. It will simply look up the specified datasource and use that.

Related

missing mechanism database entry "TLS_RSA_FIPS_WITH_DES_CBC_SHA"

While updating some encryption methods in standalone.xml i am getting missing mechanism database entry 13:45:23,793 WARN [org.wildfly.security] (MSC service thread 1-8) ELY01077: Invalid alias "TLS_RSA_WITH_DES_CBC_SHA" for missing mechanism database entry "TLS_RSA_FIPS_WITH_DES_CBC_SHA"

Keycloak retry database connection during startup

I have Keycloak on one server configured to connect to a remote PostgreSQL database, both the database and the Keycloak server start at the same time in the morning but the database takes a little more time before it's available which prevents the Keycloak service from starting:
WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (ServerService Thread Pool -- 63) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: IJ031084: Unable to create connection
I tried adding the following lines to standalone.xml but it only seems to prevent Keycloak from crashing if it's already started and the database reboots:
<validation>
<check-valid-connection-sql>select 1</check-valid-connection-sql>
<validate-on-match>false</validate-on-match>
<background-validation>true</background-validation>
<background-validation-millis>15000</background-validation-millis>
</validation>
If anyone is looking for a solution and is using systemd, I ended up adding these two lines to my keycloak.service file in the [Service] block:
Restart=always
RestartSec=5min

Deploy Fuse Camel Project on EAP

I build a simple Camel Project with a SOAP Web Service that writes a file and sends the response: it's packaged as bundle and I deployed it successfully on Karaf, you can find the source here
Firefox Send
Then I'd like to convert this project in a WAR module and deploy it on Fuse on EAP: following these instructions
Apache Camel: Tutorial on using Camel in a Web Application
I modified (in pom.xml) bundle -> war, I moved applicationContext.xml under src/main/webapp, and I created a web.xml with the Spring context loader: when I install the WAR I see (on server logs) that the Camel route is started but the SOAP WS isn't exposed
10:03:40,981 INFO [org.apache.camel.spring.SpringCamelContext] (ServerService Thread Pool -- 75) Apache Camel 2.15.1 (CamelContext: camelId) is starting
10:03:40,994 INFO [org.apache.camel.management.ManagedManagementStrategy] (ServerService Thread Pool -- 75) JMX is enabled
10:03:41,120 INFO [org.apache.camel.impl.converter.DefaultTypeConverter] (ServerService Thread Pool -- 75) Loaded 197 type converters
10:03:41,339 INFO [org.apache.camel.spring.SpringCamelContext] (ServerService Thread Pool -- 75) AllowUseOriginalMessage is enabled. If access to the original message is not needed, then its recommended to turn this option off as it may improve performance.
10:03:41,339 INFO [org.apache.camel.spring.SpringCamelContext] (ServerService Thread Pool -- 75) StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
10:03:41,370 INFO [org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean] (ServerService Thread Pool -- 75) Creating Service {http://www.springframework.org/schema/beans}CamelHelloWorldService from WSDL: classpath:wsdl/Hello.wsdl
10:03:41,732 INFO [org.apache.cxf.endpoint.ServerImpl] (ServerService Thread Pool -- 75) Setting the server's publish address to be /CamelHelloWorld
10:03:41,764 INFO [org.apache.camel.spring.SpringCamelContext] (ServerService Thread Pool -- 75) Route: route2 started and consuming from: Endpoint[cxf://bean:helloWorldEndpointId]
10:03:41,764 INFO [org.apache.camel.spring.SpringCamelContext] (ServerService Thread Pool -- 75) Total 1 routes, of which 1 is started.
10:03:41,764 INFO [org.apache.camel.spring.SpringCamelContext] (ServerService Thread Pool -- 75) Apache Camel 2.15.1 (CamelContext: camelId) started in 0.783 seconds
10:03:41,764 INFO [org.springframework.web.context.ContextLoader] (ServerService Thread Pool -- 75) Root WebApplicationContext: initialization completed in 2131 ms
10:03:41,826 INFO [org.jboss.as.server] (HttpManagementService-threads - 2) JBAS015859: Deployed "camel-hello-world-0.0.21-SNAPSHOT.war" (runtime-name : "camel-hello-world-0.0.21-SNAPSHOT.war")
To be honest I see this exception too
10:03:39,711 WARN [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (ServerService Thread Pool -- 75) Ignored XML validation warning: org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 419; SchemaLocation: schemaLocation value = ' http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd http://camel.apache.org/schema/cxf/camel-cxf-spring.xsd' must have even number of URI's.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:196)
at org.apache.xerces.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:97)
at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386)
at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:322)
but I think it's only a warning.
Does anyone have any idea?
Thanks in advance
The 'must have even number of URI's' exception is because you have a superfluous entry for camel-cxf-spring.xsd at the end of the xsi:schemaLocation.
You may find it better to base your code on the Camel Tomcat CXF example as it demonstrates how to set up CXFServlet in web.xml. You'll need this is you want the CXF consumer to work. E.g like this:
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/webservices/*</url-pattern>
</servlet-mapping>
If you're using Fuse on EAP 7.0 or 7.1, you can avoid the Spring ContextLoaderListener and CXFServlet as the app server takes care of bootstrapping Spring & CXF for you. There's an example project here.

"IllegalArgumentException: Name must not be null" when deploying to jboss

(I already solved this problem, but posting it here to help others.)
I recently upgraded from Grails 2.4.4 to Grails 3. When deploying to JBoss EAP 6.4 (Wildfly 7), I receive the following error in the server log and the application fails to start:
09-06 20:46:18,463 ERROR [org.jboss.as.web.deployment.JBossContextConfig] (ServerService Thread Pool -- 90) JBAS018202: Error calling onStartup for servlet container initializer: org.springframework.web.SpringServletContainerInitializer: java.lang.IllegalArgumentException: Name must not be null
at org.springframework.util.Assert.notNull(Assert.java:115) [spring-core-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.util.ClassUtils.forName(ClassUtils.java:214) [spring-core-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:284) [spring-core-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.grails.transaction.ChainedTransactionManagerPostProcessor.resolveTransactionManagerClass(ChainedTransactionManagerPostProcessor.java:158) [grails-core-3.1.5.jar:3.1.5]
at org.grails.transaction.ChainedTransactionManagerPostProcessor.hasJtaOrChainedTransactionManager(ChainedTransactionManagerPostProcessor.java:143) [grails-core-3.1.5.jar:3.1.5]
at org.grails.transaction.ChainedTransactionManagerPostProcessor.postProcessBeanDefinitionRegistry(ChainedTransactionManagerPostProcessor.java:119) [grails-core-3.1.5.jar:3.1.5]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:123) [spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:678) [spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:520) [spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at grails.boot.GrailsApp.run(GrailsApp.groovy:55) [grails-core-3.1.5.jar:3.1.5]
I have two different data sources in the application, both of which are registered in JNDI.
After running through a debugger, I see that transactionManagerBeanDefinition.getBeanClassName() returns null but I am not sure why.
Why would this error be happening, and how would I solve it?
This link led me to the answer.
The problem seems to be caused by there being multiple datasources in my application, which causes Spring / JBoss to get confused when setting up the transaction manager.
The solution is to set transactional: false in application.yml for the second datasource. This worked perfect for me, since the second datasource is read-only anyway.
application.yml:
dataSources:
dataSource:
dialect: "..."
otherDataSource:
dialect: "..."
transactional: false <------ add this line

Openshift - deploying simple Java EE app on Wildfly fails

I'm trying to deploy a very simple application on Openshift. It's an EAR project with a single WAR and EJB module. Inside the WAR there's a REST service that calls an EJB defined in EJB module. Locally and on Openshift I'm using Wildfly 9.0.0 CR2 and PostgreSQL 9.2. When deploying locally everything works fine. When the same code is deployed on Openshift I'm getting following errors in logs:
2015-06-28 18:23:04,574 WARN [org.jboss.as.clustering.jgroups] (MSC service thread 1-1) WFLYCLJG0006: property bind_addr for protocol org.jgroups.protocols.TCP attempting to override socket binding value 127.12.77.1 : property value 127.12.77.1 will be ignored
2015-06-28 18:23:04,574 WARN [org.jboss.as.clustering.jgroups] (MSC service thread 1-1) WFLYCLJG0006: property bind_port for protocol org.jgroups.protocols.TCP attempting to override socket binding value 7600 : property value 7600 will be ignored
2015-06-28 18:23:06,252 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 70) WFLYJPA0010: Starting Persistence Unit (phase 2 of 2) Service 'cooking.ear/cooking-ejb-1.0-SNAPSHOT.jar#cookingPU'
2015-06-28 18:23:08,165 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.jgroups.channel.ee: org.jboss.msc.service.StartException in service jboss.jgroups.channel.ee: java.security.PrivilegedActionException: java.net.BindException: [TCP] /127.12.77.1 is not a valid address on any local network interface
at org.wildfly.clustering.jgroups.spi.service.ChannelBuilder.start(ChannelBuilder.java:79)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.security.PrivilegedActionException: java.net.BindException: [TCP] /127.12.77.1 is not a valid address on any local network interface
at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:638)
at org.jboss.as.clustering.jgroups.JChannelFactory.createChannel(JChannelFactory.java:99)
at org.wildfly.clustering.jgroups.spi.service.ChannelBuilder.start(ChannelBuilder.java:77)
... 5 more
Caused by: java.net.BindException: [TCP] /127.12.77.1 is not a valid address on any local network interface
at org.jgroups.util.Util.checkIfValidAddress(Util.java:3480)
at org.jgroups.stack.Configurator.ensureValidBindAddresses(Configurator.java:902)
at org.jgroups.stack.Configurator.setupProtocolStack(Configurator.java:118)
at org.jgroups.stack.Configurator.setupProtocolStack(Configurator.java:57)
at org.jgroups.stack.ProtocolStack.setup(ProtocolStack.java:477)
at org.jgroups.JChannel.init(JChannel.java:854)
at org.jgroups.JChannel.<init>(JChannel.java:159)
at org.jboss.as.clustering.jgroups.JChannelFactory$1.run(JChannelFactory.java:96)
at org.jboss.as.clustering.jgroups.JChannelFactory$1.run(JChannelFactory.java:93)
at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:634)
... 7 more
The address mentioned - 127.12.77.1 is $OPENSHIFT_WILDFLY_IP.
I have no idea what is causing this issue. First I thought it's a database connectivity issue because it happens when 2nd phase of starting persistence unit happens. I connected to DB on Openshift and saw that it was created successfully so maybe that's not it, but here's the persistence.xml I'm using:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="cookingPU">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>java:jboss/datasources/PostgreSQLDS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL9Dialect" />
</properties>
</persistence-unit>
</persistence>
The datasource used is the default one. I didn't change anything in standalone.xml.
Another thing I noticed is that the deploy problem happens when I add any EJB to the project.
This is a simple one I tried to use:
#Stateless
public class AnyEjb {
public String hello() {
return "Hi there!";
}
}
This is defined in EJB module. Then in web module I have this class calling it:
#Path("anything")
#Consumes(MediaType.APPLICATION_JSON)
#Produces(MediaType.APPLICATION_JSON)
public class AnyEndpoint {
#EJB
private AnyEjb anyEjb;
#GET
public String sayHi() {
return anyEjb.hello();
}
}
I'm not sure if and how it can be connected with this BindException.
I've tried running this application locally with both standalone and standalone-full-ha profile and it works in both cases. I just feel it has to be some issue with Openshift configuration but I have no idea where to look anymore. I'm very new to Openshift and Java EE. Please point me in a right direction. Any help will be much appreciated.
Might be https://issues.jboss.org/browse/JGRP-1928. Talk to Rado Husar to see how to resolve this.
It looks like the problem is (as #Bela Ban suggested) connected with the version of JGroups shipped with WildFly 9.0.0CR2. I will be waiting for the fix coming with the Final version of WildFly.
Meanwhile as a workaround to be able to deploy an application on WildFly 9.0.0CR2 on Openshift, I decided to disable clustering capabilities for my server.
In standalone.xml available in .openshift I have removed org.jboss.as.clustering.jgroups module and changed infinispan cache settings from distributed to local.
I have been basing on this solution (for WildFly 8): https://gist.github.com/fjuma/3df7f64fbaebd5506ef5#file-standalone-xml
But I had to modify it so that it works on Wildfly 9. Full standalone.xml that's been working for me is available here for reference http://pastebin.com/aANkPUWk