Laliwala IT Services

Laliwala IT Services
Website Development

Thursday, February 24, 2011

Unable to upload with liferay, apache, liferay installe, java, jsp, java class, instructions, server, tomcat, action, upload portlet, servlet, liferay

giuseppe rossi :


Hello, I create a portlet, which simply took a file from the client, it loads on the server (where liferay, the latest version with tomcat, is installed) and saves it in a specific path. I used "apache commons upload" but it seems not to work, even though I followed the step by step the instructions (the JSP / HTML part and the Java class), but when I go to upload, it doesn't save the file on disk.








Any suggestions?








Thanks






Mazhar Anwar : You can easily upload a file on server.





Please make sure you have set form encType to 'multipart/form-data' in your jsp.








And then you can use "UploadPortletRequest" as in portal source "com.liferay.portlet.documentlibrary.action.EditFileEntryAction.java" for uploading the file on server.








No need to use apache commons uploads.








HTH.








Regards,

Mazhar






giuseppe rossi : Thanks for your answer. First I have already set encType. Then, do you mean this class?? http://docs.huihoo.com/javadoc/liferay/4.2/util-java/com/liferay/util/servlet/UploadPortletRequest.html








Because I can't understand how can I use that in a java class!






Mazhar Anwar : hmm, please find the sample code. You can pass ActionRequest/ResourceRequest/RenderRequest objects to the method.








liferay upload tutorial, liferay apache tutorial, liferay tomcat tutorial, liferay installation tutorial








PARAMETER_FILENAME is the name of your input tag for fileUplaod in jsp.






Mazhar Anwar : Package path for UploadPortletRequest is com.liferay.portal.kernel.upload.UploadPortletRequest emoticon






giuseppe rossi : it works...thanks ;)

installe theme, liferay recommend, glassfish solution, theme solution, solaris, cluster, deploy clustering, liferay clustering, deploy lr, liferay ver

Al-Mothafar Al-Hasan : Hi





I have this strange problem , its work and get XML and contents ,





liferay theme installe tutorial, liferay glassfish tutorial, glassfish solution, glassfish tutorial





BUT slow liferay down , and log file filled with megabytes with these lines





in glassfish server log :





alfresco tutorial, theme integration tutorial, theme developer tutorial, liferay theme developer tutorial, tutorial theme liferay








in NetBeans console (with tomcat 6.0) :





glassfish tutorial, liferay training tutorial, liferay book tutorial, liferay development tutorial








What the problem , Its work BUT with bad performance ...





And i have a another 5 structures called as the same as previous with EVENTS_STRUCTURE !





Please i want to solve it ASAP...





Note: My liferay 5.2.3 emoticon






Al-Mothafar Al-Hasan : Is there something not clear in my post?






Mazhar Anwar : Hi Mothafar,





Are you getting xml?








Are you getting xml?





Please let me know what's your requirement by reading content as xml in theme? I think you will again need to parse the xml in theme which is obviously going to create performace issues.








Wassalam,

Mazhar






Al-Mothafar Al-Hasan : Yes , I getting XML and 3 records , and I can call it from theme and show content , everything work , BUT this warning logged!





Just i want what is invalid ?








i tried this "http://localhost:9090/c/journal/get_articles?&structureId=EVENTS_STRUCTURE" lonely and I got XML and this warn logged again !!!!!








is there parameter missed or what ???






Mazhar Anwar : URL and Parameters are right only, m exactly not sure for the Warning...emoticonemoticon






Al-Mothafar Al-Hasan :


Really I don't know what the problem , every parameter works well , and effective if values changed , and I getting XML and so I can get the content , what the problem !!, I don't know, I'm Installed the theme it on different liferays & PCs with 3 tomcat 6 and 1 glassfish 2.0 , the warning logged and logged , I think I can disable log this from log levels in the control panel , but I'm not recommend that & I must found the solution of this problem !






Younis Alomoush : Dear Mazhar,





I am calling saxReaderUtil from within the theme. and I noticed that when I refresh the page many times the server hang and it needs restart. does it related to calling the saxReaderUtil from within the theme?








btw, I am using LR 5.2.3 with Glassfih 2.1.1 under Solaris 10.






Minhchau Dang : Replace ?& with ?






Al-Mothafar Al-Hasan : WOOOOOOOOOOOOOOOOW emoticon





What this mistake error that I made. emoticon





I feel I am an idiot emoticon








My team leader will kill me emoticon LOOOOOOOL





Thank you very much emoticon











Just I have a question , about problem , is this problem may cause any problem with glassfish v2.1 (last version) , I mean, I have a hangs in glassfish instances (when I deploy LR standalone) or in cluster instances (with clustering of LR) this happened when I hold my finger on F5 button for a few seconds. I test to remove this code and I then holding F5 again but hang did not happen, I traced the problem and I found this line that made this warning cause a hang...

Setting up Extention environement, dynamic servlet config, location, phpportlet, tomcat server, app.server, tomcat liferay, java liferay tomacat, dir

Sanghamitra Mitra : Hi ,








While setting up the ext environment for development








as per the instruction @ http://www.liferay.com/community/wiki/-/wiki/Main/Development+Environment+%28Windows%29








I got the following error while deploying








E:\SM\liferay\portal\build.xml:331: The following error occurred while executing

this line:








E:\SM\liferay\portal\build-common-java.xml:100: Failed to copy E:\SM\liferay\por

tal\portal-kernel\portal-kernel.jar to E:\SM\liferay\portal\SMliferay omcat\co

mmon\lib\ext\portal-kernel.jar due to failed to create the parent directory for

E:\SM\liferay\portal\SMliferay omcat\common\lib\ext\portal-kernel.jar








The directory to





E:\SM\liferay\portal\SMliferay omcat\common\lib\ext\ does not exist on my machine.








I believe I have missed to set the right directory in some of the property file , but not able to find out where (which file )to recify the same.








Can any body help me.








Sharing the following for reference.





1. Snapshot of my directory structure


2. release.mitrasag.properties (which lies in the portal directory )


3. app.server.mitrasag.properties ( which lies in the ext directory )








Thanks in advance.

Sanghamitra






Attachments:






Mazhar Anwar : Hi, you have to point to parent directory of your tomcat server, not java, "app.server.parent.dir=E:/SM/liferay"








Please find the attached properties file as per your image.









Attachments:






Sanghamitra Mitra : Hi





Many thanks .. I could solve the problem with your input.








But now getting the following error :





[javac] E:\SM\liferay\portal\util-





bridges\src\com\liferay\util\bridges\wai\WAIPortlet.java:30: cannot find





symbol


[javac] symbol : class HttpUtil





[javac] location: package com.liferay.util





[javac] import com.liferay.util.HttpUtil;

[javac] ^





[javac] E:\SM\liferay\portal\util-





bridges\src\com\liferay\util\bridges\php\PHPPortlet.java:141: cannot find





symbol





[javac] symbol : class DynamicServletConfig





[javac] location: class com.liferay.util.bridges.php.PHPPortlet





[javac] config = new DynamicServletConfig





(config, params);





[javac] ^





[javac] E:\SM\liferay\portal\util-





bridges\src\com\liferay\util\bridges\wai\WAIPortlet.java:134: cannot find





symbol





[javac] symbol : variable HttpUtil





[javac] location: class com.liferay.util.bridges.wai.WAIPortlet





[javac] String queryString = HttpUtil.parameterMapToString





(params, false);





[javac] ^





[javac] Note: Some input files use or override a deprecated API.





[javac] Note: Recompile with -Xlint:deprecation for details.





[javac] Note: Some input files use unchecked or unsafe operations.





[javac] Note: Recompile with -Xlint:unchecked for details.





[javac] 4 errors








What am I missing..








Thanks & Regards.

Sanghamitra






Gaurang Sheladia : Hi Sanghamitra,








Seems like error is missing jar file so you need to add some jar file on your build path.








Thanks,

Gaurang Sheladia






Sanghamitra Mitra : Hi,





Can any body let me know exactly which jar file(s) is required.








Thanks

Sanghamitra






Sandeep Nair : HttpUtil is in portal-kernal.jar and DynamicServletConfig is in util-java.jar








Regards,

San-D

Struts ActionForms with MultiPart forms, liferay libraty, liferay settings, liferay entry, action.java, com.liferay, portlet.document, strutslifera y

Struts ActionForms with MultiPart forms


Jim Klo : Wondering if anyone has any clues what might be going on - while this isn't the first time I've seen this behavior, this is the first time I don't have a workaround...








I need to add some form fields to files within the Document Library that gets stored in the DLFileEntry.getExtraSettingsProperties(). I noticed while looking at the 5.2.3 source there is a file:








/portal-web/docroot/html/portlet/document_library/edit_file_entry_form_extra_fields.jsp








within there is the following:








liferay struts tutorial, liferay forms tutorial, liferay library tutorial, struts action tutorial, liferay administrator tutorial








which looks great, I can just add my extra fields by using the Struts ActionForm notation...








When I look at the Action in com.liferay.portlet.documentlibrary.action.EditFileEntryAction.java of which this Form should post and part of the Struts lifecycle, the form should populate.








However the form never populates, there's obviously a form instance, but the form never gets the values populated. Now technically, but struts definition the property name should start with a lowercase letter on the <input name="extraSettingsProperties(test)" ... />, however I've tried this both ways with no success.








Are Struts forms just inherently broken in Liferay? I've gone down this rat hole before when trying to build my own portlets previously and noticed that the form beans don't work, and had to use the ParamUtils to get the form values.








Does anyone know how to resolve or fix this - it seems no one is either using ActionForms or no one has noticed this problem...








Please someone help!






Jim Klo : Update: After actually stepping through Struts source.... I've determined... It looks like Liferay is broke... or at least not interfacing with Struts 100% correctly.








It turns out that Struts Form Beans work only work for non-multipart forms within Liferay Portlets. The Document Library edit form - is a multi-part form, which would explain why this isn't working.








From what I can tell, it looks like in order to fix this, a custom MultipartRequestHandler needs to be written such that the parameters and file objects get parsed correctly. Then this handler needs to injected at the right time, which I'm not totally sure what conditions need to be met to do this (otherwise, I'd just fix it)






Mazhar Anwar : Hi Jim,








Liferay has taken care for multipart encrypted form by com.liferay.portal.kernel.upload.UploadPortletRequest Interface.

liferay tutorial india, liferay web tutorial








You can use it as follows,








liferay support, liferay website tutorial








Hope this will solve your problem.








Regards,

Mazhar






Jim Klo : Sure... you're missing the point... I know I can do that (and probably will end up having to do that by rewriting the Document Library action so they work)... the problem is there are several touch points in the portal source already that assume that Struts MVC works for multipart forms - when it clearly doesn't.








What I'm proposing is the actual FIX so Struts MVC works as it's supposed to - not by using a workaround method that uses a getter utility.








Part of the beauty of Struts MVC, is that you can have a form bean POJO that get's populated during the request, so when you're in your Action classes execute, you don't have to fetch each of the parameters individually which is what you're solution proposes. (oddly this all works in liferay using the Sample Struts Portlet - assuming because this uses the Struts Bridge, however the Sample Struts Liferay Portlet doesn't even instantiate right for some reason)






Nagendra Kumar Busam
Hi Jim,








Is there any simple way to make it work. BTW, i am using LR 5.2.3








I have a requirement for which i need to add custom attribute like status which will have publish/pending as values.








Any inputs are much welcome








Thanks & Regards,

- Nagendra Kumar






Jim Klo : Yes I got this working, rather trivially.








Extend EditFileEntryAction and Update the Struts Mapping to use your new class.





Override updateFileEntry(...) by copying from the original then change this:
















to this:













Follow the pattern defined in edit_file_entry_form_extra_fields.jsp for adding your extra fields.





Compile and deploy.






Nagendra Kumar Busam : Thank you Jim, i will give it a try & update later about the status

Extending Calendar, Hot Deployable, liferay functionalities, liferay calendar portlet, liferay us

Liferay Extending Calendar


Joao Sequeira : Hello,





I need to add new functionalities to the calendar portlet (for example invite other users to an event where they can then accept/decline), but another requirement is that this must be hot-deployable which I believe takes the ext environment out of the equation.








Is there any war file (or extracted calendar portlet) which would do as a starting point? Or is there any way to use the ext environment in an hot-deployable way?








I have looked into using Hooks plugins but there i can only change the JSP and do some pre/post actions, thus not allowing me to change the underlying model.








Best Regards,

Joao Sequeira






Mazhar Anwar : Hi,








I think this link may help you in developing hot deployable patch for your requirement.








http://www.liferay.com/web/amos.fong/blog/-/blogs/minimizing-the-ext-environment








You can refer to Jonas's Blog regarding development of portlets in ext using plugins sdk that's the main feature Liferay is introducing in Version 6.








Regards,

Mazhar