Hi Hemika,

is jsr173_api.jar is in your classpath? according to [1] thread, he has
solved the problem by adding jsr173_api.jar to classpath.

[1] http://www.coderanch.com/t/378351/java/java/XML-Beans-type-javax-xml

Thanks

On Mon, Feb 9, 2015 at 2:24 PM, Hemika Kodikara <[email protected]> wrote:

> Hi All,
>
> I have the following server code on a JSP page which is used to publish a
> message in MB.
>
> BrokerClient brokerClient = UIUtils.getBrokerClient(config, session,
> request);
>     String topic = request.getParameter("topic");
>     String textMsg = request.getParameter("xmlMessage");
>     session.setAttribute("errorTopic", topic);
>     session.setAttribute("xmlMessage", textMsg);
>     OMElement message;
>     String messageToBePrinted = null;
>     StAXOMBuilder builder = null;
>     try {
>         builder = new StAXOMBuilder(new
> ByteArrayInputStream(textMsg.getBytes()));
>         message = builder.getDocumentElement();
>         if (message != null) {
>             brokerClient.publish(topic, message);
>         } else {
>             messageToBePrinted = "Error: Failed to get document element
> from message " + textMsg;
>         }
>     } catch (Exception e) {
>         messageToBePrinted = "Error: while publishing the message " +
> e.getMessage();
>     }
>
>     if (messageToBePrinted == null) {
>         messageToBePrinted = "Successfully published the message to the
> topic :" + topic;
>     }
>
>
> But I am getting an error when executing it.
>
> The type javax.xml.stream.XMLStreamReader cannot be resolved. It is
> indirectly referenced from required .class files
>
>
> The error is coming from the following line.
>
> builder = new StAXOMBuilder(new ByteArrayInputStream(textMsg.getBytes()));
>
>
> I saw an earlier thread asking the same question, but unable to get a fix
> from it [1].
>
> Any idea why it is coming on a JSP page ?
>
> [1] - http://mail.wso2.org/mailarchive/dev/2014-April/030470.html
>
> Hemika Kodikara
> Software Engineer
> WSO2 Inc.
> lean . enterprise . middleware
> http://wso2.com
>
> Mobile : +94777688882
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Lakshman Udayakantha
WSO2 Inc. www.wso2.com
lean.enterprise.middleware
Mobile: *0711241005*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to