tomcat conf/context.xml - Property 'factory' not supported - tomee-7

I'm trying to change the connection pool of my web app to use the Tomcat Connection pool (org.apache.tomcat.jdbc.pool.DataSourceFactory). So, I added the factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" line into the conf/context.xml file, like below:
<Context>
<Resource
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
name="jdbc/mcbell"
auth="Application"
maxActive="50"
maxIdle="30"
maxWait="10000"
removeAbandoned="true"
removeAbandonedTimeout="1200"
logAbandoned="true"
driverClassName="com.ibm.as400.access.AS400JDBCDriver"
url="jdbc:as400://mcbell4;secure=true;naming=system;errors=full;prompt=false;libraries=*LIBL;timeFormat=iso;dateFormat=iso;dateSeparator=-"
username=""
password=""
validationQuery="select 1 from sysibm/sysdummy1"
alternateUsernameAllowed="true"
validationQueryTimeout="10"
validationInterval="30000"
testWhileIdle="true"
timeBetweenEvictionRunsMillis="30000"
minEvictableIdleTimeMillis="30000"
/>
</Context>
The reason for changing it to Tomcat connection pool is so that I can use this validationInterval property. But the validationInterval still does not seem to be working. In the log I see this warning below. Is that means that the Tomcat Connection Pool setting is not taking effect? Why is the factory property not supported?
INFO: Creating Resource(id=host-manager/jdbc/mcbell)
Nov 14, 2018 3:17:11 PM org.apache.openejb.assembler.classic.Assembler unusedProperty
WARNING: Property "factory" not supported by "host-manager/jdbc/mcbell"

Related

How to append kubernetes container id/name to log file in log4j.xml

but the problem is my application is running before my server started (WebLogic server).
Your question seems to be in reference to Log4j 1. Log4j 1 has been end-of-life since August of 2015.
Upgrading to Log4j 2.13.0 would allow you to use the Kubernetes Lookup which would allow you to configure your log file name as:
<File name="MyFile" filename="${path}/app_${k8s:containerName}.${date:MM-dd-yyyy}.log>
<PatternLayout>
<Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
</PatternLayout>
</File>

Unable to register Kie Server with Kie Workbench

"I'm setting up Kie Workbench 7.5 and Kie Server 7.5 both into tomcat 8.
But "Remote Servers" is showing blank list.
For installation reference I used http://blog.athico.com/2015/10/installing-kie-server-and-workbench-on.html this blog.
Once I hit http://localhost:8080/kie-server/services/rest/server this URL I am getting expected output as below:
<response type="SUCCESS" msg="Kie Server info">
<kie-server-info>
<capabilities>KieServer</capabilities>
<capabilities>BRM</capabilities>
<capabilities>BPM</capabilities>
<capabilities>CaseMgmt</capabilities>
<capabilities>BPM-UI</capabilities>
<capabilities>BRP</capabilities>
<capabilities>DMN</capabilities>
<capabilities>Swagger</capabilities>
<location>
http://localhost:8080/kie-server/services/rest/server
</location>
<name>tomcat-kieserver</name>
<id>tomcat-kieserver</id>
<version>7.5.0.Final</version>
</kie-server-info>
</response>
Configuration which I proviced
1. setenv.bat
set CATALINA_OPTS=-Xmx512M -Djbpm.tsr.jndi.lookup=java:comp/env/TransactionSynchronizationRegistry -Dorg.kie.server.persistence.ds=java:comp/env/jdbc/jbpm -Djbpm.tm.jndi.lookup=java:comp/env/TransactionManager -Dorg.kie.server.persistence.tm=JBossTS -Dhibernate.connection.release_mode=after_transaction -Dorg.kie.server.id=tomcat-kieserver -Djava.security.auth.login.config=C:/softwares/apache-tomcat-8.5.43/webapps/kie-drools-wb/WEB-INF/classes/login.config -Dorg.kie.server.location=http://localhost:8080/kie-server/services/rest/server -Dorg.kie.server.controller=http://localhost:8080/kie-drools-wb/rest/controller -Dcom.arjuna.ats.jta.recovery.XAResourceRecovery1=com.arjuna.ats.internal.jdbc.recovery.BasicXARecovery;abs://C:/softwares/apache-tomcat-8.5.43/conf/xa-recovery-properties.xml
2. server.xml
<Valve className="org.kie.integration.tomcat.JACCValve" />
3. context.xml
<Resource name="sharedDataSource"
auth="Container"
type="org.h2.jdbcx.JdbcDataSource"
user="sa"
password="sa"
url="jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;MVCC=TRUE"
description="H2 Data Source"
loginTimeout="0"
testOnBorrow="false"
factory="org.h2.jdbcx.JdbcDataSourceFactory"/>
4. xa-recovery-properties.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<entry key="DB_1_DatabaseUser">sa</entry>
<entry key="DB_1_DatabasePassword">sa</entry>
<entry key="DB_1_DatabaseDynamicClass"></entry>
<entry key="DB_1_DatabaseURL">java:comp/env/h2DataSource</entry>
</properties>
On Tomcat console I am getting below warning:
WARNING [KieServer-ControllerConnect] org.kie.server.services.impl.controller.DefaultRestControllerImpl.connectToSingleController Exception encountered while syncing with controller at http://localhost:8080/kie-drools-wb/rest/controller/server/tomcat-kieserver error Error while sending PUT request to http://localhost:8080/kie-drools-wb/rest/controller/server/tomcat-kieserver response code 401
Workbench 7.0+ is not support Tomcat any more. If you want to use Workbench (it is already renamed to Business Central and has latest version 7.24) it should run on Wildfly 14.
You can try this quick start (just unzip file and it is ready to try or copy configurations): https://www.jbpm.org/learn/gettingStarted.html
If you need to start Workbench on Tomcat, you should use 6.x (which is not supported any more).

Failover Artemis URI in WIldfly 14

Is it possible to configure failover URI for native Artemis server in Wildfly 14? I'd like to create pooled connection factory with url like (tcp://localhost:61616,tcp://localhost:61617). As far as I know wildfly creates connection factory from connector host and port. I use Wildfly 14.0.1.Final and Artemis 2.6.3.
Update
<remote-connector name="remote-artemis-master" socket-binding="remote-artemis-master" />
<remote-connector name="remote-artemis-slave" socket-binding="remote-artemis-slave" />
<pooled-connection-factory
ha="true"
name="activemq-ra"
connectors="remote-artemis-master remote-artemis-slave"
entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory"
transaction="xa"
user="user"
password="password" />
Update
When master node stops the slave becomes live but the jee app is unable to send/consume messages 30 for seconds. After this period everything works fine.
The syntax (tcp://localhost:61616,tcp://localhost:61617) is just a way to configure multiple initial connectors via a URL. You can accomplish the same thing in Wildfly by defining multiple remote-connector elements and referencing those in the connectors attribute of the pooled-connection-factory.

JBOSS Migration AS6 to EAP 7 404 Error

This question is Not Answered.(Mark as assumed answered)
Andy Gowdy
Newbie
Andy Gowdy 31-Mar-2017 06:56
HI
I am having difficulty referencing an ear file after I have deployed it in EAP 7. I have no deployment errors but when I try to access the the ear /beans through the URL I get a 404 error. In the now deprecated JBOSS.xml the URI was configured as shown. Any help would be much appreciated. Many Thanks Andy
<jboss>
<enterprise-beans>
<session>
<ejb-name>HousingFacadeEJB</ejb-name>
<jndi-name>HousingFacadeEJB</jndi-name>
<local-jndi-name>LocalHousingFacadeEJB</local-jndi-name>
<call-by-value>false</call-by-value>
<!-- <configuration-name>Facade</configuration-name> -->
<clustered>false</clustered>
<port-component>
<port-component-name>HousingFacade</port-component-name>
<port-component-uri>HousingFacade/HousingFacadeEJB
</port-component-uri>
</port-component>
</session>
</enterprise-beans>
<container-configurations>
<container-configuration extends="Standard Stateless SessionBean">
<container-name>HousingFacade</container-name>
<container-pool-conf>
<MinimumSize>50</MinimumSize>
<MaximumSize>150</MaximumSize>
</container-pool-conf>
</container-configuration>
</container-configurations>
</jboss>
----------------------------------------------------------
I have replaced this with a JBOSS-EJB3.xml
<enterprise-beans>
<session>
<ejb-name>HousingFacadeEJB2_Live</ejb-name>
<home>com.comino.cxm.housingfacade.HousingFacadeHome</home>
<remote>com.comino.cxm.housingfacade.HousingFacade</remote>
<local-home>com.comino.cxm.housingfacade.LocalHousingFacadeHome</local-home>
<local>com.comino.cxm.housingfacade.LocalHousingFacade</local>
<ejb-class>com.comino.cxm.housingfacade.HousingFacadeBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<env-entry>
<env-entry-name>UHDSJNDINAME</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>java:/UHTLIVE_2</env-entry-value>
</env-entry>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>HousingFacadeEJB2_Live</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
My ejb-jar.xml
<jboss:ejb-jar>
<enterprise-beans>
<session>
<ejb-name>HousingFacadeEJB2_Live</ejb-name>
<home>com.comino.cxm.housingfacade.HousingFacadeHome</home>
<remote>com.comino.cxm.housingfacade.HousingFacade</remote>
<local-home>com.comino.cxm.housingfacade.LocalHousingFacadeHome</local-home>
<local>com.comino.cxm.housingfacade.LocalHousingFacade</local>
<ejb-class>com.comino.cxm.housingfacade.HousingFacadeBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<env-entry>
<env-entry-name>UHDSJNDINAME</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>java:/UHTLIVE_2</env-entry-value>
</env-entry>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>HousingFacadeEJB2_Live</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</jboss:ejb-jar>
JBOSS Server log extract.. I have redacted the connection addresses.
----------------------------REQUEST---------------------------
URI=/HousingFacade2_Live/HousingFacadeEJB2_Live
characterEncoding=null
contentLength=1304
contentType=[text/xml; charset=utf-8]
header=Connection=Keep-Alive
header=SOAPAction=""
header=Cache-Control=no-cache
header=Content-Type=text/xml; charset=utf-8
header=Content-Length=1304
header=User-Agent=W2
header=Host=**************
locale=[]
method=POST
protocol=HTTP/1.1
queryString=
remoteAddr=*************
remoteHost=************
scheme=http
host=*******************
serverPort=8080
--------------------------RESPONSE--------------------------
contentLength=74
contentType=text/html
header=Connection=keep-alive
header=X-Powered-By=Undertow/1
header=Server=JBoss-EAP/7
header=Content-Length=74
header=Content-Type=text/html
header=Date=Fri, 31 Mar 2017 10:31:43 GMT
status=404
==============================================================
There are migration guide available, below are the two links where you can find the configuration how to migrate EJB application to JBoss EAP 7;
https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/html-single/migration_guide/
https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/html-single/developing_ejb_applications/

Loading properties from a file in a JBoss 6 Web Application

Can I dump a properties file somewhere in one of the JBoss 6 directories, and pick it up from the classpath?
Or even better, does anybody know the mechanism behind a configuration file like $JBOSS_HOME/server/default/deploy/jboss-logging.xml? Changes to this file seem to trigger an event, so that a running instance can process the modifications (without having to bounce the AS).
A possibility is to configure SystemPropertiesService in ./conf/jboss-service.xml.
This allows you to configure system properties in-place, or load them from a properties file:
<server>
<mbean code="org.jboss.varia.property.SystemPropertiesService"
name="jboss.util:type=Service,name=SystemProperties">
<!-- Load properties from each of the given comma seperated URLs -->
<attribute name="URLList">
http://somehost/some-location.properties,
./conf/somelocal.properties
</attribute>
<!-- Set propertuies using the properties file style. -->
<attribute name="Properties">
property1=This is the value of my property
property2=This is the value of my other property
</attribute>
</mbean>
</server>
For more details, refer to: http://docs.jboss.org/jbossas/admindevel326/html/ch10.html
They have made this even easier in JBoss EAP 6 (AS 7).
Pass Property File as Startup Parameter
This can be added within the main start up script or passed as parameter
./standalone.sh --properties=/Users/john.galt/dev/config/ds/jboss.properties
If these properties are read, they will be rendered in the server log as the first statement.
3:58:41,633 DEBUG [org.jboss.as.config] (MSC service thread 1-6) Configured system properties:
DSsettings.password = password
DSsettings.user-name = admin
DSsettings.connection-url = jdbc:oracle:fat:#activedb:1521:DEV
[Standalone] =
awt.nativeDoubleBuffering = true
NOTE: As these settings are logged in server log, ensure no clear text passwords are in the property files in production
Use passed in system properties
You could use these system properties with following syntax.
Example Usage in a data source file
<xa-datasource jndi-name="java:jboss/ds" pool-name="cPool" jta="true" enabled="true" use-ccm="true">
<xa-datasource-property name="URL">
${DSsettings.connection_url}
</xa-datasource-property>
<driver>oracle</driver>
...
<security>
<user-name>${DSsettings.user-name}</user-name>
<password>${DSsettings.password}</password>
</security>
...
</xa-datasource>
In JBoss 6 use: ./deploy/properties-service.xml
On JBoss AS7 properties-service.xml no longer exist, the below is the solution:
http://www.mastertheboss.com/jboss-server/jboss-configuration/how-to-inject-system-properties-into-jboss