After adding "geronimo-stax-api_1.0_spec_1.0.1-wso2v1.jar" to repository/components/dropins, I get the following output when running "p javax.xml.stream" on osgi console. But I am still getting the error.
osgi> p javax.xml.stream javax.xml.stream; version="1.0.1"<org.eclipse.osgi_3.8.1.v20120830-144521 [0]> abdera_1.0.0.wso2v3 [4] imports annogen_0.1.0.wso2v1 [7] imports axiom_1.2.11.wso2v5 [12] imports axis2_1.6.1.wso2v11 [13] imports axis2-json_1.6.1.wso2v11 [14] imports compass_2.0.1.wso2v2 [35] imports hector-core_1.1.4.wso2v1 [41] imports jaxb_2.2.5.wso2v1 [47] imports neethi_2.0.4.wso2v4 [55] imports org.eclipse.core.expressions_3.4.401.v20120627-124442 [63] imports org.eclipse.core.runtime_3.8.0.v20120521-2346 [65] imports org.eclipse.equinox.p2.garbagecollector_1.0.200.v20110510 [91] imports org.wso2.carbon.andes.core_3.0.0.SNAPSHOT [122] imports org.wso2.carbon.application.deployer_4.3.0 [126] imports org.wso2.carbon.authenticator.stub_4.3.0 [129] imports org.wso2.carbon.base_4.3.0 [130] imports org.wso2.carbon.core_4.3.0 [134] imports org.wso2.carbon.core.commons.stub_4.3.0 [137] imports org.wso2.carbon.event.client_4.3.5.SNAPSHOT [143] imports org.wso2.carbon.event.client.stub_4.3.5.SNAPSHOT [144] imports org.wso2.carbon.event.core_4.3.5.SNAPSHOT [146] imports org.wso2.carbon.event.stub_4.3.5.SNAPSHOT [147] imports org.wso2.carbon.feature.mgt.stub_4.3.0 [152] imports org.wso2.carbon.identity.authenticator.saml2.sso_4.3.2 [155] imports org.wso2.carbon.identity.authenticator.saml2.sso.common_4.3.2 [156] imports org.wso2.carbon.identity.authenticator.saml2.sso.stub_4.3.2 [157] imports org.wso2.carbon.identity.sso.saml.stub_4.3.2 [159] imports org.wso2.carbon.identity.sts.store_4.3.2 [160] imports org.wso2.carbon.identity.user.store.configuration.stub_4.3.5.SNAPSHOT [163] imports org.wso2.carbon.java2wsdl.ui_4.3.5.SNAPSHOT [166] imports org.wso2.carbon.logging.admin.stub_4.3.5.SNAPSHOT [168] imports org.wso2.carbon.logging.service_4.3.5.SNAPSHOT [171] imports org.wso2.carbon.logging.view.stub_4.3.5.SNAPSHOT [172] imports org.wso2.carbon.messageflows.stub_4.3.5.SNAPSHOT [175] imports org.wso2.carbon.p2.touchpoint_4.3.0 [181] imports org.wso2.carbon.qpid.stub_4.3.5.SNAPSHOT [182] imports org.wso2.carbon.registry.common_4.3.0 [186] imports org.wso2.carbon.registry.common.ui_4.3.0 [187] imports org.wso2.carbon.registry.core_4.3.0 [188] imports org.wso2.carbon.registry.properties.stub_4.3.0 [190] imports org.wso2.carbon.registry.resource.stub_4.3.0 [193] imports org.wso2.carbon.registry.search.stub_4.3.0 [196] imports org.wso2.carbon.security.mgt_4.3.2 [204] imports org.wso2.carbon.server.admin_4.3.0 [207] imports org.wso2.carbon.server.admin.stub_4.3.0 [209] imports org.wso2.carbon.statistics.stub_4.3.5.SNAPSHOT [212] imports org.wso2.carbon.tenant.common_4.3.4 [214] imports org.wso2.carbon.tenant.common.stub_4.3.4 [215] imports org.wso2.carbon.tenant.mgt.stub_4.3.4 [221] imports org.wso2.carbon.tenant.redirector.servlet.stub_4.3.4 [224] imports org.wso2.carbon.tenant.throttling.agent_4.3.4 [228] imports org.wso2.carbon.tenant.usage.agent_4.3.4 [229] imports org.wso2.carbon.throttling.agent.stub_4.3.4 [230] imports org.wso2.carbon.tracer.stub_4.3.5.SNAPSHOT [236] imports org.wso2.carbon.tryit_4.3.5.SNAPSHOT [238] imports org.wso2.carbon.ui_4.3.0 [240] imports org.wso2.carbon.um.ws.api.stub_4.3.5.SNAPSHOT [244] imports org.wso2.carbon.user.core_4.3.0 [247] imports org.wso2.carbon.user.mgt.stub_4.3.5.SNAPSHOT [250] imports org.wso2.carbon.utils_4.3.0 [252] imports org.wso2.carbon.wsdl2code.stub_4.3.5.SNAPSHOT [254] imports org.wso2.carbon.wsdl2code.ui_4.3.5.SNAPSHOT [255] imports rampart-core_1.6.1.wso2v14 [263] imports rampart-policy_1.6.1.wso2v14 [264] imports rampart-trust_1.6.1.wso2v14 [265] imports spring.framework_3.2.9.wso2v1 [269] imports tomcat_7.0.52.wso2v5 [271] imports xmlbeans_2.3.0.wso2v1 [280] imports javax.xml.stream; version="1.0.1"<geronimo-stax-api_1.0_spec_1.0.1.wso2v1 [38]> Hemika Kodikara Software Engineer WSO2 Inc. lean . enterprise . middleware http://wso2.com Mobile : +94777688882 On Mon, Feb 9, 2015 at 6:59 PM, KasunG Gajasinghe <[email protected]> wrote: > What does "p javax.xml.stream" return in your osgi console? > > On Mon, Feb 9, 2015 at 6:14 PM, Hemika Kodikara <[email protected]> wrote: > >> I moved the code to the java class that invoked by the JSP page. >> The implementation is as follows. >> >> BrokerClient.java >> =============================== >> public void publish(String topic, String message) throws AxisFault, >> XMLStreamException { >> log.debug("published element to " + topic); >> >> StAXOMBuilder builder = new StAXOMBuilder(new >> ByteArrayInputStream(message.getBytes())); >> OMElement omElementMessage = builder.getDocumentElement(); >> EventBrokerServiceStub service = new >> EventBrokerServiceStub(configurationContext, brokerUrl + "/publish/" + >> topic); >> configureCookie(service._getServiceClient()); >> ServiceClient serviceClient = service._getServiceClient(); >> >> OMElement header = fac.createOMElement(new QName(TOPIC_HEADER_NS, >> TOPIC_HEADER_NAME)); >> header.setText(topic); >> serviceClient.addHeader(header); >> serviceClient.getOptions().setTo(new EndpointReference(brokerUrl >> + "/publish")); >> //serviceClient.getOptions().setTo(new >> EndpointReference(brokerUrl)); >> serviceClient.getOptions().setAction("urn:publish"); >> serviceClient.sendRobust(omElementMessage); >> } >> >> >> The relevant JSP page code >> =============================== >> <%@ page import="org.apache.axiom.om.OMElement" %> >> <%@ page import="org.apache.axiom.om.impl.builder.StAXOMBuilder" %> >> <%@ page import="org.wso2.carbon.event.client.broker.BrokerClient" %> >> <%@ page import="org.wso2.carbon.event.ui.UIUtils" %> >> <%@ page import="java.io.ByteArrayInputStream" %> >> >> <% >> >> 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); >> String messageToBePrinted = null; >> try { >> brokerClient.publish(topic, textMsg); >> } catch (Exception e) { >> messageToBePrinted = "Error: while publishing the message " + >> e.getMessage(); >> } >> >> if (messageToBePrinted == null) { >> messageToBePrinted = "Successfully published the message to the >> topic :" + topic; >> } >> %> >> <%=messageToBePrinted%> >> >> >> But I am getting the following error now. >> >> =============== Error ================= >> org.apache.jasper.JasperException: Unable to compile class for JSP: >> >> An error occurred at line: 16 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 >> 13: session.setAttribute("xmlMessage", textMsg); >> 14: String messageToBePrinted = null; >> 15: try { >> 16: brokerClient.publish(topic, textMsg); >> 17: } catch (Exception e) { >> 18: messageToBePrinted = "Error: while publishing the >> message " + e.getMessage(); >> 19: } >> >> >> An error occurred at line: 16 in the jsp file: >> /topics/try_it_out_invoke_ajaxprocessor.jsp >> The method publish(String, String) from the type BrokerClient refers to >> the missing type XMLStreamException >> 13: session.setAttribute("xmlMessage", textMsg); >> 14: String messageToBePrinted = null; >> 15: try { >> 16: brokerClient.publish(topic, textMsg); >> 17: } catch (Exception e) { >> 18: messageToBePrinted = "Error: while publishing the >> message " + e.getMessage(); >> 19: } >> >> >> 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) >> >> >> Any help on this would be appreciated. >> >> Hemika Kodikara >> Software Engineer >> WSO2 Inc. >> lean . enterprise . middleware >> http://wso2.com >> >> Mobile : +94777688882 >> >> On Mon, Feb 9, 2015 at 5:23 PM, Hemika Kodikara <[email protected]> wrote: >> >>> 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 <0711241005>* >>>>> >>>>> >>>> >>> >> > > > -- > > *Kasun Gajasinghe*Senior Software Engineer, WSO2 Inc. > email: kasung AT spamfree wso2.com > linked-in: http://lk.linkedin.com/in/gajasinghe > blog: http://kasunbg.org > > >
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
