Hi KasunG,

I noticed that you replied to this thread[1] sometime back. May I know what
was the fix ? I may be having the same issue.

[1] - http://mail.wso2.org/mailarchive/dev/2014-April/030470.html

Thanks,
Hemika

Hemika Kodikara
Software Engineer
WSO2 Inc.
lean . enterprise . middleware
http://wso2.com

Mobile : +94777688882

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

> Hi Lakshman,
>
> I tried adding the following dependency. But I am still getting the error.
>
> <dependency>
>     <groupId>javax.xml.stream</groupId>
>     <artifactId>stax-api</artifactId>
>     <version>1.0-2</version>
> </dependency>
>
> FYI, following is the complete error stack.
>
> org.apache.jasper.JasperException: Unable to compile class for JSP:
> An error occurred at line: 18 in the jsp file:
> /topics/try_it_out_invoke_ajaxprocessor.jsp
> The type javax.xml.stream.XMLStreamException cannot be resolved. It is
> indirectly referenced from required .class files
> 15:     String messageToBePrinted = null;
> 16:     StAXOMBuilder builder = null;
> 17:     try {
> 18:         builder = new StAXOMBuilder(new
> ByteArrayInputStream(textMsg.getBytes()));
> 19:         message = builder.getDocumentElement();
> 20:         if (message != null) {
> 21:             brokerClient.publish(topic, message);
>
>
> An error occurred at line: 18 in the jsp file:
> /topics/try_it_out_invoke_ajaxprocessor.jsp
> The type javax.xml.stream.XMLStreamReader cannot be resolved. It is
> indirectly referenced from required .class files
> 15:     String messageToBePrinted = null;
> 16:     StAXOMBuilder builder = null;
> 17:     try {
> 18:         builder = new StAXOMBuilder(new
> ByteArrayInputStream(textMsg.getBytes()));
> 19:         message = builder.getDocumentElement();
> 20:         if (message != null) {
> 21:             brokerClient.publish(topic, message);
>
>
> An error occurred at line: 18 in the jsp file:
> /topics/try_it_out_invoke_ajaxprocessor.jsp
> The constructor StAXOMBuilder(InputStream) refers to the missing type
> XMLStreamException
> 15:     String messageToBePrinted = null;
> 16:     StAXOMBuilder builder = null;
> 17:     try {
> 18:         builder = new StAXOMBuilder(new
> ByteArrayInputStream(textMsg.getBytes()));
> 19:         message = builder.getDocumentElement();
> 20:         if (message != null) {
> 21:             brokerClient.publish(topic, message);
>
>
> Stacktrace:
>
> org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
>
> org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)
> org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:468)
> org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
> org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
> org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
>
> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:657)
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
> org.wso2.carbon.ui.JspServlet.service(JspServlet.java:155)
> org.wso2.carbon.ui.TilesJspServlet.service(TilesJspServlet.java:80)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
>
> org.eclipse.equinox.http.helper.ContextPathServletAdaptor.service(ContextPathServletAdaptor.java:37)
>
> org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
>
> org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
>
> org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:68)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
>
> org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68)
>
> org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(CharacterSetFilter.java:61)
>
> Hemika Kodikara
> Software Engineer
> WSO2 Inc.
> lean . enterprise . middleware
> http://wso2.com
>
> Mobile : +94777688882
>
> On Mon, Feb 9, 2015 at 2:42 PM, Lakshman Udayakantha <[email protected]>
> wrote:
>
>> 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