aspose file tools*
The moose likes Web Services and the fly likes Jersey web service exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Jersey web service exception " Watch "Jersey web service exception " New topic
Author

Jersey web service exception

Verna daniel
Greenhorn

Joined: Aug 09, 2012
Posts: 2
Hi,

I am using jersey spring rest service in weblogic application. I see the below Error on server startup, which is happening while trying to register Jersey rest beans.

Error at Line:99, token:[CLOSETAGBEGIN]Unbalanced ELEMENT got:body expected:p
at weblogic.xml.babel.baseparser.BaseParser.parseSome(BaseParser.java:374)
at weblogic.xml.stax.XMLStreamReaderBase.advance(XMLStreamReaderBase.java:195)
at weblogic.xml.stax.XMLStreamReaderBase.next(XMLStreamReaderBase.java:237)
at weblogic.xml.domimpl.Loader.load(Loader.java:112)
at weblogic.xml.domimpl.Loader.load(Loader.java:73)
at weblogic.xml.domimpl.Loader.load(Loader.java:35)
at weblogic.wsee.util.dom.DOMParser.getWebLogicDocumentImpl(DOMParser.java:122)
at weblogic.wsee.util.dom.DOMParser.getDocument(DOMParser.java:65)
at weblogic.wsee.wsdl.WsdlReader.getDocument(WsdlReader.java:311)
at weblogic.wsee.wsdl.WsdlReader.getDocument(WsdlReader.java:305)
at weblogic.wsee.jaxws.spi.WLSProvider.readWSDL(WLSProvider.java:296)
at weblogic.wsee.jaxws.spi.WLSProvider.createServiceDelegate(WLSProvider.java:77)
at weblogic.wsee.jaxws.spi.WLSProvider.createServiceDelegate(WLSProvider.java:62)
at javax.xml.ws.Service.<init>(Service.java:56)
at javax.xml.ws.Service.create(Service.java:680)
at org.springframework.remoting.jaxws.LocalJaxWsServiceFactory.createJaxWsService(LocalJaxWsServiceFactory.java:125)
at org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.prepare(JaxWsPortClientInterceptor.java:334)
at org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.afterPropertiesSet(JaxWsPortClientInterceptor.java:316)
at org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean.afterPropertiesSet(JaxWsPortProxyFactoryBean.java:42)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean(AbstractBeanFactory.java:1343)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:678)
at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:507)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:296)
at org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(AbstractApplicationContext.java:1132)
at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:142)
at org.springframework.beans.factory.BeanFactoryUtils.beanNamesIncludingAncestors(BeanFactoryUtils.java:124)
at com.sun.jersey.spi.spring.container.SpringComponentProviderFactory.register(SpringComponentProviderFactory.java:87)
at com.sun.jersey.spi.spring.container.SpringComponentProviderFactory.<init>(SpringComponentProviderFactory.java:83)
at com.sun.jersey.spi.spring.container.servlet.SpringServlet.initiate(SpringServlet.java:99)
at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:253)
at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:521)
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:199)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:308)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:471)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)


My web.xml configuration is as below -

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/restBean.xml</param-value>
</context-param>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>


<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>


<servlet>
<servlet-name>Jersey Spring Web Application</servlet-name>
<servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
<init-param>
<param-name>com.sun.ws.rest.config.property.resourceConfigClass</param-name>
<param-value>com.sun.ws.rest.api.core.PackagesResourceConfig</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.webex.fin.rest.wo.invoice;com.webex.fin.mbeans.enterprise.billing</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Spring Web Application</servlet-name>
<url-pattern>/webresources/*</url-pattern>
</servlet-mapping>



I have defined my rest bean in restBean.xml as below..

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<context:component-scan base-package="com.webex.fin.rest.wo.invoice"/>
<bean id="InvoiceRestBean" class="com.webex.fin.rest.wo.invoice.InvoiceRestBean">
</bean>
</beans>



Can some one please help me in resolving this issue?
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1666
    
    7

Well Spring added rest support in 3.x too bad you are using 2.5.

Anyways it seems that you have malformed XML somewhere. This problem does not appear to be Spring related so I am moving this to a more appropriate forum.

I found the below link which seems similar:

http://objectmix.com/weblogic/574182-getting-unbalanced-element-got-body-expected-h1-errors-help.html


Also please read BeForthrightWhenCrossPostingToOtherSites

You have cross posted at the following places:

https://forums.oracle.com/forums/thread.jspa?messageID=10506366&tstart=0
http://jersey.576304.n2.nabble.com/Spring-jersey-error-Error-at-Line-99-token-CLOSETAGBEGIN-Unbalanced-ELEMENT-got-body-expected-p-td7579900.html

[How To Ask Questions][Read before you PM me]
Verna daniel
Greenhorn

Joined: Aug 09, 2012
Posts: 2
Thanks for the update , Bill.

Just want to add that the rest bean call is happening fine and getting the response with current Spring versions. We get this error only while initializing the SpringServlet and it happens only during the initial call. I don't see this error for the remaining rest calls.

Also, I am unable to find any issue in the XML...I had added the restBean.xml below..

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<context:component-scan base-package="com.webex.fin.rest.wo.invoice"/>
<bean id="InvoiceRestBean" class="com.webex.fin.rest.wo.invoice.InvoiceRestBean">
</bean>
</beans>



Can you please provide the link to the appropriate forum where you have moved this query?

Apologies for not putting the note that I had cross published this query in other forums where I did not get any any response.


Thanks
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1666
    
    7

Can you please provide the link to the appropriate forum where you have moved this query?


The post was moved to the Web Services Forum. You will also find the link if you look at the bread crumbs above. JavaRanch -> Java Forums -> Web Services
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jersey web service exception