I have a spring batch application that uses Azure SQL server as a backend, I am using Hibernate to update the database.
I am reading the data from CSV file using FlatfileReader & writing into Azure SQL Server using ItemWriter as mentioned below
public class StoreWriter implements ItemWriter<List<Store>> {
Logger logger = Logger.getLogger(StoreWriter.class);
private HibernateItemWriter<Store> hibernateItemWriter;
public StoreWriter(HibernateItemWriter<Store> hibernateItemWriter) {
this.hibernateItemWriter = hibernateItemWriter;
}
#Override
public void write(List<? extends List<Store>> items) throws Exception {
for (List<Store> Store : items) {
hibernateItemWriter.write(Store);
}
logger.info(String.format("Store Processing Completed %s", new LocalDateTime()));
}
}
Below is my Hibernate configuration
<bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager" lazy-init="true">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>
<bean id="hibernateProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServer2012Dialect</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.format_sql">false</prop>
<!-- <prop key="hibernate.hbm2ddl.auto">update</prop> -->
</props>
</property>
</bean>
<bean class="org.springframework.batch.core.scope.StepScope" />
<!-- DATA SOURCE -->
<bean id="demoDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
<property name="url" value="jdbc:sqlserver://demo.database.windows.net:1433;database=sqldb;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;" />
<property name="username" value="user1" />
<property name="password" value="p#ssword1" />
</bean>
What I observe is that it is processing only 360 records per minute, is there a way to increase the performance?
Here is the Hibernate stats:
For 1 record
For 3 records
Trying to transfer messages form RabbitMQ <int-amqp:inbound-channel-adapter to MQSeries <int-jms:outbound-channel-adapter. This works fine.
Actually some producers on MQSeries use IBM JMS classes like that :
MQMessage messageMQ = new MQMessage();
messageMQ.format = " ";
messageMQ.persistence = 1;
messageMQ.correlationId = MQ_MESSAGE_CORRELATION_ID;
messageMQ.write(message.getMessageData());
MQPutMessageOptions putMessageOption = new MQPutMessageOptions();
putMessageOption.options = 8194;
MQQueue queue = openQueue(destinataire, 8208);
queue.put(messageMQ, putMessageOption);
I tried using transformer between amqp and jms like this :
<int:transformer id="testTransformer" ref="testTransformerBean" input-channel="fromRabbit"
method="transform" output-channel="toJms"/>
public MQMessage transform(Message<?> msg) throws Exception {
MQMessage result = new MQMessage();
result.format = " ";
result.persistence = 1;
result.correlationId = MQC.MQCI_NONE;
String test = "message to send ";
result.write(test.getBytes());
return result;
}
What is the type of Object storing in msg.getPayload()? How can i convert it into a String object?
Implementing this method, i have an exception because the outbound need a JMS message and not a com.ibm.mq.MQMessage!
Cannot convert object of type [com.ibm.mq.MQMessage] to JMS message
Is this way correct?
Or should i remove the outbound-channel and use a service activator instead with specific code for IBM?
Thanks for your help
Regards
Edit following Artem's answer
Following the jms outbound configuration:
<bean id="jmsConnectionFactory" class="com.ibm.mq.jms.MQConnectionFactory">
<property name="queueManager" value="${queueManager}" />
<property name="hostName" value="${hostName}" />
<property name="port" value="${port}" />
<property name="channel" value="${channelName}" />
<property name="transportType" value="1" />
</bean>
<bean id="jmsQueue" class="com.ibm.mq.jms.MQQueue" depends-on="jmsConnectionFactory">
<property name="baseQueueManagerName" value="${queueManager}" />
<property name="baseQueueName" value="${queueName}" />
<property name="targetClient" value="1" />
</bean>
<bean id="jmsConnectionFactory_cred"
class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
<property name="targetConnectionFactory" ref="jmsConnectionFactory" />
<property name="username" value="${user}"/>
<property name="password" value="${password}"/>
</bean>
<bean id="connectionFactoryCaching"
class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory" ref="jmsConnectionFactory_cred" />
<property name="sessionCacheSize" value="${BRIDGE_MQ_OUTBOUND_SESSION_CACHE}" />
</bean>
<bean class="org.springframework.integration.handler.advice.ExpressionEvaluatingRequestHandlerAdvice" id="requestHandler">
<property name="trapException" value="false"/>
<property name="onFailureExpressionString" value="#this"/>
<property name="failureChannel" ref="processChannel1"/>
</bean>
<int-jms:outbound-channel-adapter channel="channelRmqMQ"
id="jmsOut" destination="jmsQueue" connection-factory="connectionFactoryCaching" delivery-persistent="true"
explicit-qos-enabled="true" session-transacted="true" >
<int-jms:request-handler-advice-chain>
<ref bean="requestHandler" />
</int-jms:request-handler-advice-chain>
</int-jms:outbound-channel-adapter>
If your AMQP message comes with the text/* contentType, then its body is converted to string automatically by the out-of-the-box SimpleMessageConverter in the AmqpInboundChannelAdapter:
if (contentType != null && contentType.startsWith("text")) {
String encoding = properties.getContentEncoding();
if (encoding == null) {
encoding = this.defaultCharset;
}
try {
content = new String(message.getBody(), encoding);
} catch (UnsupportedEncodingException var8) {
throw new MessageConversionException("failed to convert text-based Message content", var8);
}
Otherwise you need to place a simple transformer in between to convert a byte[] to string:
<object-to-string-transformer>
The <int-jms:outbound-channel-adapter> is exactly for JMS protocol interaction, so, your MQMessage is not going to be accepted there. That's why you get that Cannot convert object of type [com.ibm.mq.MQMessage] to JMS message exception.
Yes, you can use IBM MP API directly in some custom service-activator, however I would suggest to take a look into JMS to MQ bridge on IBM WebSphere. Then you need only to configure an appropriate connection factory and use it from the <int-jms:outbound-channel-adapter>:
<jee:jndi-lookup id="jndiMqConnectionFactory" jndi-name="${mqConnectionFactory}"/>
<bean id="jmsQueueConnectionFactory"
class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
<property name="targetConnectionFactory" ref="jndiMqConnectionFactory"/>
<property name="username" value="${mqLogin}"/>
<property name="password" value="${mqPassword}"/>
</bean>
<jee:jndi-lookup id="myMqQueue" jndi-name="queue/myMqQueue"/>
<bean id="mqQueueJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="jmsQueueConnectionFactory"/>
<property name="defaultDestination" ref="myMqQueue"/>
</bean>
<jms:outbound-channel-adapter channel="myMqChannel" jms-template="mqQueueJmsTemplate"/>
I have a module s3-puller which pulls file from was s3 .In the production i am facing some issue when i try to create a stream.But local single node it works fine and i tried to set up 3 node cluster and 1 admin node in local it works fine.
Below is my application context
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-aws="http://www.springframework.org/schema/integration/aws"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/aws http://www.springframework.org/schema/integration/aws/spring-integration-aws-1.0.xsd">
<int:poller fixed-delay="${fixed-delay}" default="true"/>
<bean id="credentials" class="org.springframework.integration.aws.core.BasicAWSCredentials">
<property name="accessKey" value="${accessKey}"/>
<property name="secretKey" value="${secretKey}"/>
</bean>
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>dms-aws-s3-nonprod.properties</value>
</property>
</bean>
<bean id="clientConfiguration" class="com.amazonaws.ClientConfiguration">
<property name="proxyHost" value="${proxyHost}"/>
<property name="proxyPort" value="${proxyPort}"/>
<property name="preemptiveBasicProxyAuth" value="false"/>
</bean>
<bean id="s3Operations" class="org.springframework.integration.aws.s3.core.CustomC1AmazonS3Operations">
<constructor-arg index="0" ref="credentials"/>
<constructor-arg index="1" ref="clientConfiguration"/>
<property name="awsEndpoint" value="s3.amazonaws.com"/>
<property name="temporaryDirectory" value="${temporaryDirectory}"/>
<property name="awsSecurityKey" value="${awsSecurityKey}"/>
</bean>
<!-- aws-endpoint="https://s3.amazonaws.com" -->
<int-aws:s3-inbound-channel-adapter aws-endpoint="s3.amazonaws.com"
bucket="${bucket}"
s3-operations="s3Operations"
credentials-ref="credentials"
file-name-wildcard="${file-name-wildcard}"
remote-directory="${remote-directory}"
channel="splitChannel"
local-directory="${local-directory}"
accept-sub-folders="false"
delete-source-files="true"
archive-bucket="${archive-bucket}"
archive-directory="${archive-directory}">
</int-aws:s3-inbound-channel-adapter>
<int:splitter input-channel="splitChannel" output-channel="output"
expression="T(org.apache.commons.io.FileUtils).lineIterator(payload)"/>
<int:channel id="output"/>
my Application.java
package com.capitalone.api.dms.main;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.ImportResource;
#SpringBootApplication
#ImportResource("classpath:config/applicationContext.xml")
public class Application {
public static void main(String[] args) throws Exception {
new SpringApplicationBuilder(Application.class)
.web(false)
.showBanner(false)
.properties("security.basic.enabled=false")
.run(args);
}
}
I am getting below exception when i try to create a basic stream
module upload --file aws.jar --name aws-s3-options --type source
stream create feedTest91 --definition "aws-s3-options | log" --deploy
I get below exception
DeploymentStatus{state=failed,error(s)=org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'objectNameProperties' defined in null: Could not resolve placeholder 'xd.module.sequence' in string value "${xd.module.sequence}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'xd.module.sequence' in string value "${xd.module.sequence}" at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:211) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:222) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:86) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:265)
from the source code i see that its loaded by jmx mbean file of xd and loaded by below java file
https://github.com/spring-projects/spring-xd/blob/6923ee8705bd9c2c58ad73120724b8b87c5ba37d/spring-xd-dirt/src/main/resources/META-INF/spring-xd/plugins/jmx/mbean-exporters.xml
https://github.com/spring-projects/spring-xd/blob/e9ce8e897774722c1e61038817ebd55c5cf0befc/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/plugins/MBeanExportingPlugin.java
Solution :
I am planning to inject them from my s3 module .Is it right way to do please let me know what should be the values?
<context:mbean-export />
<int-jmx:mbean-export object-naming-strategy="moduleObjectNamingStrategy" />
<util:properties id="objectNameProperties">
<prop key="group">${xd.group.name}</prop>
<prop key="label">${xd.module.label}</prop>
<prop key="type">${xd.module.type}</prop>
<prop key="sequence">${xd.module.sequence}</prop>
</util:properties>
<bean id="moduleObjectNamingStrategy"
class="org.springframework.xd.dirt.module.jmx.ModuleObjectNamingStrategy">
<constructor-arg value="xd.${xd.stream.name:${xd.job.name:}}" />
<constructor-arg ref="objectNameProperties" />
</bean>
That property should be automatically set up by the ModuleInfoPlugin.
This is the second time someone has said that property is missing somehow.
I have opened a JIRA Issue.
XML File Used:
<!--
The profile service
$Id: profile.xml 89131 2009-05-19 20:18:52Z scott.stark#jboss.org $
-->
<deployment xmlns="urn:jboss:bean-deployer:2.0">
<classloader><inject bean="profile-classloader:0.0.0" /></classloader>
<classloader name="profile-classloader" xmlns="urn:jboss:classloader:1.0" export-all="NON_EMPTY" import-all="true">
<root>${jboss.lib.url}jboss-profileservice-spi.jar</root>
</classloader>
<!--
The profile configuration
This contains required properties:
The uri to jboss-service.xml.
The uri to the deployers folder.
A list of uris to deploy folders. -->
<bean name="BootstrapProfileFactory" class="org.jboss.system.server.profileservice.repository.StaticProfileFactory">
<property name="bindingsURI">${jboss.server.home.url}conf/bindingservice.beans</property>
<property name="bootstrapURI">${jboss.server.home.url}conf/jboss-service.xml</property>
<property name="deployersURI">${jboss.server.home.url}deployers</property>
<property name="applicationURIs">
<list elementClass="java.net.URI">
<value>${jboss.server.home.url}deploy</value>
<value> </value>
</list>
</property>
<property name="attachmentStoreRoot">${jboss.server.data.dir}/attachments</property>
<property name="profileFactory"><inject bean="ProfileFactory" /></property>
</bean>
<!-- The default profile key -->
<bean name="DefaultProfileKey" class="org.jboss.profileservice.spi.ProfileKey">
<constructor><parameter>${jboss.server.name}</parameter></constructor>
</bean>
<!-- The ProfileService -->
<bean name="ProfileService" class="org.jboss.system.server.profileservice.repository.AbstractProfileService">
<constructor><parameter><inject bean="jboss.kernel:service=KernelController" /></parameter></constructor>
<property name="deployer"><inject bean="ProfileServiceDeployer" /></property>
<property name="defaultProfile"><inject bean="DefaultProfileKey" /></property>
</bean>
<!-- The Bootstrap implementation that loads the Profile from the ProfileService -->
<bean name="ProfileServiceBootstrap" class="org.jboss.system.server.profileservice.ProfileServiceBootstrap">
<property name="profileKey"><inject bean="DefaultProfileKey" /></property>
<property name="mainDeployer"><inject bean="MainDeployer" /></property>
<property name="profileService"><inject bean="ProfileService" /></property>
<property name="mof"><inject bean="ManagedObjectFactory" /></property>
<property name="mgtDeploymentCreator"><inject bean="ManagedDeploymentCreator" /></property>
<property name="bootstrapProfileFactory"><inject bean="BootstrapProfileFactory" /></property>
<property name="configurator"><inject bean="jboss.kernel:service=Kernel" property="configurator"/></property>
</bean>
<!-- The profile factory -->
<bean name="ProfileFactory" class="org.jboss.system.server.profileservice.repository.TypedProfileFactory">
<!-- Accept any AbstractprofileFactory -->
<incallback method="addProfileFactory" />
<uncallback method="removeProfileFactory" />
</bean>
<!-- The profile repository factory -->
<bean name="ProfileRepositoryFactory" class="org.jboss.system.server.profileservice.repository.TypedProfileRepository">
<!-- Accept any DeploymentRepositoryFactory -->
<incallback method="addRepositoryFactory" />
<uncallback method="removeRepositoryFactory" />
</bean>
<!-- The structure modification cache and checker -->
<bean name="StructureModCache" class="org.jboss.deployers.vfs.spi.structure.modified.DefaultStructureCache">
<destroy method="flush"/>
</bean>
<!-- This just checks metadata locations -->
<bean name="MetaDataStructureModificationChecker" class="org.jboss.deployers.vfs.spi.structure.modified.MetaDataStructureModificationChecker">
<constructor>
<parameter><inject bean="MainDeployer" /></parameter>
</constructor>
<property name="cache"><inject bean="StructureModCache" /></property>
<property name="filter"><bean class="org.jboss.system.server.profile.basic.XmlIncludeVirtualFileFilter" /></property>
</bean>
<!-- Synchs modifed files -->
<bean name="SynchAdapter" class="org.jboss.deployers.vfs.spi.structure.modified.OverrideSynchAdapter"/>
<!-- We just visit wars, but exclude classes, lib, dev dirs -->
<bean name="WebVisitorAttributes" class="org.jboss.system.server.profile.basic.IncludeExcludeVisitorAttributes">
<constructor>
<parameter>
<set>
<value>.war</value>
</set>
</parameter>
<parameter>
<set>
<value>WEB-INF/classes</value>
<value>WEB-INF/lib</value>
<value>WEB-INF/dev</value>
</set>
</parameter>
</constructor>
</bean>
<bean name="StructureModificationChecker" class="org.jboss.deployers.vfs.spi.structure.modified.SynchWrapperModificationChecker">
<constructor>
<parameter><inject bean="MetaDataStructureModificationChecker"/></parameter>
<parameter><inject bean="SynchAdapter"/></parameter>
</constructor>
<property name="originalAttributes"><inject bean="WebVisitorAttributes"/></property>
<property name="tempAttributes"><inject bean="WebVisitorAttributes"/></property>
</bean>
<bean name="BasicProfileFactory" class="org.jboss.system.server.profileservice.repository.BasicProfileFactory">
<property name="profileRepository"><inject bean="ProfileRepositoryFactory" /></property>
</bean>
<bean name="FilteredProfileFactory" class="org.jboss.system.server.profileservice.repository.FilteredProfileFactory"/>
<!-- The default deployment repository factory -->
<bean name="DefaultDeploymentRepositoryFactory" class="org.jboss.system.server.profileservice.repository.DefaultDeploymentRepositoryFactory">
<property name="deploymentFilter"><inject bean="DeploymentFilter" /></property>
<property name="checker"><inject bean="StructureModificationChecker" /></property>
</bean>
<bean name="ComponentMapperRegistry"
class="org.jboss.system.server.profileservice.persistence.component.ComponentMapperRegistry">
<constructor factoryClass="org.jboss.system.server.profileservice.persistence.component.ComponentMapperRegistry" factoryMethod="getInstance"/>
<!-- Accept any AbstractprofileFactory -->
<incallback method="addMapper" />
<uncallback method="removeComponentMapper" />
</bean>
<!-- A persistence factory for creating the persisted format of ManagedComponents -->
<bean name="PersistenceFactory" class="org.jboss.system.server.profileservice.persistence.AbstractPersistenceFactory">
<constructor><parameter><inject bean="ManagedObjectFactory" /></parameter></constructor>
<!-- Accept any ComponentMapper -->
<incallback method="addComponentMapper" />
<uncallback method="removeComponentMapper" />
<!-- Accept any ManagedObjectPersistencePlugin -->
<incallback method="addPersistencePlugin" />
<uncallback method="removePersistencePlugin" />
</bean>
<!-- The attachment store -->
<bean name="AttachmentStore" class="org.jboss.system.server.profileservice.repository.AbstractAttachmentStore">
<constructor><parameter class="java.io.File"><inject bean="BootstrapProfileFactory" property="attachmentStoreRoot" /></parameter></constructor>
<property name="mainDeployer"><inject bean="MainDeployer" /></property>
<property name="serializer"><inject bean="AttachmentsSerializer" /></property>
<property name="persistenceFactory"><inject bean="PersistenceFactory" /></property>
</bean>
<bean name="AttachmentsSerializer" class="org.jboss.system.server.profileservice.repository.JAXBAttachmentSerializer">
<constructor><parameter><inject bean="BootstrapProfileFactory" property="attachmentStoreRoot" /></parameter></constructor>
</bean>
<bean name="ProfileServiceDeployer" class="org.jboss.system.server.profileservice.repository.MainDeployerAdapter">
<property name="mainDeployer"><inject bean="MainDeployer" /></property>
<property name="attachmentStore"><inject bean="AttachmentStore" /></property>
</bean>
<bean name="ProfileServicePersistenceDeployer" class="org.jboss.system.server.profileservice.persistence.deployer.ProfileServicePersistenceDeployer">
<property name="persistenceFactory"><inject bean="PersistenceFactory" /></property>
<property name="attachmentStore"><inject bean="AttachmentStore" /></property>
</bean>
<bean name="KernelDeploymentComponentMapper" class="org.jboss.deployers.plugins.managed.KernelDeploymentComponentMapper">
<constructor><parameter><inject bean="PersistenceFactory" /></parameter></constructor>
<!-- Register under the attachment interface name as well -->
<install bean="ComponentMapperRegistry" method="addMapper">
<parameter class="java.lang.String">org.jboss.kernel.spi.deployment.KernelDeployment</parameter>
<parameter class="org.jboss.system.server.profileservice.persistence.component.ComponentMapper"><this/></parameter>
</install>
<uninstall bean="ComponentMapperRegistry" method="removeComponentMapper">
<parameter class="java.lang.String">org.jboss.kernel.spi.deployment.KernelDeployment</parameter>
</uninstall>
</bean>
<bean name="ServiceDeploymentComponentMapper" class="org.jboss.system.deployers.managed.ServiceDeploymentComponentMapper">
<constructor><parameter><inject bean="PersistenceFactory" /></parameter></constructor>
</bean>
<!-- A filter for excluding files from the scanner -->
<bean name="DeploymentFilter" class="org.jboss.virtual.plugins.vfs.helpers.ExtensibleFilter">
<!-- Files starting with theses strings are ignored -->
<property name="prefixes">#,%,\,,.,_$</property>
<!-- Files ending with theses strings are ignored -->
<property name="suffixes">#,$,%,~,\,v,.BAK,.bak,.old,.orig,.tmp,.rej,.sh</property>
<!-- Files matching with theses strings are ignored -->
<property name="matches">.make.state,.nse_depinfo,CVS,CVS.admin,RCS,RCSLOG,SCCS,TAGS,core,tags</property>
</bean>
</deployment>
Code Snippet:
procedure SaveAttributeValueToXML(const AFileName, APath,
AValue: string);
var
XMLNode: Variant;
XMLDocument: Variant;
ResultValue: String;
begin
XMLDocument := CreateOleObject('Msxml2.DOMDocument.6.0');
try
XMLDocument.async := False;
XMLDocument.load(AFileName);
if (XMLDocument.parseError.errorCode <> 0) then
MsgBox('The XML file could not be parsed. ' +
XMLDocument.parseError.reason, mbError, MB_OK)
else
begin
XMLDocument.setProperty('SelectionLanguage', 'XPath');
XMLNode := XMLDocument.selectSingleNode(APath);
ResultValue := XMLNode.text;
XMLDocument.save(AFileName);
end;
except
MsgBox('An error occured!' + #13#10 + GetExceptionMessage,
mbError, MB_OK);
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
UnicodeStr: string;
ANSIStr: AnsiString;
serverAnsiStr: AnsiString;
serverString: string;
profileXmlAnsiStr: AnsiString;
profileXmlString: string;
jdkDir: string;
begin
if CurStep=ssDone then
begin
hibernateDir := MPFWDestDir + '\hpfw\portal.war\WEB-INF\classes\config\hibernate\hibernate.properties';
LoadStringFromFile(hibernateDir, ANSIStr);
UnicodeStr := String(ANSIStr);
StringChangeEx(UnicodeStr, '$!JDBC_USERID!$', ConfigContinuedPage.Values[0], True);
StringChangeEx(UnicodeStr, '$!JDBC_PASSWORD1!$', ConfigContinuedPage.Values[1], True);
StringChangeEx(UnicodeStr, '$!JDBC_HPF_HOSTNAME!$', ConfigPage.Values[2], True);
SaveStringToFile(hibernateDir, AnsiString(UnicodeStr), False);
serverXmlDir := JBossDestDir + '\server\default\deploy\jbossweb.sar\server.xml';
LoadStringFromFile(serverXmlDir, serverAnsiStr);
serverString := String(serverAnsiStr);
StringChangeEx(serverString, '$!WEBSERVER_PORT!$', ConfigPage.Values[0], True);
SaveStringToFile(serverXmlDir, AnsiString(serverString), False);
profileXmlDir := 'C:\Jboss' + '\server\default\conf\bootstrap\profile.xml';
LoadStringFromFile(profileXmlDir, profileXmlAnsiStr);
profileXmlString := String(profileXmlAnsiStr);
StringChangeEx(profileXmlString, '<value>', '<value> file:/' + MPFWDestDir + '/hpfw/</value>', True);
//LoadValueFromXML(profileXmlDir, '//settings/Mail/MailServer');
SaveAttributeValueToXML(profileXmlDir, '//deployment/bean/property/list[#elementClass=''java.net.URI'']/value', 'C:\MPFW');
jdkDir := 'C:\JBOSS\jdk1.7.0_11_64';
if CompareText(checked, 'true') = 0 then
begin
DelTree(jdkDir, True, True, True);
end
end
end;
Question:
Im getting a variant is null error on trying to save the data in blank tag section of the xml file. Need to set a value to the empty value tag after ${jboss.server.home.url}deploy this tag. Please let me know what is wrong in the code.
I know this is an old thread, so just leave my suggestion for you.
The error message is "Variant is null", you can check variant is null or not before doing the next step, just like you did for XMLDocument:
XMLDocument.load(AFileName);
if (XMLDocument.parseError.errorCode <> 0) then
MsgBox('The XML file could not be parsed. ' + XMLDocument.parseError.reason, mbError, MB_OK)
else
......
So, do a similar check for XMLNode before retrieving its text:
XMLNode := XMLDocument.selectSingleNode(APath);
if not (IDispatch(XMLNode) = nil) then
ResultValue := XMLNode.text;
Is there a posibility to Override Tomcat7 connectionTimeout property already stored in /tomcat/conf/server.xml. I mean setting a property in my application-context.xml file like
<bean id="dataSourceC3p0" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="${jdbc.driverClassName}" />
<property name="jdbcUrl" value="${jdbc.url}" />
<property name="user" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<property name="maxPoolSize" value="20" />
<property name="maxStatements" value="0" />
<property name="minPoolSize" value="5" />
<property name="numHelperThreads" value="5"/>
<property name="connectionTimeout" value="200000"/>
</bean>
although, last line is throwing an error:
org.springframework.beans.NotWritablePropertyException: Invalid property 'connectionTimeout'
all other properties are ok when I just comment last property
NotWritablePropertyException just tells me that there's no other way to set this value right ?
Thanks in Advanced
Property name is wrong..
Look at this doc:
http://www.databaseskill.com/4369778/
<! - When the connection pool is used when the client calls the getConnection ()
waiting to acquire a new connection timeout before throwing
SQLException, if set to 0 wait indefinitely. Milliseconds. Default: 0 ->
<property name="checkoutTimeout"> 100 </ property>
Hope that helps