PUT operations to URL failed with status code 405: Method Not Allowed : Ivy Remote publishing - publish

I am getting the following error while try to publish artifact into the remote repository.
BUILD FAILED
/home/kannan/.jenkins/workspace/projectA/build.xml:87: impossible to publish artifacts for com.mycompany#projectA;1.0: java.io.IOException: PUT operation to URL http://myserver.com/repository/com.mycompany/projectA/1.0/ivy-1.0.xml failed with status code 405: Method Not Allowed
at org.apache.ivy.util.url.AbstractURLHandler.validatePutStatusCode(AbstractURLHandler.java:82)
at org.apache.ivy.util.url.BasicURLHandler.upload(BasicURLHandler.java:264)
at org.apache.ivy.util.url.URLHandlerDispatcher.upload(URLHandlerDispatcher.java:82)
at org.apache.ivy.util.FileUtil.copy(FileUtil.java:150)
at org.apache.ivy.plugins.repository.url.URLRepository.put(URLRepository.java:84)
at org.apache.ivy.plugins.repository.AbstractRepository.put(AbstractRepository.java:130)
at org.apache.ivy.plugins.resolver.RepositoryResolver.put(RepositoryResolver.java:234)
at org.apache.ivy.plugins.resolver.RepositoryResolver.publish(RepositoryResolver.java:216)
at org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:275)
at org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:254)
at org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:166)
at org.apache.ivy.Ivy.publish(Ivy.java:615)
at org.apache.ivy.ant.IvyPublish.doExecute(IvyPublish.java:312)
at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:277)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
impossible to publish artifacts;
PUT operation to URL http://myserver.com/repository/com.mycompany/projectA/1.0/ivy-1.0.xml failed with status code 405: Method Not Allowed
ivy.xml
<ivy-module version="2.0">
<info organisation="com.mycompany" module="projectA" revision="${version}">
<description>
This project provides interface to projectA.
</description>
</info>
<publications>
<artifact />
</publications>
<dependencies defaultconfmapping="*->*,!sources,!javadoc">
<dependency org="com.hazelcast" name="hazelcast-client" rev="2.5" transitive="false"/>
<dependency org="com.hazelcast" name="hazelcast" rev="3.1.5" transitive="false"/>
<dependency org="log4j" name="log4j" rev="1.2.16" transitive="false"/>
</dependencies>
</ivy-module>
ivysettings.xml
<ivysettings>
<settings defaultResolver="defaultresolver" />
<property name="ibiblio-maven2-root" value="http://repo1.maven.org/maven2/" />
<property name="build-server" value="http://myserver.com/repository" />
<resolvers>
<chain name="defaultresolver">
<ibiblio name="local" m2compatible="true" root="${build-server}" />
<url name="repository">
<ivy pattern="${build-server}/[organisation]/[module]/[revision]/ivy-[revision].xml" />
<artifact pattern="${build-server}/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
</chain>
</resolvers>
</ivysettings>
build.xml
<ivy:publish artifactspattern="${build.dir}/[artifact].[ext]"
resolver="repository" organisation="com.mycompany"
module="projectA" pubrevision="${version}" status="release" conf="java" />

I had the same error message trying to publish to Artifactory. It turned out I forgot to include the port 8081 in the URL.

what is your HTTP Server? Did you use Something like Artifactory?
If you are using Apache, the PUT operation is disabled by default (maybe the same for most Web servers). You'll have to enable it and associate a backend script to handle the query as expected (retrieving artifacts from query and saving them on file system).
I enable it using PHP, you can see how from my GitHub repository: https://github.com/opatry/ivy-frontend

if you are using Artifactory as your repository, check this out:
http://www.jfrog.com/confluence/display/RTF2X/Working+with+Ivy
The ivy settings should change the build-server property
<ivysettings>
<settings defaultResolver="defaultresolver" />
<property name="ibiblio-maven2-root" value="http://repo1.maven.org/maven2/" />
<property name="build-server" value="http://myserver.com/repository/libs-snapshot-local/" />
<resolvers>
<chain name="defaultresolver">
<ibiblio name="local" m2compatible="true" root="${build-server}" />
<url name="repository">
<ivy pattern="${build-server}/[organisation]/[module]/[revision]/ivy-[revision].xml" />
<artifact pattern="${build-server}/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
</chain>
</resolvers>
</ivysettings>

Related

Mail sending through gmail in Mule Flow

I am struggling with mail sending flow in mule, Getting below error:
Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=smtps://dummy.DevGroup:<password>#smtp.gmail.com, connector=SmtpsConnector
I have below configuration in my xml file (Updated with namespace declarations in the Mule XML):
<mule
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:twilio="http://www.mulesoft.org/schema/mule/twilio"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:stdio="http://www.mulesoft.org/schema/mule/stdio"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
xmlns:jms="http://www.mulesoft.org/schema/mule/jms"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:smtp="http://www.mulesoft.org/schema/mule/smtp"
xmlns:smtps="http://www.mulesoft.org/schema/mule/smtps"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-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/stdio http://www.mulesoft.org/schema/mule/stdio/current/mule-stdio.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://www.mulesoft.org/schema/mule/smtp http://www.mulesoft.org/schema/mule/smtp/3.3/mule-smtp.xsd
http://www.mulesoft.org/schema/mule/smtps http://www.mulesoft.org/schema/mule/smtps/current/mule-smtps.xsd
http://www.mulesoft.org/schema/mule/twilio http://www.mulesoft.org/schema/mule/twilio/1.0/mule-twilio.xsd">
<service name="tool.muleservice.emailServiceintegration">
<inbound>
<inbound-endpoint ref="tool.endpoint.emailNotification"/>
</inbound>
<outbound>
<pass-through-router>
<outbound-endpoint ref="tool.smtp.endpoint.emailNotification"/>
</pass-through-router>
</outbound>
</service>
<smtps:endpoint name="tool.smtp.endpoint.emailNotification"
user="#[message.inboundProperties['userName']]"
password="#[message.inboundProperties['password']]"
host="smtp.gmail.com"
port="465"
from="dummy.DevGroup%40gmail.com"
transformer-refs="customEmailTransformer"
connector-ref="myTSLSMTPConnnector">
</smtps:endpoint>
<smtps:connector name="myTSLSMTPConnnector">
<smtps:tls-client path="../cacerts" storePassword="changeit" />
<smtps:tls-trust-store path="../cacerts" storePassword="changeit" />
</smtps:connector>
I updated the xml file as below content, to use smtp-gmail-connector given here
<service name="tool.muleservice.emailServiceintegration">
<inbound>
<inbound-endpoint
ref="tool.endpoint.emailNotification" />
</inbound>
<outbound>
<pass-through-router>
<!-- <outbound-endpoint ref="tool.smtp.endpoint.emailNotification"/> -->
<smtp:outbound-endpoint connector-ref="smtpGmailConnector"
subject="test msg"
address="smtps://#[message.inboundProperties['userName']]:#[message.inboundProperties['password']]#smtp.gmail.com"
responseTimeout="10000" doc:name="Send notification email" />
</pass-through-router>
</outbound>
</service>
<smtp:gmail-connector name="smtpGmailConnector"
contentType="text/html" fromAddress="iip.claims.test#gmail.com"
replyToAddresses="iip.claims.test#gmail.com" >
<smtp:header key="foo" value="bar" />
<smtp:header key="baz" value="boz" />
</smtp:gmail-connector>
But after this I am getting below error:
Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath*:/myApp-component-config/component-config.xml]
Offending resource: mule-bootstrap-config.xml; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath*:/myApp-integration-config/tool-mule-bootstrap-config.xml]
Offending resource: URL [vfs:/D:/Software/JBoss/jboss-eap-7.2/standalone/deployments/myApp.war/WEB-INF/lib/tool-intrg.jar/myApp-component-config/component-config.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath*:/myApp-integration-config/tool-intrg-flows.xml]
Offending resource: URL [vfs:/D:/Software/JBoss/jboss-eap-7.2/standalone/deployments/myApp.war/WEB-INF/lib/tool-intrg.jar/myApp-integration-config/tool-mule-bootstrap-config.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 91 in XML document from URL [vfs:/D:/Software/JBoss/jboss-eap-7.2/standalone/deployments/myApp.war/WEB-INF/lib/tool-intrg.jar/myApp-integration-config/tool-intrg-flows.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 91; columnNumber: 67; The prefix "doc" for attribute "doc:name" associated with an element type "smtp:outbound-endpoint" is not bound.
at deployment.myApp.war//org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)
at deployment.myApp.war//org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
at deployment.myApp.war//org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)
at deployment.myApp.war//org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:235)
Any help will be appreciated.
There are many details missing however on rereading the issue I suspect you are not following the deprecated syntax <service> correctly by trying to use a current example. Since that syntax has been deprecated for 6+ years, I would advice to move to the more current <flow> definitions.
In case you are unable or unwilling to migrate, you need to define an endpoint outside the service and reference it you could try the following steps:
Ensure that the namespaces at the beginning of the file are correct. The error mentions that doc: is not recognized. Maybe the namespaces are outdated.
Ensure that the dependencies in the pom reference your Mule 3.9.x release and not an older version that may not define doc.
Try moving <smtp:outbound-endpoint> to a separate endpoint definition and reference it from the <pass-through-router> as in your original implementation.
Example:
<service name="tool.muleservice.emailServiceintegration">
<inbound>
<inbound-endpoint ref="tool.endpoint.emailNotification"/>
</inbound>
<outbound>
<pass-through-router>
<outbound-endpoint ref="tool.smtp.endpoint.gmailNotification"/>
</pass-through-router>
</outbound>
</service>
<smtps:endpoint name="tool.smtp.endpoint.gmailNotification"
connector-ref="smtpGmailConnector"
subject="test msg"
address="smtps://#[message.inboundProperties['userName']]:#[message.inboundProperties['password']]#smtp.gmail.com"
responseTimeout="10000" doc:name="Send notification email" >
</smtps:endpoint>
<smtp:gmail-connector name="smtpGmailConnector"
contentType="text/html" fromAddress="iip.claims.test#gmail.com"
replyToAddresses="iip.claims.test#gmail.com" >
<smtp:header key="foo" value="bar" />
<smtp:header key="baz" value="boz" />
</smtp:gmail-connector>
Finally if everything else fails you could try removing the doc:name attribute and see what happens.

Could not initialize Start up controller. TaskManager not found

i have written a scheduled task which call an Api in sequence in wso2 ei 6.4.0. my task is :
<task xmlns="http://ws.apache.org/ns/synapse"
name="GetMunicipalityAPIToken"
class="org.apache.synapse.startup.tasks.MessageInjector"
group="synapse.simple.quartz">
<trigger interval="60"/>
<property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="message">
<test xmlns=""/>
</property>
<property xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
name="sequenceName"
value="GetTokenFromMunicipalityService"/>
<property xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
name="injectTo"
value="sequence"/>
</task>
and my sequence is :
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="GetTokenFromMunicipalityService" xmlns="http://ws.apache.org/ns/synapse">
<send>
<endpoint>
<http method="POST" uri-template="http://x.x.x.x/api/MunicipalityBill/connect/token"/>
</endpoint>
</send>
</sequence>
but when i run integrator.bat in wso2eiHome/bin I got this error : "Could not initialize Start up controller. TaskManager not found" and the Api dont be called. Do i forget something ?
The error can be caused when you do not have org.wso2.carbon.mediation.ntask.NTaskTaskManager defined in the server. Could you please check whether the following is added in the synapse.xml file located in the [EI_HOME]/repository/deployment/server/synapse-configs/default/ directory
<definitions xmlns="http://ws.apache.org/ns/synapse">
<taskManager provider="org.wso2.carbon.mediation.ntask.NTaskTaskManager"/>
</definitions>

Camel DataFormat Jackson using blueprint XML DSL throws context exception

No matter where I place the dataformats in XML DSL blueprint, I get this error just starting at different places. if I remove it, it works but of course I can't convert JSON to POJO. ??? any help or tell me what I'm doing wrong, what i'm missing. thanks!
Error
Unable to start blueprint container for bundle passthrumt1.core/1.0.1.SNAPSHOT
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'endpoint'. One of '{"http://camel.apache.org/schema/blueprint":redeliveryPolicyProfile, "http://camel.apache.org/schema/blueprint":onException, "http://camel.apache.org/schema/blueprint":onCompletion, "http://camel.apache.org/schema/blueprint":intercept, "http://camel.apache.org/schema/blueprint":interceptFrom, "http://camel.apache.org/schema/blueprint":interceptSendToEndpoint, "http://camel.apache.org/schema/blueprint":restConfiguration, "http://camel.apache.org/schema/blueprint":rest, "http://camel.apache.org/schema/blueprint":route}' is expected.
XML DSL
<camelContext
id="com.passthru.coreCamelContext"
trace="true"
xmlns="http://camel.apache.org/schema/blueprint"
allowUseOriginalMessage="false"
streamCache="true"
errorHandlerRef="deadLetterErrorHandler" >
<properties>
<property key="http.proxyHost" value="PITC-Zscaler-Americas.proxy.corporate.com"/>
<property key="http.proxyPort" value="80"/>
</properties>
<streamCaching id="CacheConfig"
spoolUsedHeapMemoryThreshold="70"
anySpoolRules="true"/>
<!-- -->
<dataFormats>
<json id="Json2Pojo" library="Jackson" unmarshalTypeName="com.passthru.core.entities.TokenEntities">
</json>
</dataFormats>
<endpoint id="predixConsumer" uri="direct:preConsumer" />
<endpoint id="predixProducer" uri="direct:preProducer" />
<endpoint id="getToken" uri="direct:getToken" />
<onException>
<exception>com.passthru.dataservice.PDXDataServiceInvalidDataException</exception>
<redeliveryPolicy maximumRedeliveries="3" />
<handled>
<constant>true</constant>
</handled>
<log
message="Invalid Data From Data Service"
loggingLevel="ERROR" />
<setBody>
<simple>${body.toString}</simple>
</setBody>
<to uri="file:{{errorArchive}}" />
</onException>
If I place the dataformats above properties, it complains, I have to remove properties and streamcache statements in order for it to work. but I need the proxy properties. any suggestions??? thanks again
If the
<camelContext
id="com.ge.digital.passthru.coreCamelContext"
trace="true"
xmlns="http://camel.apache.org/schema/blueprint"
allowUseOriginalMessage="false"
streamCache="true"
errorHandlerRef="deadLetterErrorHandler" >
<dataFormats>
<json id="Json2Pojo" library="Jackson" unmarshalTypeName="com.passthru.core.entities.TokenEntities"/>
</dataFormats>
<properties>
<property key="http.proxyHost" value="PITC-Zscaler-Americas-Cincinnati3PR.proxy.corporate.com"/>
<property key="http.proxyPort" value="80"/>
</properties>
i get this
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'properties'. One of '{"http://camel.apache.org/schema/blueprint":redeliveryPolicyProfile, "http://camel.apache.org/schema/blueprint":onException, "http://camel.apache.org/schema/blueprint":onCompletion, "http://camel.apache.org/schema/blueprint":intercept, "http://camel.apache.org/schema/blueprint":interceptFrom, "http://camel.apache.org/schema/blueprint":interceptSendToEndpoint, "http://camel.apache.org/schema/blueprint":restConfiguration, "http://camel.apache.org/schema/blueprint":rest, "http://camel.apache.org/schema/blueprint":route}' is expected.
what am I missing?
Camel blueprint XML is validated against camel-blueprint.xsd.
You are interested in complex type with name camelContextFactoryBean which contains sequence of available elements with fixed order.
Correct order of camelContext elements defined in this sequence is:
properties
globalOptions
propertyPlaceholder
package
packageScan
contextScan
jmxAgent
streamCaching
export
defaultServiceCallConfiguration
serviceCallConfiguration
defaultHystrixConfiguration
hystrixConfiguration
routeBuilder
routeContextRef
restContextRef
threadPoolProfile
threadPool
endpoint
dataFormats
transformers
validators
redeliveryPolicyProfile
onException
onCompletion
intercept
interceptFrom
interceptSendToEndpoint
restConfiguration
rest
route
To solve your problem move all endpoint declarations right above dataFormats.

I ain't able to convert json in XML

I am relative new in wso2 and are having some little problems. I already asked here, how to make this conversion, and was able to do so in another moment. But now i tried to do the same with the code passed for stack overflow:
<?xml version="1.0" encoding="UTF-8"?>
<api context="/Test" name="JsonToXmlApi" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST" uri-template="/xml/">
<inSequence>
<property name="messageType" scope="axis2" type="STRING" value="text/xml"/>
<header action="remove" name="To" scope="default"/>
<property name="RESPONSE" scope="default" type="STRING" value="true"/>
<send/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
And with the send equal request, of what was taught before:
But now i am receiving this error:
ERROR - PassThroughHttpSender Failed to submit the response
org.apache.axis2.AxisFault: Can not output XML declaration, after other output has already been done.
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:78)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:555)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:264)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:222)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:531)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:118)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:59)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.rest.Resource.process(Resource.java:343)
at org.apache.synapse.rest.API.process(API.java:399)
at org.apache.synapse.rest.RESTRequestHandler.apiProcess(RESTRequestHandler.java:123)
at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:101)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:69)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:304)
at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:75)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:325)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:371)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:151)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.xml.stream.XMLStreamException: Can not output XML declaration, after other output has already been done.
at com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1522)
at com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1551)
at com.ctc.wstx.sw.BaseStreamWriter.doWriteStartDocument(BaseStreamWriter.java:650)
at com.ctc.wstx.sw.BaseStreamWriter.writeStartDocument(BaseStreamWriter.java:638)
at com.ctc.wstx.sw.BaseStreamWriter.writeStartDocument(BaseStreamWriter.java:626)
at org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeStartDocument(MTOMXMLStreamWriter.java:277)
at org.apache.synapse.commons.json.JsonDataSource.serialize(JsonDataSource.java:88)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:691)
at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:562)
at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:875)
at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283)
at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245)
at org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:193)
at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:74)
... 24 more
[2017-07-25 15:35:50,646] ERROR - Axis2Sender Accept:*/*,Accept-Encoding:gzip, deflate, br,Accept-Language:pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4,Cache-Control:no-cache,Content-Type:application/soap+xml,Host:localhost:8280,Origin:chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop,Postman-Token:89253418-6c05-c959-5e21-2ce7555e0cb6,<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><jsonObject><location_response><name>cafe</name><tags>dsdsd</tags></location_response></jsonObject></soapenv:Body></soapenv:Envelope> Unexpected error sending message back
org.apache.axis2.AxisFault: Failed to submit the response
at org.apache.synapse.transport.passthru.PassThroughHttpSender.handleException(PassThroughHttpSender.java:613)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:266)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:222)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:531)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:118)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:59)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.rest.Resource.process(Resource.java:343)
at org.apache.synapse.rest.API.process(API.java:399)
at org.apache.synapse.rest.RESTRequestHandler.apiProcess(RESTRequestHandler.java:123)
at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:101)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:69)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:304)
at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:75)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:325)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:371)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:151)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.axis2.AxisFault: Can not output XML declaration, after other output has already been done.
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:78)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:555)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:264)
... 22 more
Caused by: javax.xml.stream.XMLStreamException: Can not output XML declaration, after other output has already been done.
at com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1522)
at com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1551)
at com.ctc.wstx.sw.BaseStreamWriter.doWriteStartDocument(BaseStreamWriter.java:650)
at com.ctc.wstx.sw.BaseStreamWriter.writeStartDocument(BaseStreamWriter.java:638)
at com.ctc.wstx.sw.BaseStreamWriter.writeStartDocument(BaseStreamWriter.java:626)
at org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeStartDocument(MTOMXMLStreamWriter.java:277)
at org.apache.synapse.commons.json.JsonDataSource.serialize(JsonDataSource.java:88)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:691)
at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:562)
at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:875)
at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283)
at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245)
at org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:193)
at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:74)
... 24 more
I already searched in the internet and in stackoverflow, but none of the resolutions used to this problem, solved in my case.
If anyone could help me i would stay quite grateful.
Thank you everyone.
The API you have shared is working fine. I have tried with postman and advanced rest client.
Refer https://docs.wso2.com/display/EI610/JSON+Support for more information about json support.
I can get the response for your api without error. Try with "application/xml" in the api instead of "text/xml".
<property name="messageType" value="application/xml" scope="axis2" type="STRING"/>

Exception in thread "management-client-thread 1-2" java.lang.OutOfMemoryError: Java heap space running an Arquillian test on a managed JBoss7.1.1Final

I'm getting the exception above while running a JUnit/Arquillian test in Eclipse Juno having a #Deployment method like this:
#Deployment
public static Archive<?> createDeployment() throws Exception {
File[] libs = Maven.resolver()
.loadPomFromFile("pom.xml")
.importRuntimeDependencies()
.as(File.class);
WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war")
.addClass(Permission.class)
.addClass(PermissionInterface.class)
.addClass(PermissionModel.class)
.addClass(PermissionModelInterface.class)
...
.addAsLibraries(libs)
.addAsResource(
"resources-jbossas-managed/test-persistence.xml",
"META-INF/persistence.xml")
.addAsWebResource(
EmptyAsset.INSTANCE,
ArchivePaths.create("beans.xml"));
System.out.println(war.toString(true));
return war;
}
and a persistence unit described like this:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/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_2_0.xsd">
<persistence-unit name="talmudDatabaseTest">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>java:/Alpha2Test</jta-data-source>
<properties>
<property name="eclipselink.target-server" value="JBoss" />
<property name="eclipselink.target-database" value="MySQL" />
<property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.ddl-generation.output-mode" value="database" />
<property name="eclipselink.weaving" value="static" />
<property name="eclipselink.logging.level" value="FINEST" />
<property name="eclipselink.deploy-on-startup" value="True" />
<property name="eclipselink.session-event-listener" value="it.cnr.ilc.omega.model.PersistenceEventListener" />
<property name="omega.import-sql" value="false" />
<property name="omega.import-sql.postlogin-filename" value="preconstruct.sql" />
<property name="omega.import-sql.postcreate-filename" value="postconstruct.sql" />
</properties>
</persistence-unit>
</persistence>
The running JBoss 7.1.1 Final instance has been launched with this configuration (on a Macbook Pro):
-server -Xms512m -Xmx1024m -XX:MaxPermSize=512m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true "-Dorg.jboss.boot.log.file=/usr/local/jboss-as-7.1.1.Final/standalone/log/boot.log" "-Dlogging.configuration=file:/usr/local/jboss-as-7.1.1.Final/standalone/configuration/logging.properties" "-Djboss.home.dir=/usr/local/jboss-as-7.1.1.Final" "-Dfile.encoding=UTF-8" "-Djboss.modules.system.pkgs=com.apple.laf,com.apple.laf.resources"
The #Test method isn't even called... the exception is thrown before it, but after the completion of the #Deployment method. Shrinkwrap creates this web archive:
test.war:
/beans.xml
/WEB-INF/
/WEB-INF/lib/
/WEB-INF/lib/atmosphere-compat-tomcat-1.1.0.beta3.jar
/WEB-INF/lib/bcprov-jdk14-1.38.jar
/WEB-INF/lib/jackson-databind-2.0.5.jar
/WEB-INF/lib/bcmail-jdk14-1.38.jar
/WEB-INF/lib/maven-aether-provider-3.0.5.jar
/WEB-INF/lib/shrinkwrap-impl-base-1.1.2.jar
/WEB-INF/lib/jcl-over-slf4j-1.6.4.jar
/WEB-INF/lib/shrinkwrap-resolver-spi-maven-2.0.0-beta-3.jar
/WEB-INF/lib/shrinkwrap-resolver-api-2.0.0-beta-3.jar
/WEB-INF/lib/maven-plugin-registry-2.0.9.jar
/WEB-INF/lib/shrinkwrap-spi-1.1.1.jar
/WEB-INF/lib/maven-model-builder-3.0.5.jar
/WEB-INF/lib/plexus-container-default-1.0-alpha-9-stable-1.jar
/WEB-INF/lib/geronimo-stax-api_1.0_spec-1.0.jar
/WEB-INF/lib/maven-plugin-api-2.0.9.jar
/WEB-INF/lib/poi-3.7.jar
/WEB-INF/lib/bcmail-jdk14-138.jar
/WEB-INF/lib/wagon-http-shared4-2.4.jar
/WEB-INF/lib/bcprov-jdk14-138.jar
/WEB-INF/lib/xmlbeans-2.3.0.jar
/WEB-INF/lib/maven-profile-2.0.9.jar
/WEB-INF/lib/poi-ooxml-schemas-3.7.jar
/WEB-INF/lib/aether-util-1.13.1.jar
/WEB-INF/lib/slf4j-log4j12-1.6.4.jar
/WEB-INF/lib/atmosphere-compat-jbossweb-1.1.0.beta3.jar
/WEB-INF/lib/jackson-core-2.0.5.jar
/WEB-INF/lib/commons-io-1.3.2.jar
/WEB-INF/lib/shrinkwrap-resolver-spi-2.0.0-beta-3.jar
/WEB-INF/lib/log4j-1.2.16.jar
/WEB-INF/lib/commons-digester-2.1.jar
/WEB-INF/lib/itext-2.1.7.js1.jar
/WEB-INF/lib/plexus-interpolation-1.14.jar
/WEB-INF/lib/classworlds-1.1-alpha-2.jar
/WEB-INF/lib/slf4j-simple-1.7.5.jar
/WEB-INF/lib/plexus-utils-2.0.6.jar
/WEB-INF/lib/annotation-detector-3.0.1.jar
/WEB-INF/lib/commons-codec-20041127.091804.jar
/WEB-INF/lib/atmosphere-compat-tomcat7-1.1.0.beta3.jar
/WEB-INF/lib/commons-collections-2.1.jar
/WEB-INF/lib/el-api-2.2.jar
/WEB-INF/lib/jdtcore-3.1.0.jar
/WEB-INF/lib/primefaces-3.5.jar
/WEB-INF/lib/commonj.sdo-2.1.1.v201112051852.jar
/WEB-INF/lib/shrinkwrap-resolver-impl-maven-2.0.0-beta-3.jar
/WEB-INF/lib/eclipselink-staticweave-maven-plugin-1.0.4.jar
/WEB-INF/lib/aether-spi-1.13.1.jar
/WEB-INF/lib/aether-impl-1.13.1.jar
/WEB-INF/lib/stax-api-1.0.1.jar
/WEB-INF/lib/jcommon-1.0.15.jar
/WEB-INF/lib/commons-logging-1.1.1.jar
/WEB-INF/lib/wagon-provider-api-2.4.jar
/WEB-INF/lib/xml-apis-1.4.01.jar
/WEB-INF/lib/plexus-compiler-javac-2.1.jar
/WEB-INF/lib/shrinkwrap-api-1.1.1.jar
/WEB-INF/lib/shrinkwrap-resolver-api-maven-2.0.0-beta-3.jar
/WEB-INF/lib/jsoup-1.6.3.jar
/WEB-INF/lib/plexus-component-api-1.0-alpha-33.jar
/WEB-INF/lib/maven-project-2.0.9.jar
/WEB-INF/lib/shrinkwrap-resolver-impl-maven-archive-2.0.0-beta-3.jar
/WEB-INF/lib/httpcore-4.2.3.jar
/WEB-INF/lib/maven-settings-builder-3.0.5.jar
/WEB-INF/lib/shrinkwrap-resolver-api-maven-archive-2.0.0-beta-3.jar
/WEB-INF/lib/maven-artifact-2.0.9.jar
/WEB-INF/lib/poi-ooxml-3.7.jar
/WEB-INF/lib/wagon-http-lightweight-2.4.jar
/WEB-INF/lib/dom4j-1.6.1.jar
/WEB-INF/lib/jena-core-2.10.0.jar
/WEB-INF/lib/slf4j-api-1.6.4.jar
/WEB-INF/lib/eclipselink-2.4.0.jar
/WEB-INF/lib/aether-connector-wagon-1.13.1.jar
/WEB-INF/lib/xercesImpl-2.10.0.jar
/WEB-INF/lib/castor-1.2.jar
/WEB-INF/lib/jfreechart-1.0.12.jar
/WEB-INF/lib/maven-repository-metadata-3.0.5.jar
/WEB-INF/lib/bctsp-jdk14-1.38.jar
/WEB-INF/lib/jasperreports-fonts-4.0.0.jar
/WEB-INF/lib/shrinkwrap-resolver-spi-maven-archive-2.0.0-beta-3.jar
/WEB-INF/lib/jena-tdb-0.10.0.jar
/WEB-INF/lib/commons-lang3-3.0.1.jar
/WEB-INF/lib/maven-artifact-manager-2.0.9.jar
/WEB-INF/lib/plexus-classworlds-2.4.jar
/WEB-INF/lib/maven-settings-3.0.5.jar
/WEB-INF/lib/commons-beanutils-1.8.0.jar
/WEB-INF/lib/jena-arq-2.10.0.jar
/WEB-INF/lib/httpclient-4.2.3.jar
/WEB-INF/lib/javax.persistence-2.0.4.v201112161009.jar
/WEB-INF/lib/aether-api-1.13.1.jar
/WEB-INF/lib/maven-model-3.0.5.jar
/WEB-INF/lib/atmosphere-runtime-1.1.0.beta3.jar
/WEB-INF/lib/plexus-compiler-api-2.1.jar
/WEB-INF/lib/jena-iri-0.9.5.jar
/WEB-INF/lib/jackson-annotations-2.0.5.jar
/WEB-INF/lib/jasperreports-5.0.0.jar
/WEB-INF/lib/wagon-file-2.4.jar
/WEB-INF/classes/
/WEB-INF/classes/META-INF/
/WEB-INF/classes/META-INF/persistence.xml
/WEB-INF/classes/it/
/WEB-INF/classes/it/cnr/
/WEB-INF/classes/it/cnr/ilc/
/WEB-INF/classes/it/cnr/ilc/omega/
/WEB-INF/classes/it/cnr/ilc/omega/resources/
/WEB-INF/classes/it/cnr/ilc/omega/resources/model/
/WEB-INF/classes/it/cnr/ilc/omega/resources/model/SourceInterface.class
/WEB-INF/classes/it/cnr/ilc/omega/resources/model/Source.class
/WEB-INF/classes/it/cnr/ilc/omega/resources/model/AttachmentInterface.class
/WEB-INF/classes/it/cnr/ilc/omega/resources/model/ResourceType.class
/WEB-INF/classes/it/cnr/ilc/omega/resources/model/ResourceInterface.class
/WEB-INF/classes/it/cnr/ilc/omega/resources/model/Resource.class
/WEB-INF/classes/it/cnr/ilc/omega/resources/model/Attachment.class
/WEB-INF/classes/it/cnr/ilc/omega/resources/model/ResourceTypeInterface.class
/WEB-INF/classes/it/cnr/ilc/omega/access/
/WEB-INF/classes/it/cnr/ilc/omega/access/LoginViewController.class
/WEB-INF/classes/it/cnr/ilc/omega/access/LoginViewControllerInterface.class
/WEB-INF/classes/it/cnr/ilc/omega/access/model/
/WEB-INF/classes/it/cnr/ilc/omega/access/model/Task.class
/WEB-INF/classes/it/cnr/ilc/omega/access/model/Role.class
/WEB-INF/classes/it/cnr/ilc/omega/access/model/Credentials.class
/WEB-INF/classes/it/cnr/ilc/omega/access/model/PermissionModel.class
/WEB-INF/classes/it/cnr/ilc/omega/access/model/TaskInterface.class
/WEB-INF/classes/it/cnr/ilc/omega/access/model/UserInterface.class
/WEB-INF/classes/it/cnr/ilc/omega/access/model/UserModelInterface.class
/WEB-INF/classes/it/cnr/ilc/omega/access/model/TaskModelInterface.class
/WEB-INF/classes/it/cnr/ilc/omega/access/model/PermissionInterface.class
/WEB-INF/classes/it/cnr/ilc/omega/access/model/PermissionModelInterface.class
/WEB-INF/classes/it/cnr/ilc/omega/access/model/User.class
/WEB-INF/classes/it/cnr/ilc/omega/access/model/LogoutEvent.class
/WEB-INF/classes/it/cnr/ilc/omega/access/model/TaskModel.class
/WEB-INF/classes/it/cnr/ilc/omega/access/model/Permission.class
/WEB-INF/classes/it/cnr/ilc/omega/access/model/UserModel.class
/WEB-INF/classes/it/cnr/ilc/omega/model/
/WEB-INF/classes/it/cnr/ilc/omega/model/AbstractEntityModel.class
/WEB-INF/classes/it/cnr/ilc/omega/model/AbstractEntityInterface.class
/WEB-INF/classes/it/cnr/ilc/omega/model/EntityDeleteEvent.class
/WEB-INF/classes/it/cnr/ilc/omega/model/EntityCreateEvent.class
/WEB-INF/classes/it/cnr/ilc/omega/model/EntityUpdateEvent.class
/WEB-INF/classes/it/cnr/ilc/omega/model/AbstractEntityModelInterface.class
/WEB-INF/classes/it/cnr/ilc/omega/model/AbstractEntity$Status.class
/WEB-INF/classes/it/cnr/ilc/omega/model/PersistenceEventListener.class
/WEB-INF/classes/it/cnr/ilc/omega/model/AbstractEntity.class
/WEB-INF/classes/it/cnr/ilc/omega/BaseController.class
/WEB-INF/classes/it/cnr/ilc/omega/Resources.class
/WEB-INF/classes/it/cnr/ilc/omega/reference/
/WEB-INF/classes/it/cnr/ilc/omega/reference/model/
/WEB-INF/classes/it/cnr/ilc/omega/reference/model/Reference.class
/WEB-INF/classes/it/cnr/ilc/omega/reference/model/ReferenceInterface.class
After that, Arquillian adds the archive on the active instance of JBoss, but the deployment can't terminate its operations. I've also managed to raise the memory for the JVM, but it doesn't seem to work. If I remove the libs form the archive, the #Test method is passed correctly, but the Session bean i'd like to inject:
#Inject
LoginViewController loginViewController;
isn't resolved like it should.
Can anyone help to find why the exception occurs? Thanks in advance... any help is appreciated!
.addAsWebResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
should be
.addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));