[2.0-java] Urgent Help Request!

已查看 471 次
跳至第一个未读帖子

CB

未读,
2012年8月30日 16:58:212012/8/30
收件人 play-fr...@googlegroups.com
hi all,

I'm trying to move my app into production (Amazon EC2 Ubuntu micro instance).

The app crashes with a stack trace that I cannot make sense of.

I'm performing play dist  and copying the zip into production.

in production I'm performing sudo ./start -Dhttp.port=80    (sudo is needed since in Ubuntu you must have root permissions in order to listen on port 80)

A fresh new play project (play new) will run just fine!!

I tried to eliminate all my code and start adding layer by layer. Once I got to the couchbase driver (my data store) - the Exception appeared once more.

Please - can anyone figure out from the below stack trace what is going on? How can I troubleshoot this?

Here is the stack trace:

        at akka.jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975) [com.typesafe.akka.akka-actor-akka-actor-2.0.2.jar:2.0.2]
        at akka.jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1479) [com.typesafe.akka.akka-actor-akka-actor-2.0.2.jar:2.0.2]
        at akka.jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104) [com.typesafe.akka.akka-actor-akka-actor-2.0.2.jar:2.0.2]
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.AbstractStringBuilder.setLength(AbstractStringBuilder.java:143) ~[na:1.6.0_26]
        at java.lang.StringBuilder.setLength(StringBuilder.java:55) ~[na:1.6.0_26]
        at org.jboss.netty.handler.codec.http.CookieEncoder.encodeServerSide(CookieEncoder.java:170) ~[org.jboss.netty.netty-netty-3.2.0.Final.jar:na]
        at org.jboss.netty.handler.codec.http.CookieEncoder.encode(CookieEncoder.java:93) ~[org.jboss.netty.netty-netty-3.2.0.Final.jar:na]
        at play.api.mvc.Cookies$.encode(Http.scala:559) ~[play.play_2.9.1-play_2.9.1-2.0.3.jar:2.0.3]
        at play.api.mvc.Cookies$.merge(Http.scala:583) ~[play.play_2.9.1-play_2.9.1-2.0.3.jar:2.0.3]
        at play.api.mvc.PlainResult$class.withCookies(Results.scala:84) ~[play.play_2.9.1-play_2.9.1-2.0.3.jar:2.0.3]
        at play.api.mvc.SimpleResult.withCookies(Results.scala:192) ~[play.play_2.9.1-play_2.9.1-2.0.3.jar:2.0.3]
        at play.core.j.JavaHelpers$class.createResult(JavaHelpers.scala:27) ~[play.play_2.9.1-play_2.9.1-2.0.3.jar:2.0.3]
        at play.core.Router$HandlerInvoker$$anon$4$$anon$1.createResult(Router.scala:1085) ~[play.play_2.9.1-play_2.9.1-2.0.3.jar:2.0.3]
        at play.core.j.JavaAction$class.apply(JavaAction.scala:74) ~[play.play_2.9.1-play_2.9.1-2.0.3.jar:2.0.3]
        at play.core.Router$HandlerInvoker$$anon$4$$anon$1.apply(Router.scala:1085) ~[play.play_2.9.1-play_2.9.1-2.0.3.jar:2.0.3]
        at play.core.ActionInvoker$$anonfun$receive$1$$anonfun$6.apply(Invoker.scala:126) ~[play.play_2.9.1-play_2.9.1-2.0.3.jar:2.0.3]
        at play.core.ActionInvoker$$anonfun$receive$1$$anonfun$6.apply(Invoker.scala:126) ~[play.play_2.9.1-play_2.9.1-2.0.3.jar:2.0.3]
        at play.utils.Threads$.withContextClassLoader(Threads.scala:17) ~[play.play_2.9.1-play_2.9.1-2.0.3.jar:2.0.3]
        at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:125) [play.play_2.9.1-play_2.9.1-2.0.3.jar:2.0.3]
        ... 11 common frames omitted

James Roper

未读,
2012年8月30日 17:47:392012/8/30
收件人 play-fr...@googlegroups.com
The couchbase driver comes with Netty 3.2.0.  Play uses a much more recent version of Netty.  This is most likely what is causing your issue.  Remove Netty 3.2.0 from your installation.  I don't know what affect this might have on the couchbase driver, if it doesn't work, there is little we can do about that.

CB

未读,
2012年8月30日 22:31:382012/8/30
收件人 play-fr...@googlegroups.com
hi James,

But how do you explain that everything works great on my mac laptop? the problem is only relevant when moving to Amazon ? 

Tom Carchrae

未读,
2012年8月30日 23:04:012012/8/30
收件人 play-fr...@googlegroups.com
Since this looks like it is coming from the code that encodes Cookies, you want to check to see what code is setting them and if there is anything obvious (or not) in there. 

A quick googling of your exception suggests it could be something in the string (id or value);   http://jira.codehaus.org/browse/MNG-3529  https://github.com/stumbleupon/tcollector/issues/37




--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/zaKIPGne7ZEJ.

To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.

CB

未读,
2012年8月31日 00:41:482012/8/31
收件人 play-fr...@googlegroups.com、t...@carchrae.net
I have more information:

I'm using the framework's Authentication feature. I copied the functionality from the zentask demo:

I extended the play.mvc.Security.Authenticator class and override the methods getUserName and onUnauthorized

So - when a user is trying to reach my (annotated @Security.Authenticated(Secured.class)) controller - the framework shoots the getUserName method. I'm ok here!!

The method tries to get hold of a session key:

String sessionId = ctx.session().get("session.id");

Obviously - the value is null since it is the first time.

I return null from that method. All is good up to now!!

The framework then calls my onUnauthorized implementation where I'm redirecting to an unsecured controller (my login form).

At that point - the Error occurs and the stack trace is thrown to the console. I have no clue!!

I'm so lost here  :(    again - it is all working locally just fine. It is only behaving bad on the Amazon based Ubuntu server. I can't understand this.

James Roper

未读,
2012年8月31日 01:11:422012/8/31
收件人 play-fr...@googlegroups.com、t...@carchrae.net
If you have two different netty jars on your classpath, then it is quite unpredictable which would be used in which environment.  This would totally explain why things work fine on your laptop but not in production, it just happens that on your laptop it loads the right one, and it happens that in production it loads the wrong.  Check the lib directory of your deployment, does it contain two Netty jars?

CB

未读,
2012年8月31日 01:19:102012/8/31
收件人 play-fr...@googlegroups.com、t...@carchrae.net
yes man - it does! here:

io.netty.netty-netty-3.5.0.Final.jar

and

org.jboss.netty.netty-netty-3.2.0.Final.jar

How to proceed?

James Roper

未读,
2012年8月31日 01:33:192012/8/31
收件人 play-fr...@googlegroups.com、t...@carchrae.net
Remote netty from your projects (not deployments) lib directory.  Then rebuild using play dist.

James Roper

未读,
2012年8月31日 01:37:182012/8/31
收件人 play-fr...@googlegroups.com、t...@carchrae.net
Or are you using SBT to pull in the dependency?  If so, add:

exclude ("org.jboss.netty", "netty")

to your couchbase dependency in Build.sbt eg:

"couchbase.group.id" % "couchbase" % "couchbase-version" exclude ("org.jboss.netty", "netty") 

CB

未读,
2012年8月31日 02:18:352012/8/31
收件人 play-fr...@googlegroups.com、t...@carchrae.net
Thank you so much. I'm in production ;)

Ben McCann

未读,
2012年8月31日 02:28:292012/8/31
收件人 play-fr...@googlegroups.com、t...@carchrae.net
As to why it works locally, and not in production:

Guillaume Bort

未读,
2012年8月31日 06:08:042012/8/31
收件人 play-fr...@googlegroups.com
Anyway it is a really bad idea to rely on classpath order. As James
pointed it, the correct way to fix this kind of problem is to exclude
specificaly the bad dependencies from the classpath.
> https://groups.google.com/d/msg/play-framework/-/agy5IPfOwhAJ.
>
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to
> play-framewor...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/play-framework?hl=en.



--
Guillaume Bort, http://guillaume.bort.fr

Ben McCann

未读,
2012年8月31日 11:00:332012/8/31
收件人 play-fr...@googlegroups.com
Totally agree classpath order should not be relied upon.  I filed a bug with Couchbase to let them know that they should upgrade that dependency:

Ben McCann

未读,
2012年9月10日 13:44:212012/9/10
收件人 play-fr...@googlegroups.com
The couchbase team has updated the bug to indicate that the issue will be fixed in 1.1beta
> To post to this group, send email to play-framework@googlegroups.com.

> To unsubscribe from this group, send email to

> For more options, visit this group at
> http://groups.google.com/group/play-framework?hl=en.



--
Guillaume Bort, http://guillaume.bort.fr

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To post to this group, send email to play-framework@googlegroups.com.
To unsubscribe from this group, send email to play-framework+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.

Ben McCann

未读,
2012年9月18日 10:54:202012/9/18
收件人 play-fr...@googlegroups.com
Resolved:


To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/V_gaxXhn_7AJ.

To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
回复全部
回复作者
转发
0 个新帖子