2013-09-25 33 views
0

hai iam新增json Web服務liferay中出現以下錯誤!我已經在web.xml中添加了JSONWebServiceServlet。我必須將任何jar文件添加到類路徑嗎?Liferay中的java.lang.ClassNotFoundException:com.liferay.portal.jsonwebservice.JSONWebServiceServlet?

05:51:36,250 ERROR [PortalClassLoaderServlet:76] java.lang.ClassNotFoundException: com.liferay.portal.jsonwebservice.JSONWebServiceServlet 
java.lang.ClassNotFoundException: com.liferay.portal.jsonwebservice.JSONWebServiceServlet 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645) 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491) 
    at com.liferay.portal.kernel.servlet.PortalClassLoaderServlet.portalInit(PortalClassLoaderServlet.java:70) 
    at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:52) 
    at com.liferay.portal.kernel.servlet.PortalClassLoaderServlet.init(PortalClassLoaderServlet.java:44) 
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173) 
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993) 
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4350) 
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4659) 
    at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1244) 
    at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1342) 
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303) 
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) 
    at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337) 
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601) 
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610) 
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590) 
    at java.lang.Thread.run(Unknown Source) 

在web.xml中我已經這樣寫的:

<?xml version="1.0" encoding="UTF-8"?> 
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> 
    <display-name>pdfportlet-portlet</display-name> 

    <jsp-config> 
     <taglib> 
      <taglib-uri>http://java.sun.com/portlet_2_0</taglib-uri> 
      <taglib-location>/WEB-INF/tld/liferay-portlet.tld</taglib-location> 
     </taglib> 
    </jsp-config> 
    <servlet> 
      <servlet-name>JSON Web Service Servlet</servlet-name> 
      <servlet-class>com.liferay.portal.kernel.servlet.PortalClassLoaderServlet</servlet-class> 
      <init-param> 
       <param-name>servlet-class</param-name> 
       <param-value>com.liferay.portal.jsonwebservice.JSONWebServiceServlet</param-value> 
      </init-param> 
      <load-on-startup>0</load-on-startup> 
     </servlet> 
     <servlet-mapping> 
      <servlet-name>JSON Web Service Servlet</servlet-name> 
      <url-pattern>/api/jsonws/*</url-pattern> 
     </servlet-mapping> 
     <servlet-mapping> 
      <servlet-name>JSON Web Service Servlet</servlet-name> 
      <url-pattern>/api/secure/jsonws/*</url-pattern> 
     </servlet-mapping> 

</web-app> 
+0

我有同樣的問題,當我加在web.xml中相關代碼的JSON Web服務。之後,我得到了同樣的錯誤...如果你找到任何解決方案,然後請張貼它 –

回答

0
configure the servlet like this: some sysntax error i think. its working fine now. 
    <?xml version="1.0" encoding="UTF-8"?> 
    <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> 
    <display-name>student-portlet</display-name> 
    <servlet> 
    <servlet-name>JSON Web Service Servlet</servlet-name> 
    <servlet-class> 
    com.liferay.portal.kernel.servlet.PortalClassLoaderServlet 
    </servlet-class> 
    <init-param> 
    <param-name>servlet-class</param-name> 
    <param-value>com.liferay.portal.servlet.JSONServlet</param-value> 
    </init-param> 
    <load-on-startup>0</load-on-startup> 
    </servlet> 
    <servlet-mapping> 
    <servlet-name>JSON Web Service Servlet</servlet-name> 
    <url-pattern>/api/jsonws/*</url-pattern> 
    </servlet-mapping> 
    <servlet-mapping> 
    <servlet-name>JSON Web Service Servlet</servlet-name> 
    <url-pattern>/api/secure/jsonws/*</url-pattern> 
    </servlet-mapping> 
     <jsp-config> 
     <taglib> 
      <taglib-uri>http://java.sun.com/portlet_2_0</taglib-uri> 
      <taglib-location>/WEB-INF/tld/liferay-portlet.tld</taglib-location> 
     </taglib> 
     </jsp-config> 
    </web-app> 
+0

不解決這個解決方案 –