I'm not as familiar with Glassfish as other servers, and not entirely
clear if it is happening in Glassfish or Spring.
It looks like, when the server restarts it may not be fully freeing up
the running MongoDB driver. I'm going to need to dig into this a bit
to see if there's a Java driver bug causing it.
Otherwise for now I'd suggest not relying on the redeploy mechanisms.
I know others have successfully used redeploys in Play, for example
with both Casbah (our Scala driver which wraps the java one) and the
Java Driver without seeing similar issues.
On May 12, 9:14 pm, Gregory Lee <
leewi...@gmail.com> wrote:
> Hi Brendan,
> Thank you for reply,
>
> Yes, you're right.
> If I restart Glassfish completely, It's gone.
>
> But, is there any way to prevent it?
> It's always happens in every task(redeploy, undeploy, disable), and if I
> restart Glassfish completely always in deploy task,
> my customer will not like it ...
> and makes hard to do test works in Web Application Server.
>
> So if possible, I want to keep Glassfish on.
>
> I understand it's not only Mongodb's problem but also WAS and maybe OS.
> (Am I right?)
> But still, It would be grateful if we can redeploy without complete restart.
> Thank you for your help!
>
> Greg
>
> 2011-05-13 ?? 12:55, Brendan W. McAdams ? ?:
>
>
>
>
>
>
>
> > ID is an AtomicInteger, to allow multiple threads in the system to
> > generate an ID that is guaranteed unique across all threads.
> > getAndIncrement is an Operation on AtomicInteger that basically says
> > "give me the current value and then increment it". Semantically, more
> > or less like ++
>
> > DId you try restarting Glassfish completely? This is happening only
> > when you redeploy a running application, correct?
>
> > On Thursday, May 12, 2011 at 10:35 AM, Gregory Lee wrote:
>
> >> Hi all,
>
> >> I'm using mongodb 1.8.1 (installed in local win7), and
> >> mongo-java-driver-2.5.3.jar.
> >> I had redeployed spring web application onto glassfish 3.1, I got
> >> endless NullPointerException at at
> >> com.mongodb.OutMessage.reset(OutMessage.java:73).
>
> >> Here is server log:
> >>> [#|2011-05-12T01:05:37.251+0900|SEVERE|glassfish3.1|com.mongodb.ReplicaSetS tatus|_ThreadID=27;_ThreadName=Thread-1;|unexpected
> >>> error getting config from node: localhost:10001
> >>> java.lang.NullPointerException
> >>> at com.mongodb.OutMessage.reset(OutMessage.java:73)
> >>> at com.mongodb.OutMessage.<init>(OutMessage.java:51)
> >>> at com.mongodb.OutMessage.query(OutMessage.java:38)
> >>> at com.mongodb.DBPort.findOne(DBPort.java:142)
> >>> at com.mongodb.ReplicaSetStatus$Node.update(ReplicaSetStatus.java:156)
> >>> at com.mongodb.ReplicaSetStatus.updateAll(ReplicaSetStatus.java:277)
> >>> at com.mongodb.ReplicaSetStatus$Updater.run(ReplicaSetStatus.java:238)
> >>> |#]
> >> Plus, I inject MongoDB Connecter as spring bean.
> >>> <bean id="MongoConnector" class="jwdm.core.bean.MongoConnector"
> >>> p:host="localhost" p:port="10001">
> >>> </bean>
>
> >> Temporary, I put some null check code to avoid exception before
> >> ID.getAndIncrement.
> >> ID is static declared and looks it should not be null ...
>
> >> class OutMessage extends BSONEncoder {
>
> >> static AtomicInteger ID = new AtomicInteger(1);
> >> ...
> >> private void reset( int op ){
> >> done();
> >> _buffer.reset();
> >> set( _buffer );
> >> *if(ID == null) ID = new AtomicInteger(1); <== Here I added*
> >> *_id = ID.getAndIncrement(); <= exception point*
>
> >> writeInt( 0 ); // length: will set this later
> >> writeInt( _id );
> >> writeInt( 0 ); // response to
> >> writeInt( op );
> >> }
>
> >> Anyone what does the "ID.getAndIncrement()" means and how to solve
> >> this problem?
> >> Thank you!
>
> >> Greg
>
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "mongodb-user" group.
> >> To post to this group, send email to
mongod...@googlegroups.com
> >> <mailto:
mongod...@googlegroups.com>.
> >> <mailto:
mongodb-user...@googlegroups.com>.