Forums

Home » Liferay Portal » English » 2. Using Liferay » General

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
error while calling method to insert data in custom portlet Bhavik Kama October 7, 2012 11:49 PM
RE: error while calling method to insert data in custom portlet Vishal Panchal October 8, 2012 12:16 AM
RE: error while calling method to insert data in custom portlet Bhavik Kama October 8, 2012 12:57 AM
RE: error while calling method to insert data in custom portlet Seeya S Kudtarker February 5, 2013 7:33 PM
RE: error while calling method to insert data in custom portlet Bhavik Kama February 5, 2013 8:54 PM
RE: error while calling method to insert data in custom portlet Seeya S Kudtarker February 6, 2013 7:06 AM
RE: error while calling method to insert data in custom portlet Seeya S Kudtarker February 7, 2013 1:41 AM
RE: error while calling method to insert data in custom portlet Bhavik Kama February 7, 2013 2:31 AM
RE: error while calling method to insert data in custom portlet Seeya S Kudtarker February 8, 2013 12:48 AM
RE: error while calling method to insert data in custom portlet Bhavik Kama February 8, 2013 3:42 AM
RE: error while calling method to insert data in custom portlet Seeya S Kudtarker February 10, 2013 9:34 PM
RE: error while calling method to insert data in custom portlet Bhavik Kama February 10, 2013 11:19 PM
RE: error while calling method to insert data in custom portlet Seeya S Kudtarker February 10, 2013 11:23 PM
RE: error while calling method to insert data in custom portlet Bhavik Kama February 11, 2013 12:59 AM
RE: error while calling method to insert data in custom portlet Seeya S Kudtarker February 11, 2013 1:01 AM
RE: error while calling method to insert data in custom portlet Seeya S Kudtarker February 11, 2013 1:03 AM
RE: error while calling method to insert data in custom portlet Bhavik Kama February 11, 2013 1:22 AM
RE: error while calling method to insert data in custom portlet Seeya S Kudtarker February 11, 2013 1:36 AM
RE: error while calling method to insert data in custom portlet Hitoshi Ozawa February 5, 2013 8:14 PM
Bhavik Kama
error while calling method to insert data in custom portlet
October 7, 2012 11:49 PM
Answer

Bhavik Kama

Rank: Junior Member

Posts: 55

Join Date: September 23, 2012

Recent Posts

Hi, I am using my custom portlet to add some data with the adAdvertise method of localserviceimpl and in my portlet class i have define addAdvertise.

i get following error while calling this addadvertise method

06:39:47,761 ERROR [http-bio-8080-exec-92][render_portlet_jsp:154] java.lang.NullPointerException
at com.advertise.database.service.impl.advertiseLocalServiceImpl.adAdvertise(advertiseLocalServiceImpl.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:122)
at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:71)
at com.liferay.portal.dao.jdbc.aop.DynamicDataSourceTransactionInterceptor.invoke(DynamicDataSourceTransactionInterceptor.java:44)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.security.pacl.PACLAdvice.invoke(PACLAdvice.java:51)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:211)
at com.advertise.database.service.advertiseLocalServiceUtil.adAdvertise(advertiseLocalServiceUtil.java:278)
at com.advertise.portlet.AdvertisePortlet.addAdvertise(AdvertisePortlet.java:36)

What is this error s about??i cant find out..please anyone can guide me?
Vishal Panchal
RE: error while calling method to insert data in custom portlet
October 8, 2012 12:16 AM
Answer

Vishal Panchal

Rank: Expert

Posts: 277

Join Date: May 20, 2012

Recent Posts

Bhavik Kama:
Hi, I am using my custom portlet to add some data with the adAdvertise method of localserviceimpl and in my portlet class i have define addAdvertise.

i get following error while calling this addadvertise method

06:39:47,761 ERROR [http-bio-8080-exec-92][render_portlet_jsp:154] java.lang.NullPointerException
at com.advertise.database.service.impl.advertiseLocalServiceImpl.adAdvertise(advertiseLocalServiceImpl.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:122)
at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:71)
at com.liferay.portal.dao.jdbc.aop.DynamicDataSourceTransactionInterceptor.invoke(DynamicDataSourceTransactionInterceptor.java:44)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.security.pacl.PACLAdvice.invoke(PACLAdvice.java:51)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:211)
at com.advertise.database.service.advertiseLocalServiceUtil.adAdvertise(advertiseLocalServiceUtil.java:278)
at com.advertise.portlet.AdvertisePortlet.addAdvertise(AdvertisePortlet.java:36)

What is this error s about??i cant find out..please anyone can guide me?



Hi Bhavik Kama,

we should not call the methods directly using localserviceimpl class, instead We should call them using LocalServiceUtil class.
So try the same using AdvertiseLocalServiceUtil.addAdvertise();

Thanks &Regards,
Vishal R. Panchal
Bhavik Kama
RE: error while calling method to insert data in custom portlet
October 8, 2012 12:57 AM
Answer

Bhavik Kama

Rank: Junior Member

Posts: 55

Join Date: September 23, 2012

Recent Posts

ya.i had done that same ..let me give u three class information
this is my advertiseLocalServiceUtil Class
public static com.advertise.database.model.advertise addadvertise(
com.advertise.database.model.advertise advertise)
throws com.liferay.portal.kernel.exception.SystemException {
return getService().addadvertise(advertise);
}


this is my LocalServiceImpl class

public advertise adAdvertise(advertise adsParam) {
advertise adVar;

try {
adVar =advertisePersistence.create(counterLocalService
.increment(advertise.class.toString()));
} catch (SystemException e) {
e.printStackTrace();
return adVar = null;
}

try {
resourceLocalService.addResources(adsParam.getCompanyId(),
adsParam.getGroupId(), adsParam.getUserId(),
advertise.class.getName(), adsParam.getPrimaryKey(),false,
true, true);
} catch (PortalException e) {
e.printStackTrace();
return adVar = null;
} catch (SystemException e) {
e.printStackTrace();
return adVar = null;
}

adVar.setTitle(adsParam.getTitle());
adVar.setCompanyId(adsParam.getCompanyId());
adVar.setTypeId(adsParam.getTypeId());

adVar.setGroupId(adsParam.getGroupId());
adVar.setDescription(adsParam.getDescription());
adVar.setUserId(adsParam.getUserId());

try {
return advertisePersistence.update(adVar, false);
} catch (SystemException e) {
e.printStackTrace();
return adVar = null;
}
}
This is my Portlet class
public void addAdvertise(ActionRequest request, ActionResponse response)
{
log.info("Ad portlet addAdvertise calling");
List<String> errors=new ArrayList<String>();
advertise ad=AdvertiseActionUtil.getAdvertiseFromRequest(request);

//boolean adValid=AdvertiseValidator.validateAdvertise(ad, errors);
//if(adValid) {
log.info(ad);
advertise adtest=advertiseLocalServiceUtil.adAdvertise(ad);
if(adtest==null) {
log.error("Ad was Found Null");
response.setRenderParameter("jspPage", errorJSP);
return ;
}
SessionMessages.add(request,"ad-added");
return ;
//}
//else {
// for (String error : errors) {
// SessionErrors.add(request, error);
// }
// SessionErrors.add(request, "error-while-adding");
// request.setAttribute("ad",ad);
// return ;
}


And in my view file i am calling this function as follows

<%@ include file="/init.jsp"%>
<%
advertise ad = (advertise) request.getAttribute("advertise");
if (ad == null) {
ad = new advertiseImpl();

ad.setAdvertiserId(1);

}
%>
<liferay-portlet:actionURL name="addAdvertise" var="addAdvertiseURL"></liferay-portlet:actionURL>
<liferay-ui:success key="ad-added" message="ad-added" />


<aui:form action="<%=addAdvertiseURL.toString() %>" method="post" name="fm">

<aui:fieldset>

<p>
<aui:input name="title" label="Title" type="text"
value="<%=ad.getTitle() %>"></aui:input>
</p>

<p>
<aui:input name="description" label="Description" type="text"
value="<%=ad.getDescription() %>"></aui:input>
</p>


<p>
<aui:input name="typeId" label="TypeId" type="text"
value="<%=String.valueOf(ad.getTypeId()) %>"></aui:input>
</p>
<p>
<aui:input type="file" name="UploadAdvertise" size="25"/>
<p>


<select name="ADvertise TYPE">
<option value="">-------Select-----</option>
<%
List<type> list=typeLocalServiceUtil.getAlltype();
for(type item:list){
%>



<option value="<%=item.getType_name()%>"></option>
<%
}

%>
</select>






<aui:button-row>
<p>
<aui:button class="aui-button-input" type="submit" value="Submit" />
<aui:button class="aui-button-input" type="reset" value="Reset" />
</p>
</aui:button-row>


</aui:fieldset>
</aui:form>

Please Tell me Where am doing mistake
Seeya S Kudtarker
RE: error while calling method to insert data in custom portlet
February 5, 2013 7:33 PM
Answer

Seeya S Kudtarker

Rank: Regular Member

Posts: 187

Join Date: January 15, 2013

Recent Posts

Hi Bhavik Kama,
I am having the same problem. I am new to liferay here.

Here is my post...
Would you help me?

I do not know how to implement CRUDFromRequest(ActionRequest request) in the forum which I have mentioned..
Hitoshi Ozawa
RE: error while calling method to insert data in custom portlet
February 5, 2013 8:14 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7990

Join Date: March 23, 2010

Recent Posts

ad = new advertiseImpl();

ad.setAdvertiserId(1);


Liferay is using factory pattern (if you've read Gamma pattern book).
So, you don't do new, do ad = AdvertiseLocalServiceImpl.add(1);

You're suppose to add "add" method the the AdvertiseLocalServiceImpl class generated by the Service Builder.

If you don't know what I'm talking about, go through the following tutorial:
http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/service-build-5
Bhavik Kama
RE: error while calling method to insert data in custom portlet
February 5, 2013 8:54 PM
Answer

Bhavik Kama

Rank: Junior Member

Posts: 55

Join Date: September 23, 2012

Recent Posts

Seeya S Kudtarker:
Hi Bhavik Kama,
I am having the same problem. I am new to liferay here.

Here is my post...
Would you help me?

I do not know how to implement CRUDFromRequest(ActionRequest request) in the forum which I have mentioned..


I have Solved My Problem With The implementation suggested in this link..please Visit This Link it is very easy and in simple language...please give me feedback if u solved Ur problem from this link..thanx
http://liferay-by-akaram4u.blogspot.in/2012/05/service-builder-with-crud-operation-in.html

If you stil Dont Find solution then let me know
Seeya S Kudtarker
RE: error while calling method to insert data in custom portlet
February 6, 2013 7:06 AM
Answer

Seeya S Kudtarker

Rank: Regular Member

Posts: 187

Join Date: January 15, 2013

Recent Posts

Bhavik Kama:
Seeya S Kudtarker:
Hi Bhavik Kama,
I am having the same problem. I am new to liferay here.

Here is my post...
Would you help me?

I do not know how to implement CRUDFromRequest(ActionRequest request) in the forum which I have mentioned..


I have Solved My Problem With The implementation suggested in this link..please Visit This Link it is very easy and in simple language...please give me feedback if u solved Ur problem from this link..thanx
http://liferay-by-akaram4u.blogspot.in/2012/05/service-builder-with-crud-operation-in.html

If you stil Dont Find solution then let me know


Hi Bhavik Kama,
Thanks for the link. Yes it helped me in adding the data to the database. I am having a little difficulty here in update and delete. I am trying it out and let you know if I get any difficulty. I will post my difficulties regarding them here in your forum..
thanks again for the link emoticon
Seeya S Kudtarker
RE: error while calling method to insert data in custom portlet
February 7, 2013 1:41 AM
Answer

Seeya S Kudtarker

Rank: Regular Member

Posts: 187

Join Date: January 15, 2013

Recent Posts

Hi Bhavik Kama,

Thanks a lot for the link :
http://liferay-by-akaram4u.blogspot.in/2012/05/service-builder-with-crud-operation-in.html

It helped me a lot. The update and delete which wasn't working works now.

Thanks again!! All the CRUD operations are implemented properly. For retrieval of data I had to make modifications for which I got help in another forum.

Rest all operations mentioned in the link were simple and easy to understand. emoticon

Thanks!

Regards

Seeya
Bhavik Kama
RE: error while calling method to insert data in custom portlet
February 7, 2013 2:31 AM
Answer

Bhavik Kama

Rank: Junior Member

Posts: 55

Join Date: September 23, 2012

Recent Posts

Seeya S Kudtarker:
Hi Bhavik Kama,

Thanks a lot for the link :
http://liferay-by-akaram4u.blogspot.in/2012/05/service-builder-with-crud-operation-in.html

It helped me a lot. The update and delete which wasn't working works now.

Thanks again!! All the CRUD operations are implemented properly. For retrieval of data I had to make modifications for which I got help in another forum.

Rest all operations mentioned in the link were simple and easy to understand. emoticon

Thanks!

Regards

Seeya

...
Hmmm...i was having lots of problem to understand the structure of liferay for CRUD operation before visiting this link but after this link its all look like easy..anyways...your welcome...enjoy coding.i have send frend request to u ..pls accept it if u can on fb as well as here..
Seeya S Kudtarker
RE: error while calling method to insert data in custom portlet
February 8, 2013 12:48 AM
Answer

Seeya S Kudtarker

Rank: Regular Member

Posts: 187

Join Date: January 15, 2013

Recent Posts

Thanks Bhavik.. I cannot see your friend request here in Liferay.. emoticon Anyway I will send you. You cancel it I will send you the request.

Btw I am having another problem here.
I am trying to define two entities n service.xml but only one table gets created in the database. Only the first entity gets created as table..
Bhavik Kama
RE: error while calling method to insert data in custom portlet
February 8, 2013 3:42 AM
Answer

Bhavik Kama

Rank: Junior Member

Posts: 55

Join Date: September 23, 2012

Recent Posts

Seeya S Kudtarker:
Thanks Bhavik.. I cannot see your friend request here in Liferay.. emoticon Anyway I will send you. You cancel it I will send you the request.

Btw I am having another problem here.
I am trying to define two entities n service.xml but only one table gets created in the database. Only the first entity gets created as table..


there should be two reason i guess..
1)..
u have any error in service.xml?
and if there is no error in service.xml and if u can successfully build the service the try following
2)....
if u created one entity and then builded the service and deploy the portlet then if u changing anythng in Service.xml then u should remove the portelt from server ..rebuild the service and then again deploy the portlet..try this...and let me know
Seeya S Kudtarker
RE: error while calling method to insert data in custom portlet
February 10, 2013 9:34 PM
Answer

Seeya S Kudtarker

Rank: Regular Member

Posts: 187

Join Date: January 15, 2013

Recent Posts

Hey Bhavik,

I got my problem solved. I created a new project and typed the entire xml file again and it worked.
The entities got created.
But now I am having another problem. I am having mapping-key in one of the tables. The tables get created but they don't show the mapping-key column in the DDL definition.
What could be the problem?
Bhavik Kama
RE: error while calling method to insert data in custom portlet
February 10, 2013 11:19 PM
Answer

Bhavik Kama

Rank: Junior Member

Posts: 55

Join Date: September 23, 2012

Recent Posts

Seeya S Kudtarker:
Hey Bhavik,

I got my problem solved. I created a new project and typed the entire xml file again and it worked.
The entities got created.
But now I am having another problem. I am having mapping-key in one of the tables. The tables get created but they don't show the mapping-key column in the DDL definition.
What could be the problem?


I am Not aware of this scenario as i never implemented this mapping key concept in liferay....but if this link can help u...http://liferaydemystified.blogspot.jp/2011/08/table-relationships.html
Seeya S Kudtarker
RE: error while calling method to insert data in custom portlet
February 10, 2013 11:23 PM
Answer

Seeya S Kudtarker

Rank: Regular Member

Posts: 187

Join Date: January 15, 2013

Recent Posts

Thanks Bhavik.. Will check n let you know.. emoticon Will figure out what happens and share it here.

btw could you help me with this link?

http://www.liferay.com/community/forums/-/message_boards/message/21395092
Bhavik Kama
RE: error while calling method to insert data in custom portlet
February 11, 2013 12:59 AM
Answer

Bhavik Kama

Rank: Junior Member

Posts: 55

Join Date: September 23, 2012

Recent Posts

Seeya S Kudtarker:
Thanks Bhavik.. Will check n let you know.. emoticon Will figure out what happens and share it here.

btw could you help me with this link?

http://www.liferay.com/community/forums/-/message_boards/message/21395092



I seen that link..but i think ur problem is solved in there??rig8?
Seeya S Kudtarker
RE: error while calling method to insert data in custom portlet
February 11, 2013 1:01 AM
Answer

Seeya S Kudtarker

Rank: Regular Member

Posts: 187

Join Date: January 15, 2013

Recent Posts

Yes! emoticon emoticon
Thanks anyways!
I am not able to accept your request here in liferay. Will yo remove it so I will send you and you can accept..

Btw if you have any good tutorials on user groups and roles and how to assign permissions to users in liferay, it would be of help!

Thanks!

Regards
Seeya
Seeya S Kudtarker
RE: error while calling method to insert data in custom portlet
February 11, 2013 1:03 AM
Answer

Seeya S Kudtarker

Rank: Regular Member

Posts: 187

Join Date: January 15, 2013

Recent Posts

kk.. Accpeted your request..
I would like to know about user roles in liferay
Bhavik Kama
RE: error while calling method to insert data in custom portlet
February 11, 2013 1:22 AM
Answer

Bhavik Kama

Rank: Junior Member

Posts: 55

Join Date: September 23, 2012

Recent Posts

Seeya S Kudtarker:
Yes! emoticon emoticon
Thanks anyways!
I am not able to accept your request here in liferay. Will yo remove it so I will send you and you can accept..

Btw if you have any good tutorials on user groups and roles and how to assign permissions to users in liferay, it would be of help!

Thanks!

Regards
Seeya


have u gone through with the liferay documentation about user roles and group ?
http://www.liferay.com/documentation/liferay-portal/6.1/user-guide/-/ai/lp-6-1-ugen12-user-groups-0 this the link
Seeya S Kudtarker
RE: error while calling method to insert data in custom portlet
February 11, 2013 1:36 AM
Answer

Seeya S Kudtarker

Rank: Regular Member

Posts: 187

Join Date: January 15, 2013

Recent Posts

Thanks!

Will let you know once get it

Regards
Seeya