0

我名为 LiferayProject A的项目依赖于 CVS 存储库中名为的另一个项目Project B

ClassNotFoundException每次我在Project BCVS 项目中使用类时都会得到这个。我不明白为什么,我也将它包含Project B在我的项目的构建路径中,但不起作用。

请帮助我,如何使用存储库中项目中的类?这是抛出Stack Traceexception

05:28:44,714 ERROR [jsp:154] java.lang.ClassNotFoundException: com.fluxion.profileservice.DAOImpl.EnrolledCustomerDAOImpl
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
    at com.fluxion.myaccounts.service.EnrolledCustomerService.getCustomerIDList(EnrolledCustomerService.java:10)
    at com.fluxion.myaccounts.portlet.OrderTaggingPortlet.doView(OrderTaggingPortlet.java:43)
    at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:328)
    at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
    at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:101)
    at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
    at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:92)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)
    at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:638)
    at com.liferay.portlet.InvokerPortletImpl.invokeRender(InvokerPortletImpl.java:723)
    at com.liferay.portlet.InvokerPortletImpl.render(InvokerPortletImpl.java:425)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

05:28:49,669 ERROR [jsp:154] java.lang.NoClassDefFoundError: com/fluxion/profileservice/DAOImpl/EnrolledCustomerDAOImpl
    at com.fluxion.myaccounts.service.EnrolledCustomerService.getCustomerIDList(EnrolledCustomerService.java:10)
    at com.fluxion.myaccounts.portlet.OrderTaggingPortlet.doView(OrderTaggingPortlet.java:43)
    at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:328)
    at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
    at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:101)
    at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
    at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:92)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)
    at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:638)
    at com.liferay.portlet.InvokerPortletImpl.invokeRender(InvokerPortletImpl.java:723)
    at com.liferay.portlet.InvokerPortletImpl.render(InvokerPortletImpl.java:425)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)

Loading file:/C:/liferay-portal-tomcat-6.0.6-20110225/liferay-portal-6.0.6/tomcat-6.0.29/webapps/chat-portlet/WEB-INF/classes/portlet.properties
05:28:49,777 INFO  [PluginPackageUtil:1230] Checking for available updates
05:28:49,780 INFO  [PluginPackageUtil:1274] Finished checking for available updates in 2 ms
05:32:02,296 ERROR [jsp:154] java.lang.NoClassDefFoundError: com/fluxion/profileservice/DAOImpl/EnrolledCustomerDAOImpl
    at com.fluxion.myaccounts.service.EnrolledCustomerService.getCustomerIDList(EnrolledCustomerService.java:10)
    at com.fluxion.myaccounts.portlet.OrderTaggingPortlet.doView(OrderTaggingPortlet.java:43)
    at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:328)
    at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
    at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:101)
    at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
    at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:92)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)
    at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:638)
    at com.liferay.portlet.InvokerPortletImpl.invokeRender(InvokerPortletImpl.java:723)
    at com.liferay.portlet.InvokerPortletImpl.render(InvokerPortletImpl.java:425)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
4

1 回答 1

0

问题是项目 B 中的类在编译期间可访问,但在运行时不可访问。要使其正常工作,您有几种方法:

  1. Simpy:将两个项目合并为一个项目。这是最简单的方法,您将多个 portlet 和钩子放在一个项目中。一个类加载器将加载所有类。

  2. 如果您需要共享类,这将由多个项目加载 - 创建一个仅包含 java 类的项目(没有门户配置,如 portlet.xml 等)。将此共享项目导出为 jar 文件并将 jar 文件放入文件夹中的其他项目(如您的项目 A)中docroot/WEB-INF/lib。如果共享类具有共享状态,则将 jar 文件唯一地放入 tomcat 共享文件夹中,例如tomcat/lib/ext/

于 2012-08-13T07:27:00.080 回答