Liferay集成WEB应用问题

liuya1985liuya 2010-05-23 06:08:13
liferay版本5.2.3 TOMCAT5.5 JDK1.5 eclipse 3.2
我要将现在的WEB工程直接集成到liferay中。以下是我测试用的示便。
当我在META-INF目录下加入context.xml文件时便会报错。去掉就不会。但在liferay"添加应用"的时候查看不到我刚加入的portlet?
报如下错误
18:04:20,781 INFO [AutoDeployDir:183] Processing SSH2.war
18:04:20,781 INFO [PortletAutoDeployListener:77] Copying portlets for D:\workspace\liferay\services\deploy\SSH2.war
Expanding: D:\workspace\liferay\services\deploy\SSH2.war into D:\workspace\liferay\services\tom\temp\20100523180420781
Copying 1 file to D:\workspace\liferay\services\tom\temp\20100523180420781\WEB-INF\classes
Copying 1 file to D:\workspace\liferay\services\tom\temp\20100523180420781\WEB-INF\classes
Copying 207 files to D:\workspace\liferay\services\tom\webapps\SSH2
Copying 1 file to D:\workspace\liferay\services\tom\webapps\SSH2
Deleting directory D:\workspace\liferay\services\tom\temp\20100523180420781
18:04:34,906 INFO [PortletAutoDeployListener:87] Portlets for D:\workspace\liferay\services\deploy\SSH2.war copied successfully. Deployment will start in a few seconds.
2010-5-23 18:04:36 org.apache.catalina.loader.WebappLoader start
严重: LifecycleException
java.lang.NoClassDefFoundError: org/apache/catalina/loader/WebappClassLoader
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at org.apache.catalina.loader.WebappLoader.createClassLoader(WebappLoader.java:795)
at org.apache.catalina.loader.WebappLoader.start(WebappLoader.java:667)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4108)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1217)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1306)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1570)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1559)
at java.lang.Thread.run(Thread.java:595)
以下是我的配置文件信息:
context.xml文件内容如下
<Context><Loader loaderClass="com.liferay.support.tomcat.loader.PortalClassLoader"/></Context>

liferay-display.xml文件内容如下
<?xml version="1.0"?>
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 5.2.0//EN" "http://www.liferay.com/dtd/liferay-display_5_2_0.dtd">

<display>
<category name="category.sample">
<portlet id="ssh2" />
</category>
</display>

liferay-portlet.xml文件内容如下
<?xml version="1.0"?>
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 5.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_5_2_0.dtd">

<liferay-portlet-app>
<portlet>
<portlet-name>ssh2</portlet-name>
</portlet>

<role-mapper>
<role-name>administrator</role-name>
<role-link>Administrator</role-link>
</role-mapper>
<role-mapper>
<role-name>guest</role-name>
<role-link>Guest</role-link>
</role-mapper>
<role-mapper>
<role-name>power-user</role-name>
<role-link>Power User</role-link>
</role-mapper>
<role-mapper>
<role-name>user</role-name>
<role-link>User</role-link>
</role-mapper>
</liferay-portlet-app>

portlet.xml文件内容如下
<?xml version="1.0"?>

<portlet-app
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
<portlet id="ssh2">
<portlet-name>ssh2</portlet-name>
<display-name>ssh2 test</display-name>
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class>

<!-- The view mode namespace. Maps to a namespace in the Struts 2 config file. -->
<init-param>
<name>viewNamespace</name>
<value>/employee</value>
</init-param>

<!-- The default action to invoke in view mode. -->
<init-param>
<name>defaultViewAction</name>
<value>list_list</value>
</init-param>

<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
</supports>
<!--
<portlet-info>
<title>ssh2 Test</title>
<short-title>ssh2 Test</short-title>
<keywords>struts2,sample</keywords>
</portlet-info>
-->
<!-- resource-bundle>com.liferay.portlet.StrutsResourceBundle</resource-bundle -->
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
<security-role-ref>
<role-name>guest</role-name>
</security-role-ref>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
</portlet-app>

web.xml文件内容如下
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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">

<!-- 指定Spring配置文件,默认WEB根目录寻找配置文件,通过spring提供的classpath;前缀指定从类路径下寻找.
当引入多个时用“,”搁开。 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:SpringBeans.xml</param-value>
</context-param>

<!-- 对Spring容器进行实例化 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- 配置Struts2 filter -->
<!-- filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping >
-->
<!-- 将WEB集成进liferay -->
<servlet>
<servlet-name>ssh2</servlet-name>
<servlet-class>com.liferay.portal.kernel.servlet.PortletServlet</servlet-class>
<!-- <servlet-class>com.liferay.util.bridges.struts.LiferayPortletServlet</servlet-class> -->
<init-param>
<param-name>config</param-name>
<param-value>/WEB_INF/classes/struts.xml</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>ssh2</servlet-name>
<url-pattern>/ssh2/*</url-pattern>
</servlet-mapping>
</web-app>
...全文
372 点赞 收藏 5
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
liferay_portal 2011-09-28
北京Liferay项目业务中心,主要承接Liferay项目二次开发、系统集成整合及门户行业解决方案,打造智能化企业,欢迎有识之士合作共赢。
联系人:
李经理
电话:18810559649
QQ: 1417153858
邮箱:bin.lee@aukcell.com
回复
oU_like 2010-08-11
在对liferary学习中,能不能也发些相应的实例讲解。.

邮箱:916930385@qq.com
回复
zhaowl1980 2010-07-05
  
遨豪(大连)科技有限公司自2007年与美国Liferay,Inc合作,并帮助其建立 Liferay中国分公司及支持中心,同时也是中国目前第一家唯一合作伙伴,主要负责Liferay产品的本地化服务,包括本地化培训和Liferay企业版服务,研发中心位于大连市高新技术产业园区。

Liferay中国本地化业务咨询及相关服务,在线请联系:QQ:1492270185 http://www.aukcell.com/web/guest/founding
回复
xuewuhelen 2010-06-22
你好 我想问一下你这个问题解决了吗 我最近也在用Liferay 网上也查了一些资料 但还是迷糊中 能不能发我一个例子呀 不胜感激 谢谢 我的邮箱是linlunnian@software.ict.ac.cn
回复
liuya1985liuya 2010-05-23
问题补充:
我的程序是可以运行的,只有在集入liferay的时候报错。portal portlet的包我已经引入这如下这些:
portal-impl.jar
portal-kernel.jar
portal-service.jar
portals-bridges.jar
portlet-api-2.0.jar
portlet-container.jar
portletbridge-core.jar
portletbridge-portlet.jar
struts2-portlet-plugin-2.1.8.1.jar
tiles-api-2.0.6.jar
tiles-core-2.0.6.jar
tiles-jsp-2.0.6.jar
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2010-05-23 06:08
社区公告
暂无公告