java.lang.NullPointerException: null with Jedis

760 views
Skip to first unread message

Justin Robinson

unread,
Jan 19, 2012, 10:14:35 AM1/19/12
to BigBlueButton-dev
Hi everyone,

In a module I'm working on, I've been getting a null pointer exception
when trying to set up a Jedis pool to write to the database. I declare
a JedisPool object named pollingPool as a member of the class, simple
enough:

JedisPool pollingPool;

And the necessary packages have been imported. But when I try to draw
resources:

Jedis jedis = pollingPool.getResource();

I get java.lang.NullPointerException: null. Aside from the name of the
JedisPool, it is identical to the JedisPool usage in
RedisDispatcher.java. Any thoughts?

-Justin

markos calderon

unread,
Jan 19, 2012, 10:55:49 AM1/19/12
to bigblueb...@googlegroups.com
Hi Justin,

1) In the class, did you have the setter methods for the jedis pool? like this:


2) And In the bbb-apps.xml did you reference the class? like this:


- Markos



-Justin

--
You received this message because you are subscribed to the Google Groups "BigBlueButton-dev" group.
To post to this group, send email to bigblueb...@googlegroups.com.
To unsubscribe from this group, send email to bigbluebutton-...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/bigbluebutton-dev?hl=en.




--
- Markos
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BigBlueButton Developer
http://about.me/markoscalderon
"A programmer is just a tool which converts caffeine into code"

Justin Robinson

unread,
Jan 19, 2012, 11:05:08 AM1/19/12
to BigBlueButton-dev
Markos,

The getter and setter were there before, and got deleted; putting them
back in and recompiling didn't change the error, however. BBB-apps.xml
already references the RedisDispatcher class, as well as the
PollRecorder class.

-J

On Jan 19, 10:55 am, markos calderon <mcmarko...@gmail.com> wrote:
> Hi Justin,
>
> 1) In the class, did you have the setter methods for the jedis pool? like
> this:
>
> https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebut...
>
> 2) And In the bbb-apps.xml did you reference the class? like this:
>
> https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebut...
>
> - Markos
>
> On Thu, Jan 19, 2012 at 10:14 AM, Justin Robinson
> <jtrobinson...@gmail.com>wrote:
>
>
>
>
>
>
>
>
>
> > Hi everyone,
>
> > In a module I'm working on, I've been getting a null pointer exception
> > when trying to set up a Jedis pool to write to the database. I declare
> > a JedisPool object named pollingPool as a member of the class, simple
> > enough:
>
> > JedisPool pollingPool;
>
> > And the necessary packages have been imported. But when I try to draw
> > resources:
>
> > Jedis jedis = pollingPool.getResource();
>
> > I get java.lang.NullPointerException: null. Aside from the name of the
> > JedisPool, it is identical to the JedisPool usage in
> > RedisDispatcher.java. Any thoughts?
>
> > -Justin
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "BigBlueButton-dev" group.
> > To post to this group, send email to bigblueb...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > bigbluebutton-...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/bigbluebutton-dev?hl=en.
>
> --
> - Markos
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> BigBlueButton Developerhttp://bigbluebutton.orghttp://about.me/markoscalderon

markos calderon

unread,
Jan 19, 2012, 11:16:12 AM1/19/12
to bigblueb...@googlegroups.com
Hi Justin,

Do you have any public repo, so, I can take a look?

Because, for use the JedisPool, you just have to add like this:

- Markos  

Justin Robinson

unread,
Jan 19, 2012, 11:32:12 AM1/19/12
to BigBlueButton-dev
Markos,

We haven't got our repo quite set up yet. I had the bean property
entered slightly differently than your example, but I still get the
same error after changing it.

-J

On Jan 19, 11:16 am, markos calderon <mcmarko...@gmail.com> wrote:
> Hi Justin,
>
> Do you have any public repo, so, I can take a look?
>
> Because, for use the JedisPool, you just have to add like this:http://pastebin.com/BMn1HTw2
>
> - Markos
>
> On Thu, Jan 19, 2012 at 11:05 AM, Justin Robinson
> <jtrobinson...@gmail.com>wrote:

markos calderon

unread,
Jan 19, 2012, 11:35:16 AM1/19/12
to bigblueb...@googlegroups.com
Justin,

Could you send me the red5 log (bigbluebutton.log and error.log)? (use pastebin)

- Markos 

Justin Robinson

unread,
Jan 19, 2012, 11:44:46 AM1/19/12
to BigBlueButton-dev
Markos,

I'll try, but BBB is giving me problems now to just sign in. I'll put
the logs into PasteBin as soon as I've got it worked out.

-J

On Jan 19, 11:35 am, markos calderon <mcmarko...@gmail.com> wrote:
> Justin,
>
> Could you send me the red5 log (bigbluebutton.log and error.log)? (use
> pastebin)
>
> - Markos
>
> On Thu, Jan 19, 2012 at 11:32 AM, Justin Robinson
> <jtrobinson...@gmail.com>wrote:

Justin Robinson

unread,
Jan 19, 2012, 1:23:23 PM1/19/12
to BigBlueButton-dev
Markos,

Here is the Red5 activity, where the nullPointerException appears:
http://pastebin.com/LevePvr1
Here is the log from within BigBlueButton: http://pastebin.com/yRLVQqDz

-Justin

markos calderon

unread,
Jan 19, 2012, 1:38:41 PM1/19/12
to bigblueb...@googlegroups.com
Hi Justin,

Definitely, I will need to look closer at the code...
If you wish, you can send me off of the list, some of the files that had the problems... 

- Markos

Justin Robinson

unread,
Jan 19, 2012, 2:50:30 PM1/19/12
to BigBlueButton-dev
I had a look at the Java documentation, this is what it says about the
NullPointerException:

Thrown when an application attempts to use null in a case where an
object is required. These include:

Calling the instance method of a null object.
Accessing or modifying the field of a null object.
Taking the length of null as if it were an array.
Accessing or modifying the slots of null as if it were an array.
Throwing null as if it were a Throwable value.

Applications should throw instances of this class to indicate other
illegal uses of the null object.

So the question seems to be, how is "Jedis jedis =
redispool.getResources()" using a null? JedisPool.getResource() only
has a nullary constructor, and if it didn't then Eclipse would have
highlighted the error. From a syntax perspective, the code is sound.

On Jan 19, 1:38 pm, markos calderon <mcmarko...@gmail.com> wrote:
> Hi Justin,
>
> Definitely, I will need to look closer at the code...
> If you wish, you can send me off of the list, some of the files that had
> the problems...
>
> - Markos
>

markos calderon

unread,
Jan 19, 2012, 2:55:21 PM1/19/12
to bigblueb...@googlegroups.com
Hi Justin,

A NPE is when you are trying to access to a method/property of an object which is null.. In this case, the object that is null, it is in the line:  PollRecorder.java:58 
And as I said before, I will need to look your code so in this way, I can check and try to find where is the error...

- Markos 

Justin Robinson

unread,
Jan 19, 2012, 3:00:30 PM1/19/12
to BigBlueButton-dev
Markos,

Unforunately, we're still having as much trouble with Git as we are
with this exception. PollRecorder.java:58 is just the line "Jedis
jedis = redisPool.getResource();"

-J

On Jan 19, 2:55 pm, markos calderon <mcmarko...@gmail.com> wrote:
> Hi Justin,
>
> A NPE is when you are trying to access to a method/property of an object
> which is null.. In this case, the object that is null, it is in the line:
> PollRecorder.java:58
> And as I said before, I will need to look your code so in this way, I can
> check and try to find where is the error...
>
> - Markos
>

Justin Robinson

unread,
Jan 19, 2012, 4:28:53 PM1/19/12
to BigBlueButton-dev
Problem solved! It was a matter of the redisPool object being null
after all; I fixed this by including the line "redisPool = new
JedisPool("[server IP]", 6379);" before trying to use getResources().
6379 is the default Redis port.

Thanks for your input Markos, it got me looking in the right place!

-J
Reply all
Reply to author
Forward
0 new messages