Cannot find the declaration of element 'kmodule' - drools

This error occurred while running PricingRuleDTExample (or any example) from drools-examples on Drools6
2016-04-22 12:55:57,476 [main] ERROR Unable to build index of kmodule.xml url=file:/C:/Users/xxxx/workspace/drools-examples/target/classes/META-INF/kmodule.xml
org.xml.sax.SAXParseException; systemId: file:/C:/Users/xxxx/workspace/drools-examples/target/classes/META-INF/kmodule.xml; lineNumber: 4; columnNumber: 52; cvc-elt.1: Cannot find the declaration of element 'kmodule'.

The problem is because kmodule.xml namespace declaration is:
<kmodule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.drools.org/xsd/kmodule">
which is pre-drools6 declaration. The fix was to change it to
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">

Related

org.xml.sax.SAXParseException : Content is not allowed in prolog

This is my project demo, I want to use MyBatis xml configuration. But I got a SAXParseException error, like this
Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:260)
at org.apache.ibatis.parsing.XPathParser.<init>(XPathParser.java:126)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.<init>(XMLMapperBuilder.java:80)
at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:519)
... 56 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1472)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:994)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:258)
... 59 more
this is my mapper xml file:
<?xml version="1.0" encoding="UTF-8" ?>
<mapper namespace="com.ryanqy.mapper.UserMapper" xmlns="http://mybatis.org/schema/mybatis-mapper">
<resultMap id="userResultMap" type="com.ryanqy.entity.UserEntity">
<result column="username" property="username"/>
<result column="password" property="password"/>
</resultMap>
<select id="findUserByUserName" resultMap="userResultMap">
select * from uuc_user where username = #{userName}
</select>
</mapper>
Problem is with your mybatis config:
mybatis:
configuration:
map-underscore-to-camel-case: true
type-aliases-package: com.ryanqy.entity
mapper-locations: mapper
change mapper-locations to:
mapper-locations: mapper/UserMapper.xml
#OR
mapper-locations: mapper/*.xml
If you change, you receive error with missing DOCTYPE in your mapper XML, so add something like this
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">

cvc-complex-type.2.4.b: The content of element 'persistence' is not complete. One of '{"http://xmlns.jcp.org/xml/ns/persistence"...' is expected

I'm trying to deploy a sample JSF 2.3 Application in development, using Eclipse 2018-09 and Payara 5 but it returns me this error:
2018-10-14T15:19:42.783-0300|Severe: Exception during lifecycle processing java.io.IOException: org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 15; Deployment descriptor file META-INF/persistence.xml in archive [classes]. cvc-complex-type.2.4.b: The content of element 'persistence' is not complete. One of '{"http://xmlns.jcp.org/xml/ns/persistence":persistence-unit}' is expected.
Here is my persistence.xmlfile:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd"
version="2.2">
<!-- JPA configuration here. -->
</persistence>
And here is an excerpt of my Console output:
2018-10-14T15:19:38.525-0300|Info: Virtual server server loaded default web module 2018-10-14T15:19:42.779-0300|Severe:enterprise.deployment.backend.invalidDescriptorFailure
2018-10-14T15:19:42.781-0300|Severe: enterprise.deployment.backend.saxParserError
2018-10-14T15:19:42.782-0300|Severe: Exception while deploying the app [project]
2018-10-14T15:19:42.783-0300|Severe: Exception during lifecycle processing
java.io.IOException: org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 15; Deployment descriptor file META-INF/persistence.xml in archive [classes]. cvc-complex-type.2.4.b: The content of element 'persistence' is not complete. One of '{"http://xmlns.jcp.org/xml/ns/persistence":persistence-unit}' is expected.
at org.glassfish.javaee.core.deployment.DolProvider.processDOL(DolProvider.java:207)
at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:223)
at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:91)
at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:933)
at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:873)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepare(ApplicationLifecycle.java:383)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:540)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:549)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:545)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:544)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:575)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:567)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:566)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1475)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:111)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1857)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1733)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:564)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:251)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:166)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:516)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:213)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:182)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:156)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:218)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:95)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:260)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:177)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:109)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:88)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:524)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:89)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:94)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:33)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:114)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 15; Deployment descriptor file META-INF/persistence.xml in archive [classes]. cvc-complex-type.2.4.b: The content of element 'persistence' is not complete. One of '{"http://xmlns.jcp.org/xml/ns/persistence":persistence-unit}' is expected.
at com.sun.enterprise.deployment.io.DeploymentDescriptorFile.read(DeploymentDescriptorFile.java:331)
at com.sun.enterprise.deployment.archivist.ExtensionsArchivist.open(ExtensionsArchivist.java:179)
at com.sun.enterprise.deployment.archivist.PersistenceArchivist.readPersistenceDeploymentDescriptor(PersistenceArchivist.java:158)
at com.sun.enterprise.deployment.archivist.WarPersistenceArchivist.open(WarPersistenceArchivist.java:99)
at com.sun.enterprise.deployment.archivist.Archivist.readRestDeploymentDescriptors(Archivist.java:403)
at com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:394)
at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:269)
at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:278)
at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:239)
at com.sun.enterprise.deployment.archivist.ApplicationFactory.openArchive(ApplicationFactory.java:161)
at org.glassfish.javaee.core.deployment.DolProvider.processDOL(DolProvider.java:199)
... 42 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 15; cvc-complex-type.2.4.b: The content of element 'persistence' is not complete. One of '{"http://xmlns.jcp.org/xml/ns/persistence":persistence-unit}' is expected.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:453)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3231)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.elementLocallyValidComplexType(XMLSchemaValidator.java:3207)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.elementLocallyValidType(XMLSchemaValidator.java:3154)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processElementContent(XMLSchemaValidator.java:3056)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleEndElement(XMLSchemaValidator.java:2135)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.endElement(XMLSchemaValidator.java:854)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2967)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
at com.sun.enterprise.deployment.io.DeploymentDescriptorFile.read(DeploymentDescriptorFile.java:321)
... 52 more
How can I fix this?
Thanks.
You need to provide persistence-unit information to persistence.xml file
Here is an example: https://www.thoughts-on-java.org/jpa-persistence-xml/
Hope it help!

SOAP Response error -must not contain the < character

Getting error as
java.lang.RuntimeException: Exception in preInvoke : javax.xml.soap.SOAPException: org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 47; The value of attribute "arasAML" associated with an element type "tcin:applyAMLInTCInputData" must not contain the '<' character.
I am testing my Webservice in SOAP UI , below is the SOAP request.
<soapenv:Envelope xmlns:soapenv="schemas.xmlsoap.org/soap/envelope/"; xmlns:tcin="de4.com/Schemas/TCIntgn/2013-05/TCIntegration">; <soapenv:Header/> <soapenv:Body> <tcin:ApplyAMLInTCInput> <tcin:applyAMLInTCInputData arasAML="<XML><REVISIONS><ITEM_REVISION><itemNo>000147</itemNo><type>PDF,DirectM‌​odel,MSPowerPointX</type></ITEM_REVISION></REVISIONS></XML>" message="DownloadDatasetFile" > </tcin:applyAMLInTCInputData> </tcin:ApplyAMLInTCInput> </soapenv:Body> </soapenv:Envelope>
getting SOAP response as below
<faultstring>java.lang.RuntimeException: Exception in preInvoke : javax.xml.soap.SOAPException: org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 47; The value of attribute "arasAML" associated with an element type "tcin:applyAMLInTCInputData" must not contain the '<' character.</faultstring>
You need to URL encode your data or put it into a CDATA block if it's going to contain special characters like < and >.

mybatis PersistenceException Mapper error

I don't know what is wrong.
Something is bad with mapper but everything looks good.
File UserMapper.xml
<?xml version="1.0" encoding="UTF-8"?>
<mapper namespace="com.javacodegeeks.snippets.enterprise.UserMapper">
<select id="addUser" parameterType="int" resultType="com.javacodegeeks.snippets.enterprise.User">
insert into * from users where id = #{id}
</select>
<select id="getUser" parameterType="int" resultType="com.javacodegeeks.snippets.enterprise.User">
select * from com.javacodegeeks.snippets.enterprise.User where id = #{id}
</select>
</mapper>
I get this Error:
Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException:
### Error building SqlSession.
### The error may exist in UserMapper.xml
### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 70; Document root element "mapper", must match DOCTYPE root "null".
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:51)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:35)
at Main.do1(Main.java:105)
at Main.main(Main.java:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 70; Document root element "mapper", must match DOCTYPE root "null".
You can use following doc type. However I find some discrepancy in the code you have copied. Are you sure of INSERT and SELECT statements. I hope its copy mistake
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.javacodegeeks.snippets.enterprise.UserMapper">
<select id="addUser" parameterType="int" resultType="com.javacodegeeks.snippets.enterprise.User">
insert into * from users where id = #{id}
</select>
<select id="getUser" parameterType="int" resultType="com.javacodegeeks.snippets.enterprise.User">
select * from com.javacodegeeks.snippets.enterprise.User where id = #{id}
</select>
</mapper>

How can i resolve this MULE_ERROR-109

I am performing a transformation and getting the following error:
ERROR 2013-10-02 12:38:19,763 [[vistaesb].VistaESBFlow1.stage1.04] org.mule.exception.DefaultMessagingExceptionStrategy:
Message : Failed to transform from "json" to "personal_information"
Code : MULE_ERROR-109
Exception stack is:
1. Unrecognized field "phone_number" (Class personal_information), not marked as ignorable
at [Source: java.io.InputStreamReader#ac7e4af; line: 2, column: 21] (through reference chain: personal_information["phone_number"]) (org.codehaus.jackson.map.exc.UnrecognizedPropertyException)
org.codehaus.jackson.map.exc.UnrecognizedPropertyException:53 (null)
2. Failed to transform from "json" to "personal_information" (org.mule.api.transformer.TransformerException)
org.mule.module.json.transformers.JsonToObject:136 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html)
MY configuration is simple enough:
<flow name="VistaESBFlow1" doc:name="VistaESBFlow1">
<jdbc-ee:inbound-endpoint queryKey="personal_information" responseTimeout="1000" encoding="UTF-8" mimeType="text/plain" queryTimeout="-1" pollingFrequency="10000" connector-ref="applyVista_dev" doc:name="Data Entry Point">
</jdbc-ee:inbound-endpoint>
<json:object-to-json-transformer doc:name="Object to JSON"/>
<data-mapper:transform config-ref="new_mapping_grf" doc:name="DataMapper"/>
<json:json-to-object-transformer doc:name="JSON to Object" encoding="utf8" returnClass="personal_information" mimeType="text/plain"/>
<file:outbound-endpoint path="C:\Users\abrowning\Desktop\test" responseTimeout="10000" doc:name="File" encoding="utf8" mimeType="text/plain"/>
</flow>
There is a link to a similar problem here, 109 Error, but i don't think this has to do with my endpoint.
I'm guessing a 109 is a bush-league error, so nay help is appreciated.
The source of my issue was that I had a data mismatch in my get/set methods and after having written a lot of PHP over the last year, I over looked that.