Getting NullPointerException Inside the sculptor code

28 views
Skip to first unread message

ravi

unread,
Aug 4, 2011, 1:48:39 AM8/4/11
to Fornax-Platform
Hi,
I am using sculptor tool to design my model for MongoDB
implementation(Restful API talking to sculptor api for db).My
Functional testing executed successfully.However when i run the load
testing(by pumping request via my Restful API) i am getting some null
pointer exception repeatedly inside the sculptor code.
I thorougly checked my part that my handwritten code in the
respository implementation will not thru any null pointer
exception.Can somebody help me to find out whether this is the problem
with any jar issues or i need to do some configuration to tune my
sculptor/mongodb configuration for load testing?

Stack Trace:-
***************
1) 2011-08-02 10:31:25,332 ERROR Exception thrown while trying to
handle request
org.fornax.cartridges.sculptor.framework.errorhandling.UnexpectedRuntimeException[org.fornax.cartridges.sculptor.framework.errorhandling.UnexpectedRuntimeException]:java.lang.NullPointerException
at
org.fornax.cartridges.sculptor.framework.errorhandling.BasicErrorHandlingAdvice.afterThrowing(BasicErrorHandlingAdvice.java:
95)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invokeHandlerMethod(ThrowsAdviceInterceptor.java:
144)
at
org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:
129)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
172)
at
org.fornax.cartridges.sculptor.framework.errorhandling.ServiceContextStoreAdvice.invoke(ServiceContextStoreAdvice.java:
51)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
172)
at
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:
89)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
172)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:
202)
at $Proxy33.findAndModify(Unknown Source)

Source for findAndModify
************************
public Long findAndModify(EntityType entityType) {

Sequence sequence=super.findByKey(entityType);
if(sequence!=null) {
if(sequence.getLastEntityId()!=null) {
sequence.setLastEntityId(sequence.getLastEntityId()+1);
}else {
sequence.setLastEntityId(1L);
}
super.save(sequence);
return sequence.getLastEntityId();
}
sequence=new Sequence(entityType);
sequence.setLastEntityId(1L);
super.save(sequence);
return sequence.getLastEntityId();

}


2.a) 2011-08-02 10:31:26,113 ERROR Exception thrown while trying to
handle request
org.fornax.cartridges.sculptor.framework.errorhandling.UnexpectedRuntimeException[org.fornax.cartridges.sculptor.framework.errorhandling.UnexpectedRuntimeException]:java.lang.NullPointerException
at
org.fornax.cartridges.sculptor.framework.errorhandling.BasicErrorHandlingAdvice.afterThrowing(BasicErrorHandlingAdvice.java:
95)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invokeHandlerMethod(ThrowsAdviceInterceptor.java:
144)
at
org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:
129)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
172)
at
org.fornax.cartridges.sculptor.framework.errorhandling.ServiceContextStoreAdvice.invoke(ServiceContextStoreAdvice.java:
51)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
172)
at
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:
89)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
172)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:
202)
at $Proxy13.findApplicationByKey(Unknown Source)

2.b) 2011-08-02 10:31:26,508 ERROR
[org.fornax.cartridges.sculptor.framework.errorhandling.UnexpectedRuntimeException]
user-id=tuvista, session-id=TuVistaDao, application-id=Tuvista :
java.lang.NullPointerException
java.lang.NullPointerException
at com.mongodb.DBTCPConnector$MyPort.get(DBTCPConnector.java:
276)
at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:205)
at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:
266)
at com.mongodb.DBCursor._check(DBCursor.java:309)
at com.mongodb.DBCursor._hasNext(DBCursor.java:431)
at com.mongodb.DBCursor.hasNext(DBCursor.java:456)
at
org.fornax.cartridges.sculptor.framework.accessimpl.mongodb.MongoDbFindByConditionAccessImpl.performExecute(MongoDbFindByConditionAccessImpl.java:
112)
at
org.fornax.cartridges.sculptor.framework.accessimpl.mongodb.MongoDbAccessBaseWithException.execute(MongoDbAccessBaseWithException.java:
56)
at
org.fornax.cartridges.sculptor.framework.accessimpl.mongodb.MongoDbAccessBase.execute(MongoDbAccessBase.java:
34)
at
com.tuvista.model.repositoryimpl.ApplicationRepositoryBase.findByCondition(ApplicationRepositoryBase.java:
65)
at
com.tuvista.model.repositoryimpl.ApplicationRepositoryImpl.findApplicationByKey(ApplicationRepositoryImpl.java:
24)
at
com.tuvista.model.serviceimpl.ApplicationServiceImpl.findApplicationByKey(ApplicationServiceImpl.java:
33)
at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown
Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:
309)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:
183)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
150)
at
org.fornax.cartridges.sculptor.framework.accessimpl.mongodb.DbManagerAdvice.invoke(DbManagerAdvice.java:
40)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
172)
at
org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:
124)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
172)
at
org.fornax.cartridges.sculptor.framework.errorhandling.ServiceContextStoreAdvice.invoke(ServiceContextStoreAdvice.java:
51)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
172)
at
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:
89)
at
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:
89)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:
172)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:
202)
at $Proxy13.findApplicationByKey(Unknown Source)

Source for findApplicationByKey
*******************************
public Application findApplicationByKey(String appKey) {

List<ConditionalCriteria> condition =
ConditionalCriteriaBuilder.criteriaFor(Application.class)
.withProperty(ApplicationProperties.appKey()).eq(appKey).build();
List<Application> applicationList = findByCondition(condition);

if(applicationList.isEmpty())
{
return null;
}
else
{
return applicationList.get(0);
}

}

Patrik Nordwall

unread,
Aug 4, 2011, 11:08:20 AM8/4/11
to fornax-...@googlegroups.com
The NPE comes from com.mongodb.DBTCPConnector$MyPort.get(DBTCPConnector.java:
276)
see source:
http://grepcode.com/file/repo1.maven.org/maven2/org.mongodb/mongo-java-driver/2.4/com/mongodb/DBTCPConnector.java

Could you try the latest mongo-java-driver. Version 2.5.3
Something has at least bean changed in that method.

/Patrik

ravi

unread,
Aug 16, 2011, 8:25:17 AM8/16/11
to Fornax-Platform
Hi Patrik,
The problem is resolved by itself,with the new jar file(as you
suggested).

Thanks
Ravi.P

On Aug 4, 8:08 pm, Patrik Nordwall <patrik.nordw...@gmail.com> wrote:
> The NPE comes
> from com.mongodb.DBTCPConnector$MyPort.get(DBTCPConnector.java:
> 276)
> see source:http://grepcode.com/file/repo1.maven.org/maven2/org.mongodb/mongo-jav...
>
> Could you try the latest mongo-java-driver. Version 2.5.3
> Something has at least bean changed in that method.http://grepcode.com/file/repo1.maven.org/maven2/org.mongodb/mongo-jav...
>
> /Patrik
>
>
>
> On Thu, Aug 4, 2011 at 7:48 AM, ravi <motr...@gmail.com> wrote:
> > Hi,
> >  I am using sculptor tool to design my model for MongoDB
> > implementation(Restful API talking to sculptor api for db).My
> > Functional testing executed successfully.However when i run the load
> > testing(by pumping request via my Restful API) i am getting some null
> > pointer exception repeatedly inside the sculptor code.
> >  I thorougly checked my part that my handwritten code in the
> > respository implementation will not thru any null pointer
> > exception.Can somebody help me to find out whether this is the problem
> > with any jar issues or i need to do some configuration to tune my
> > sculptor/mongodb configuration for load testing?
>
> > Stack Trace:-
> > ***************
> > 1) 2011-08-02 10:31:25,332 ERROR Exception thrown while trying to
> > handle request
>
> > org.fornax.cartridges.sculptor.framework.errorhandling.UnexpectedRuntimeExc­eption[org.fornax.cartridges.sculptor.framework.errorhandling.UnexpectedRun­timeException]:java.lang.NullPointerException
> >        at
>
> > org.fornax.cartridges.sculptor.framework.errorhandling.BasicErrorHandlingAd­vice.afterThrowing(BasicErrorHandlingAdvice.java:
> > 95)
> >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >        at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > 39)
> >        at
>
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp­l.java:
> > 25)
> >        at java.lang.reflect.Method.invoke(Method.java:597)
> >        at
>
> > org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invokeHan­dlerMethod(ThrowsAdviceInterceptor.java:
> > 144)
> >        at
>
> > org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(Th­rowsAdviceInterceptor.java:
> > 129)
> >        at
>
> > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflec­tiveMethodInvocation.java:
> > 172)
> >        at
>
> > org.fornax.cartridges.sculptor.framework.errorhandling.ServiceContextStoreA­dvice.invoke(ServiceContextStoreAdvice.java:
> > 51)
> >        at
>
> > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflec­tiveMethodInvocation.java:
> > 172)
> >        at
>
> > org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(Expo­seInvocationInterceptor.java:
> > 89)
> >        at
>
> > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflec­tiveMethodInvocation.java:
> > 172)
> >        at
>
> > org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopPr­oxy.java:
> > 202)
> >        at $Proxy33.findAndModify(Unknown Source)
>
> >  Source for findAndModify
> >  ************************
> >  public Long findAndModify(EntityType entityType) {
>
> >         Sequence sequence=super.findByKey(entityType);
> >         if(sequence!=null) {
> >                if(sequence.getLastEntityId()!=null) {
>
> >  sequence.setLastEntityId(sequence.getLastEntityId()+1);
> >                }else {
> >                        sequence.setLastEntityId(1L);
> >                }
> >              super.save(sequence);
> >              return sequence.getLastEntityId();
> >         }
> >         sequence=new Sequence(entityType);
> >         sequence.setLastEntityId(1L);
> >         super.save(sequence);
> >         return sequence.getLastEntityId();
>
> >    }
>
> > 2.a) 2011-08-02 10:31:26,113 ERROR Exception thrown while trying to
> > handle request
>
> > org.fornax.cartridges.sculptor.framework.errorhandling.UnexpectedRuntimeExc­eption[org.fornax.cartridges.sculptor.framework.errorhandling.UnexpectedRun­timeException]:java.lang.NullPointerException
> >        at
>
> > org.fornax.cartridges.sculptor.framework.errorhandling.BasicErrorHandlingAd­vice.afterThrowing(BasicErrorHandlingAdvice.java:
> > 95)
> >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >        at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > 39)
> >        at
>
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp­l.java:
> > 25)
> >        at java.lang.reflect.Method.invoke(Method.java:597)
> >        at
>
> > org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invokeHan­dlerMethod(ThrowsAdviceInterceptor.java:
> > 144)
> >        at
>
> > org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(Th­rowsAdviceInterceptor.java:
> > 129)
> >        at
>
> > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflec­tiveMethodInvocation.java:
> > 172)
> >        at
>
> > org.fornax.cartridges.sculptor.framework.errorhandling.ServiceContextStoreA­dvice.invoke(ServiceContextStoreAdvice.java:
> > 51)
> >        at
>
> > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflec­tiveMethodInvocation.java:
> > 172)
> >        at
>
> > org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(Expo­seInvocationInterceptor.java:
> > 89)
> >        at
>
> > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflec­tiveMethodInvocation.java:
> > 172)
> >        at
>
> > org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopPr­oxy.java:
> > 202)
> >        at $Proxy13.findApplicationByKey(Unknown Source)
>
> >  2.b) 2011-08-02 10:31:26,508 ERROR
>
> > [org.fornax.cartridges.sculptor.framework.errorhandling.UnexpectedRuntimeEx­ception]
> > user-id=tuvista, session-id=TuVistaDao, application-id=Tuvista  :
> > java.lang.NullPointerException
> > java.lang.NullPointerException
> >        at com.mongodb.DBTCPConnector$MyPort.get(DBTCPConnector.java:
> > 276)
> >        at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:205)
> >        at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:
> > 266)
> >        at com.mongodb.DBCursor._check(DBCursor.java:309)
> >        at com.mongodb.DBCursor._hasNext(DBCursor.java:431)
> >        at com.mongodb.DBCursor.hasNext(DBCursor.java:456)
> >        at
>
> > org.fornax.cartridges.sculptor.framework.accessimpl.mongodb.MongoDbFindByCo­nditionAccessImpl.performExecute(MongoDbFindByConditionAccessImpl.java:
> > 112)
> >        at
>
> > org.fornax.cartridges.sculptor.framework.accessimpl.mongodb.MongoDbAccessBa­seWithException.execute(MongoDbAccessBaseWithException.java:
> > 56)
> >        at
>
> > org.fornax.cartridges.sculptor.framework.accessimpl.mongodb.MongoDbAccessBa­se.execute(MongoDbAccessBase.java:
> > 34)
> >        at
>
> > com.tuvista.model.repositoryimpl.ApplicationRepositoryBase.findByCondition(­ApplicationRepositoryBase.java:
> > 65)
> >        at
>
> > com.tuvista.model.repositoryimpl.ApplicationRepositoryImpl.findApplicationB­yKey(ApplicationRepositoryImpl.java:
> > 24)
> >        at
>
> > com.tuvista.model.serviceimpl.ApplicationServiceImpl.findApplicationByKey(A­pplicationServiceImpl.java:
> > 33)
> >        at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown
> > Source)
> >        at
>
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp­l.java:
> > 25)
> >        at java.lang.reflect.Method.invoke(Method.java:597)
> >        at
>
> > org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(Aop­Utils.java:
> > 309)
> >        at
>
> > org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoin­t(ReflectiveMethodInvocation.java:
> > 183)
> >        at
>
> > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflec­tiveMethodInvocation.java:
> > 150)
> >        at
>
> > org.fornax.cartridges.sculptor.framework.accessimpl.mongodb.DbManagerAdvice­.invoke(DbManagerAdvice.java:
> > 40)
> >        at
>
> > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflec­tiveMethodInvocation.java:
> > 172)
> >        at
>
> > org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(Th­rowsAdviceInterceptor.java:
> > 124)
> >        at
>
> > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflec­tiveMethodInvocation.java:
> > 172)
> >        at
>
> > org.fornax.cartridges.sculptor.framework.errorhandling.ServiceContextStoreA­dvice.invoke(ServiceContextStoreAdvice.java:
> > 51)
> >        at
>
> > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflec­tiveMethodInvocation.java:
> > 172)
> >        at
>
> > org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(Expo­seInvocationInterceptor.java:
> > 89)
> >        at
>
> > org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(Expo­seInvocationInterceptor.java:
> > 89)
> >        at
>
> > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflec­tiveMethodInvocation.java:
> > 172)
> >        at
>
> > org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopPr­oxy.java:
> > 202)
> >        at $Proxy13.findApplicationByKey(Unknown Source)
>
> >  Source for findApplicationByKey
> >  *******************************
> >  public Application findApplicationByKey(String appKey) {
>
> >         List<ConditionalCriteria> condition =
> > ConditionalCriteriaBuilder.criteriaFor(Application.class)
> >         .withProperty(ApplicationProperties.appKey()).eq(appKey).build();
> >        List<Application> applicationList = findByCondition(condition);
>
> >         if(applicationList.isEmpty())
> >         {
> >                 return null;
> >         }
> >         else
> >         {
> >                 return applicationList.get(0);
> >         }
>
> >    }- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages