spring batch Invalid content was found starting with element 'flow' - spring-batch

i have the following exception for the flow defintion in the spring batch config file.
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 102 in XML document from class path resource [sa/com/mobily/loader/job/DataLoaderJob.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'job'. One of '{"http://www.springframework.org/schema/beans":import, "http://www.springframework.org/schema/beans":alias, "http://www.springframework.org/schema/beans":bean, WC[##other:"http://www.springframework.org/schema/beans"]}' is expected.
Config File
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">
<job id="CDR_MSC_PARALLEL" xmlns="http://www.springframework.org/schema/batch">
<flow parent="prepareCleanFlow" id="CDR_MSC_PARALLEL.prepareCleanFlow" next="LOAD_EXCHANGE_DATA" />

Related

nexpected exception parsing XML document from ServletContext resource [/WEB-INF/classes/spring/spring-config.xml]

I'm getting below when starting application in JBOSS
2022-03-28 12:28:05,435 main ERROR context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/classes/spring/spring-config.xml]; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'messaging.type' in string value [classpath:spring/spring-${messaging.type}-integration-config.xml]
We are in process of migrating from IBM WAS to JWS. Not sure if any code change is required.
Below spring-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:encryption="http://www.jasypt.org/schema/encryption"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.jasypt.org/schema/encryption
http://www.jasypt.org/schema/encryption/jasypt-spring31-encryption-1.xsd">
<context:property-placeholder location="file:${dtp.tarot.home}/conf/tarot-${dtp.tarot.env}.properties"/>
-->
<import resource="classpath:spring/spring-jmx-config.xml" />
<import resource="classpath:spring/spring-security-config.xml" />
<import resource="classpath:spring/spring-message-config.xml" />
<import resource="classpath:spring/spring-jdbc-config.xml" />
<import resource="classpath:spring/spring-workflow-config.xml" />
<import resource="classpath:spring/spring-rules-config.xml" />
<import resource="classpath:spring/spring-dao-config.xml" />
<import resource="classpath:spring/spring-${messaging.type}-integration-config.xml" />
<import resource="classpath:spring/spring-service-config.xml" />
<import resource="classpath:spring/spring-batch-config.xml" />
<import resource="classpath:spring/spring-schedule-config.xml" />
<import resource="classpath:spring/spring-metrics-config.xml" />

Cannot Access Global Variables Inside citrus-context.xml

Given the following citrus-context.xml:
<?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:citrus="http://www.citrusframework.org/schema/config"
xmlns:citrus-http="http://www.citrusframework.org/schema/http/config"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.citrusframework.org/schema/config http://www.citrusframework.org/schema/config/citrus-config.xsd
http://www.citrusframework.org/schema/http/config http://www.citrusframework.org/schema/http/config/citrus-http-config.xsd">
<citrus:global-variables>
<citrus:file
path="classpath:endpoints.properties" />
</citrus:global-variables>
<citrus-http:client
id="service_endpoint"
request-url="${Service.Endpoint.URL}"
request-method="GET"
content-type="text/xml"
charset="UTF-8"
timeout="60000" />
</beans>
Instead of evaluating ${Service.Endpoint.URL} to http://foo.io/service I get the following error:
com.consol.citrus.exceptions.TestCaseFailedException: Illegal character in path at index 1: ${Service.Endpoint.URL}
...
Caused by: java.lang.IllegalArgumentException: Illegal character in path at index 1: ${Service.Endpoint.URL}
...
Caused by: java.net.URISyntaxException: Illegal character in path at index 1: ${Service.Endpoint.URL}
Is it this because of a configuration issue, or is the current set-up not possible?
Please add a Spring property placeholder configurer to your application context. The configurer is able to evaluate property expressions in Spring bean definitions. The Citrus global variables are not taken into account at design time when the Spring beans are parsed in the application context.
<context:property-placeholder location="classpath:endpoint.properties"/>
The property placeholder is using the special context: Spring bean namespace. So you need to declare this namespace in your configuration file:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:citrus="http://www.citrusframework.org/schema/config"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
...">

Element not allowed: node#http://schemas.xmlsoap.org/soap/envelope

I am getting the following error, when I add a SOAP UI schema validation for as part of the assertions in SOAP UI:
Element not allowed: node#http://schemas.xmlsoap.org/soap/envelope in element Header#http://schemas.xmlsoap.org/soap/envelope
Can anyone please give me a clue why this is failing? And how to fix that?
XML validated:
<soap:Envelope xmlns:ns0="urn:xeu:flux-transport:v1" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<soap:node datetime="2018-02-02T10:31:08.006Z">ABC</soap:processingNode>
</soap:Header>
<soap:Body>
<blah>
</blah>
</soap:Body>
</soap:Envelope>
WSDL (used to validate in SOAP UI):
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:documentation>Version: 1.0</wsdl:documentation>
<wsdl:types>
<xsd:schema>
<import namespace="http://schemas.xmlsoap.org/soap/envelope/"
schemaLocation="http://schemas.xmlsoap.org/soap/envelope/" />
</xsd:schema>
</wsdl:types>
</wsdl:definitions>
Any help appreciated.
Remove the element node or below line from your request:
<soap:node datetime="2018-02-02T10:31:08.006Z">ABC</soap:processingNode>
Also, start and end node names are different too.

reconnect-forever on JMS endpoint doesn't work with xa-transactions

I am using Mule 3.2.1 standalone and JBoss 5.1. Here's my flow:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jbossts="http://www.mulesoft.org/schema/mule/jbossts" xmlns:management="http://www.mulesoft.org/schema/mule/management" version="CE-3.2.1" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/jbossts http://www.mulesoft.org/schema/mule/jbossts/current/mule-jbossts.xsd
http://www.mulesoft.org/schema/mule/management http://www.mulesoft.org/schema/mule/management/current/mule-management.xsd ">
<jbossts:transaction-manager/>
<jms:connector name="JMS" specification="1.1" numberOfConsumers="1" jndiInitialFactory="org.jnp.interfaces.NamingContextFactory" jndiProviderUrl="jnp://localhost:1099" connectionFactoryJndiName="java:/XAConnectionFactory" maxRedelivery="10" doc:name="JMS">
<reconnect-forever frequency="5000"/>
</jms:connector>
<flow name="flow" doc:name="flow">
<jms:inbound-endpoint queue="test1" connector-ref="JMS" doc:name="qt1">
<xa-transaction action="BEGIN_OR_JOIN" />
</jms:inbound-endpoint>
<jms:outbound-endpoint queue="test2" connector-ref="JMS" doc:name="qt2">
<xa-transaction action="ALWAYS_JOIN"/>
</jms:outbound-endpoint>
</flow>
When I run it in mule and turn off jboss, and then turn it on again, my app does not reconnect to jms. In fact, it does not even try! If I remove transactions from my flow (as below), everything is fine.
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jbossts="http://www.mulesoft.org/schema/mule/jbossts" xmlns:management="http://www.mulesoft.org/schema/mule/management" version="CE-3.2.1" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/jbossts http://www.mulesoft.org/schema/mule/jbossts/current/mule-jbossts.xsd
http://www.mulesoft.org/schema/mule/management http://www.mulesoft.org/schema/mule/management/current/mule-management.xsd ">
<jms:connector name="JMS" specification="1.1" numberOfConsumers="1" jndiInitialFactory="org.jnp.interfaces.NamingContextFactory" jndiProviderUrl="jnp://localhost:1099" connectionFactoryJndiName="java:/XAConnectionFactory" maxRedelivery="10" doc:name="JMS">
<reconnect-forever frequency="5000"/>
</jms:connector>
<flow name="flow" doc:name="flow">
<jms:inbound-endpoint queue="test1" connector-ref="JMS" doc:name="qt1">
</jms:inbound-endpoint>
<jms:outbound-endpoint queue="test2" connector-ref="JMS" doc:name="qt2">
</jms:outbound-endpoint>
</flow>
Here are log fragments for these two scenarios:
With transactions and
Without transactions. I stopped mule after waiting for two minutes for reconnection.
My question is: what should I do to have reconnect-forever work properly with transactions?
I had same problem with both Jboss and ActiveMQ.
It seems that the problem was resolved in issue http://www.mulesoft.org/jira/browse/MULE-6028.
I checked it and it seems that reconnect works well with version 3.3.0-RC3.

OpenJPA does not create DB2 tables when deploying on Websphere Application Server

I deployed my ear file on Websphere Application server V7.0 and start the application. However, it does not auto create table to my database DB2 and don't have any error message.
Please see my persitence.xml file
<?xml version="1.0" encoding="UTF-8" ?>
<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_1_0.xsd"
version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="xcrm_ejb" >
<jta-data-source>jdbc/xcrm</jta-data-source>
<non-jta-data-source>jdbc/non_xcrm</non-jta-data-source>
<mapping-file>META-INF/orm.xml</mapping-file>
<class>ch.xpertline.xcrm.entity.base.BaseEntity</class>
<class>ch.xpertline.xcrm.entity.Address</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="openjpa.Log" value="DefaultLevel=INFO,SQL=TRACE,File=./dist/jpaEnhancerLog.log,Runtime=INFO,Tool=INFO"/>
<property name="openjpa.ConnectionFactoryProperties" value="PrettyPrint=true, PrettyPrintLineLength=72"/>
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
</properties>
</persistence-unit>
</persistence>
My orm.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings version="1.0" xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd">
<persistence-unit-metadata>
<persistence-unit-defaults>
<schema>soreco</schema>
</persistence-unit-defaults>
</persistence-unit-metadata>
</entity-mappings>
Thanks
Try sending in an application request. I don't think synchronize mappings is triggered until the first EntityManager is created.