Mule jdbc connector xml parsing - jdbc

I'm having problems to add a JDBC endpoint to my Mule project but I'm having problems during the initialization due to some XML parsing problems.
The problems started after I've added the JDBC endpoints.
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'jdbc:inbound-endpoint'. One of '{
"http://www.mulesource.org/schema/mule/core/2.2":description,
"http://www.springframework.org/schema/beans":beans,
"http://www.springframework.org/schema/beans":bean,
"http://www.springframework.org/schema/context":property-placeholder,
"http://www.mulesource.org/schema/mule/core/2.2":global-property,
"http://www.mulesource.org/schema/mule/core/2.2":configuration,
"http://www.mulesource.org/schema/mule/core/2.2":notifications,
"http://www.mulesource.org/schema/mule/core/2.2":abstract-extension,
"http://www.mulesource.org/schema/mule/core/2.2":abstract-security-manager,
"http://www.mulesource.org/schema/mule/core/2.2":abstract-transaction-manager,
"http://www.mulesource.org/schema/mule/core/2.2":abstract-connector,
"http://www.mulesource.org/schema/mule/core/2.2":abstract-global-endpoint,
"http://www.mulesource.org/schema/mule/core/2.2":abstract-transformer,
"http://www.mulesource.org/schema/mule/core/2.2":abstract-filter,
"http://www.mulesource.org/schema/mule/core/2.2":abstract-model,
"http://www.mulesource.org/schema/mule/core/2.2":abstract-interceptor-stack}'
is expected.
I've been following this guide http://www.mulesoft.org/documentation/display/MULE2USER/JDBC+Transport#JDBCTransport-ConfigurationReference
The Mule JDBC namespace have been added to my xml definition.
Any idea?
Check a piece of my configuration file:
<mule
xmlns="http://www.mulesource.org/schema/mule/core/2.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jms="http://www.mulesource.org/schema/mule/jms/2.2"
xmlns:xm="http://www.mulesource.org/schema/mule/xml/2.2"
xmlns:vm="http://www.mulesource.org/schema/mule/vm/2.2"
xmlns:jdbc="http://www.mulesource.org/schema/mule/jdbc/2.2"
xmlns:file="http://www.mulesource.org/schema/mule/file/2.2"
xsi:schemaLocation="
http://www.mulesource.org/schema/mule/jdbc/2.2 http://www.mulesource.org/schema/mule/jdbc/2.2/mule-jdbc.xsd
http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
http://www.mulesource.org/schema/mule/jms/2.2 http://www.mulesource.org/schema/mule/jms/2.2/mule-jms.xsd
http://www.mulesource.org/schema/mule/vm/2.2 http://www.mulesource.org/schema/mule/vm/2.2/mule-vm.xsd
http://www.mulesource.org/schema/mule/file/2.2 http://www.mulesource.org/schema/mule/file/2.2/mule-file.xsd
http://www.mulesource.org/schema/mule/xml/2.2 http://www.mulesource.org/schema/mule/xml/2.2/mule-xml.xsd">
<!-- Endpoints -->
<jdbc:inbound-endpoint
name="jdbcKapitalCommandIn"
connector-ref="jdbcConnector"
queryKey="queryKapitalProcessControl"
pollingFrequency="10000" synchronous="true">
</jdbc:inbound-endpoint>
<jdbc:outbound-endpoint
name="jdbcKapitalCommandOut"
connector-ref="jdbcConnector"
queryKey="updateKapitalProcessControl"
synchronous="true">
</jdbc:outbound-endpoint>
<file:endpoint
name="kapitalErrorBackup"
path="${APPS_HOME}/lbo-esb/files/kapital/error"
outputPattern="#[DATE:yyyy-MM-dd_HH-mm-ss]_error.txt">
</file:endpoint>
<file:endpoint
name="kapitalInputBackup"
path="${APPS_HOME}/lbo-esb/files/kapital/backup"
outputPattern="#[DATE:yyyy-MM-dd_HH-mm-ss]_kapital-command.xml">
</file:endpoint>
<file:endpoint
name="kapitalInvalidSchemaBackup"
path="${APPS_HOME}/lbo-esb/files/kapital/error"
outputPattern="#[DATE:yyyy-MM-dd_HH-mm-ss]_inv_schema.xml">
</file:endpoint>
<!-- Kapital -->
<vm:endpoint
name="kapitalTransactionInput"
path="kapital.transaction.input">
</vm:endpoint>
<vm:endpoint
name="kapitalError"
path="kapital.error.input">
</vm:endpoint>
<model
name="KapitalServices">
<default-service-exception-strategy>
<outbound-endpoint
ref="kapitalError">
</outbound-endpoint>
</default-service-exception-strategy>
<service
name="kapitalService">
<inbound>
<inbound-endpoint
ref="jdbcKapitalCommandIn">
</inbound-endpoint>
</inbound>
<echo-component />
<!-- more stuff from here -->
</service>
</model>
<!-- more stuff from here -->
</mule>

Since you're not showing your configuration, it's hard to help you.
From the exception, my impression is that the issue has nothing to do with JDBC. It seems you try to define an inbound-endpoint in a place where only global endpoints (not inbound, not outbound) can be declared. Global endpoints are declared out of services, in/out-bound ones inside services.
If I'm wrong in my diagnostic, please share your config.

Related

How to fix "java.lang.IllegalArgumentException: interface org.glassfish.hk2.api.ProxyCtl is not visible from class loader"

I am trying to override the Jersey (and dependency) libraries(v2.21) available in WebLogic 12.2.1 with application packaged ones which has Jersey v2.25.1. But end up with below:
A MultiException has 4 exceptions. They are
java.lang.IllegalArgumentException: interface org.glassfish.hk2.api.ProxyCtl is not visible from class loader
java.lang.IllegalArgumentException: While attempting to create a Proxy for javax.servlet.http.HttpServletResponse in scope org.glassfish.jersey.process.internal.RequestScoped an error occured while creating the proxy
java.lang.IllegalArgumentException: While attempting to resolve the dependencies of com.abc.xyz.JerseySampleProvider.MyProvider errors were found
java.lang.IllegalStateException: Unable to perform operation: resolve on com.abc.xyz.JerseySampleProvider.MyProvider
Tried other versions of Jersey like 2.19 as well. Same result. Any help would be appreciated.I also came across similar reported issues in this forum but did not see a solution
XML as below
<container-descriptor>
<prefer-application-packages>
<!-- hk2 providers -->
<package-name>org.glassfish.hk2.*</package-name>
<package-name>org.jvnet.hk2.*</package-name>
<package-name>org.jvnet.tiger_types.*</package-name>
<!-- apis -->
<package-name>javax.ws.rs.*</package-name>
<!-- java assist -->
<package-name>javaassist.*</package-name>
<!-- aop repackaged -->
<package-name>org.aopalliance.*</package-name>
<!-- guava -->
<package-name>com.google.common.*</package-name>
<!-- jersey2 providers -->
<package-name>org.glassfish.jersey.*</package-name>
<package-name>jersey.repackaged.*</package-name>
<package-name>com.sun.research.ws.wadl.*</package-name>
<package-name>com.sun.ws.rs.ext.*</package-name>
<!-- Jackson providers -->
<package-name>com.fasterxml.*</package-name>
<!--Others-->
<package-name>org.objectweb.asm.*</package-name>
<package-name>antlr.*</package-name>
</prefer-application-packages>
<prefer-application-resources>
<!-- hk2 -->
<resource-name>META-INF/services/org.glassfish.hk2.*</resource-name>
<resource-name>org.glassfish.hk2.*</resource-name>
<resource-name>org.jvnet.hk2.*</resource-name>
<resource-name>org.jvnet.tiger_types.*</resource-name>
<resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</resource-name>
<resource-name>META-INF/services/javax.ws.rs.ext.RuntimeDelegate</resource-name>
<!-- Jersey -->
<resource-name>META-INF/services/org.glassfish.jersey.*</resource-name>
<resource-name>org.glassfish.jersey.*</resource-name>
<resource-name>jersey.repackaged.*</resource-name>
</prefer-application-resources>
</container-descriptor>

Unable to write application logs using externalized Log4j2 XML configuration using Red Hat EAP 7.1.5

I have an application made of Spring Boot WAR packages that need to be migrated to Red Hat EAP 7.1.5.
In my current setup I do the following:
Each WAR has a dedicated log4j2 XML per environment.
This XML file name is defined in the web.xml
The folder containing the log4j2_xxxx.xml is added to the classpath in the JVM startup script.
The WARs are distributed across multiple run-time instances, with a possibility of one run-time hosting more than one WAR.
I would like to replicate the same using EAP. I do see the external log4j2 XML configuration being successfully loaded, however do not see any log statements being written at all.
I am using the following dependencies for packaging log4j2
org.springframework.boot.spring-boot-starter-log4j2 (version 1.5.7)
org.apache.logging.log4j.log4j-web (version 2.10.0)
I have tried the following:
Define a custom module under $JBOSS_HOME/modules/
Add the log4j2 XML in the same folder.
Refer this as global-module in standalone.xml
When I deploy a WAR I can see that the expected log file is created, which means the log4j2 XML configuration is being read successfully. However no logs get written at all in the application log file.
I have tried to get past this by defining a jboss-deployment-structure XML as follows:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.apache.log4j" />
<module name="org.jboss.log4j.logmanager" />
<module name="org.jboss.logging" />
<module name="org.jboss.logging.commons.logging" />
<module name="org.jboss.logging.jul-to-slf4j-stub" />
</exclusions>
<exclude-subsystems>
<subsystem name="logging"/>
</exclude-subsystems>
</deployment>
</jboss-deployment-structure>
This results in the application logging being removed from the default JBOSS log (server.log) altogether but it does not write the logs to the designated log as well.
I would expect all the logging being done within the application to be written into the file defined by the external log4j2 XML configuration. Any idea what I am missing?

Unable to use JCA CICS resource with IBM WebSphere Application Server Liberty Profile

I'm trying to setup WLP for an existing EAR application.
This setup works fine with WAS 9 traditional.
The problem is the JCA CICS Resource Adapter call.
The server.xml :
<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">
<!-- Enable features -->
<featureManager>
<feature>javaee-7.0</feature>
</featureManager>
<!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
<httpEndpoint id="defaultHttpEndpoint"
host="*"
httpPort="9080"
httpsPort="9443" />
<!-- Automatically expand WAR files and EAR files -->
<applicationManager autoExpand="true"/>
<library id="sharedLibs">
<fileset dir="/work/sharedlibs" includes="*.jar"/>
<folder dir="/work" />
</library>
<resourceAdapter
autoStart="true"
id="eciResourceAdapter"
location="/work/cicseci.rar">
</resourceAdapter>
<connectionFactory id="CTGDV06" jndiName="jca/CTGDV06" >
<properties.eciResourceAdapter.javax.resource.cci.ConnectionFactory
connectionUrl="tcp://*******"
serverName="*******"
userName="*******"
portNumber="2006"
/>
</connectionFactory>
<application type="ear" id="app" location="app.ear" name="app">
<classloader
commonLibraryRef="sharedLibs"
classProviderRef="eciResourceAdapter" />
</application>
</server>
in ibm-web-bnd.xml :
<resource-ref name="cicsjca" binding-name="jca/CTGDV06"></resource-ref>
in web.xml :
<resource-ref id="ResourceRef_Cics_Jca">
<description>Acces CICS</description>
<res-ref-name>cicsjca</res-ref-name>
<res-type>javax.resource.cci.ConnectionFactory</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
Startup is Ok, but access to JCA fail with :
java.lang.Exception: Lookup for java:comp/env/cicsjca failed. Exception: javax.naming.NamingException: CWNEN1001E: The object referenced by the java:comp/env/cicsjca JNDI name could not be instantiated. If the reference name maps to a JNDI name in the deployment descriptor bindings for the application performing the JNDI lookup, make sure that the JNDI name mapping in the deployment descriptor binding is correct. If the JNDI name mapping is correct, make sure the target resource can be resolved with the specified name relative to the default initial context.
[Root exception is com.ibm.wsspi.injectionengine.InjectionException: CWNEN0030E: The server was unable to obtain an object instance for the java:comp/env/cicsjca reference. The exception message was: CWNEN1003E: The server was unable to find the jca/CTGDV06 binding with the javax.resource.cci.ConnectionFactory type for the java:comp/env/cicsjca reference.]
I don't understand what's wrong with this setup, any help would be apreciated !
The correct configuration depends on how many connection factory implementations are provided by the resource adapter.
If the resource adapter provides only a single connection factory (which is commonly the case for many resource adapters), then configuration would be:
<connectionFactory id="CTGDV06" jndiName="jca/CTGDV06" >
<properties.eciResourceAdapter
connectionUrl="tcp://*******"
serverName="*******"
userName="*******"
portNumber="2006"
/>
</connectionFactory>
Full detail on how to specify configuration for JCA resource adapters in Liberty can be found here in the knowledge center.

Configuring TCP communications with Spring Integration Issues

I seem to be having some trouble configuring my Spring MVC backend to receive and send TCP messages. Looking at the configuration a user suggests in this question - how to plug a TCP-IP client server in a spring MVC application - I tried to place this configuration into my root-context.xml. However, for all of the tags it displays a message such as:
Unable to locate Spring NamespaceHandler for element 'int-ip:tcp-outbound-gateway' of schema namespace 'http://www.springframework.org/schema/integration/ip'
int-ip:tcp-outbound-gateway and int:gateway both display cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'int:gateway' (replace int:gateway with int-ip:tcp-outbound-gateway).
Here is my root-context.xml file:
<?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-ip="http://www.springframework.org/schema/integration/ip"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip.xsd
http://www.springframework.org/schema/integration/ http://www.springframework.org/schema/integration/spring-integration.xsd">
<!-- Root Context: defines shared resources visible to all other web components -->
<int:gateway id="gw"
service-interface="org.springframework.integration.samples.tcpclientserver.SimpleGateway"
default-request-channel="input"/>
<int-ip:tcp-connection-factory id="client"
type="client"
host="localhost"
port="1234"
single-use="true"
so-timeout="10000"/>
<int:channel id="input" />
<int-ip:tcp-outbound-gateway id="outGateway"
request-channel="input"
reply-channel="clientBytes2StringChannel"
connection-factory="client"
request-timeout="10000"
remote-timeout="10000"/>
<int:transformer id="clientBytes2String"
input-channel="clientBytes2StringChannel"
expression="new String(payload)"/>
</beans>
What am I doing incorrectly? Also, some general tips as to how I could use Spring to send and receive TCP communications would be appreciated :)
It appears you don't have the spring-integration-ip and spring-integration-core jars on your classpath. You need to bundle them into your war or otherwise make them available on the classpath according to your app server's requirements.

Webpshere server is not gettin started after adding MDB configuration to ejb-jar xml

I have added MDB configuration to the ejb-jar.xml and ibm-ejb-jar-bnd.xmi files and then restart fails with throwing the below error,if i revert my changes it started working fine.
Error Message: Caused by: java.lang.IllegalStateException: Parent Translator (EnterpriseBeansTranslator(entity|session|message-driven,841888302)) did not find a Child Translator for "message-driven-destination".
Could you please help me to understand the root cause of the issue. Below is the MDB configuration added.Please help me if the issue is due to xsd??
<ejb-jar id="ejb-jar_1" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
<enterprise-beans>
<message-driven id="MessageDriven_TestJMSMDBL">
<description>Message Driven Bean for JMS Listener TestJMSMDBL</description>
<ejb-name>TestJMSMDBL</ejb-name>
<ejb-class>com.pega.pegarules.internal.etier.mdb.PRJMSListenerBoot</ejb-class>
<transaction-type>Container</transaction-type>
<message-driven-destination id="MessageDrivenDestination_TestJMSMDBL">
<destination-type>javax.jms.Queue</destination-type>
</message-driven-destination>
<env-entry>
<env-entry-name>PRListener</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>TestJMSMDBL</env-entry-value>
</env-entry>
<env-entry>
<env-entry-name>UseCMT</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>true</env-entry-value>
</env-entry>
<ejb-local-ref id="EJBLocalRef_TestJMSMDBL_EngineBMTLocal">
<description/>
<ejb-ref-name>ejb/EngineBMTLocal</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.pega.pegarules.internal.etier.interfaces.EngineLocalHome</local-home>
<local>com.pega.pegarules.internal.etier.interfaces.EngineLocal</local>
<ejb-link>EngineBMT</ejb-link>
</ejb-local-ref>
<ejb-local-ref id="EJBLocalRef_TestJMSMDBL_EngineCMTLocal">
<description/>
<ejb-ref-name>ejb/EngineCMTLocal</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.pega.pegarules.internal.etier.interfaces.EngineLocalHome</local-home>
<local>com.pega.pegarules.internal.etier.interfaces.EngineLocal</local>
<ejb-link>EngineCMT</ejb-link>
</ejb-local-ref>
</message-driven>
</enterprise-beans>
Your MDB definition is not correct. You should have something like below. It should be <message-destination-type> not <message-driven-destination>.
<message-driven id="MyMDB">
<ejb-name>MyMDB</ejb-name>
<ejb-class>ejbs.MyMDBBean</ejb-class>
<messaging-type>javax.jms.MessageListener</messaging-type>
<transaction-type>Container</transaction-type>
<message-destination-type>javax.jms.Queue</message-destination-type>
</message-driven>
Here is the sample binding file. But you can remove binding for message driven from file and then install it using console. You will be able to define mapping there. Afterwards you can export application from the console and you may then extract correct binding file from there.
<?xml version="1.0" encoding="UTF-8"?>
<ejbbnd:EJBJarBinding xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ejb="ejb.xmi" xmlns:ejbbnd="ejbbnd.xmi" xmi:id="EJBJarBinding_1409479703640">
<ejbJar href="META-INF/ejb-jar.xml#ejb-jar_ID"/>
<ejbBindings xmi:type="ejbbnd:MessageDrivenBeanBinding" xmi:id="MessageDrivenBeanBinding_1409479703640" activationSpecJndiName="myActiveSpec" destinationJndiName="eis/as1">
<enterpriseBean xmi:type="ejb:MessageDriven" href="META-INF/ejb-jar.xml#MyMDB"/>
</ejbBindings>
</ejbbnd:EJBJarBinding>

Resources