Re: Ajax Servlet Deployment

2015-05-20 Thread John Huss
If you are aren't on a recent version of Wonder, you need to be for this to
work - Ajax in servlet. Probably fixed about a year ago.
On Tue, May 19, 2015 at 4:14 PM Kevin Hinkson k...@coralstone.co wrote:

 Hi,
 I am attempting to deploy a web page where the page uses an
 AjaxFlexibleFileUpload component. This works in the development setup.
 However, once the page with the AjaxFlexibleFileUpload loads on the server
 the two XHRs that run come back with 200 responses but they are completely
 empty of content. This results in no file dialog appearing when a user
 attempts to select an image for upload.

 The errors that show in the browser JS console are
 JSONRpcClientException: error parsing result”, ReferenceError: Can't find
 variable: jsonrpc_0 and  ReferenceError: Can't find variable: jsonrpc_1.

 My local development setup is a (reverse) proxy through NGINX. The
 deployment is to a AWS Elastic Beanstalk, in Tomcat 7, Java 7 which uses
 Apache as a reverse proxy.

 I’ll admit I know very little about WebObjects and Ajax. It is not clear
 to me that I have all the correct steps for using Ajax components. One
 thing I did was to override pageWithName in the Application class.

 @Override
 public WOComponent pageWithName(String name, WOContext context)
 {
 log.error(application pageWithName  + name +   + context);
 WOComponent page = super.pageWithName(name, context);
 log.error(got page  + page);
 return page;
 }

 I noticed that when run locally there is nothing in the logs for the XHR
 requests because they load fine. However, when deployed to a Beanstalk
 instance I get the following.

 ERROR 20:32:35 (com.adnero.finance.web.Application:?)  -application
 pageWithName null er.extensions.appserver.ERXWOServletContext contextID=0
 requestSenderID=0.17.1.1.1.0.1 elementID=null
 sessionID=GpMB9KKAiBu1Rdv4MqVNu0
 request=er.extensions.appserver.ERXRequest
 (er.extensions.appserver.ERXRequest httpVersion=HTTP/1.0
 headers={accept=[*/*], accept-encoding=[gzip, deflate],
 accept-language=[en-us], connection=[Keep-Alive], content-length=[50],
 content-type=[text/plain],
 cookie=[JSESSIONID=727EEEFD467421EFD51BB2A65A0707BF], dnt=[1],
 host=[replaced.host.url], origin=[http://replaced.host.url], referer=[
 http://replaced.host.url/WebObjects/AdneroWeb.woa/wo/0.0.0.17.1],
 remote_addr=[104.200.104.189], user-agent=[Mozilla/5.0 (Macintosh; Intel
 Mac OS X 10_10_3) AppleWebKit/600.6.3 (KHTML, like Gecko) Version/8.0.6
 Safari/600.6.3], x-forwarded-host=[replaced.host.url],
 x-forwarded-server=[ip-172-31-26-217.ec2.internal],
 x-requested-with=[XMLHttpRequest], x-webobjects-adaptor-version=[5.2],
 x-webobjects-servlet-server-name=[replaced.host.url],
 x-webobjects-servlet-server-port=[80]} content-length=50 cookies=null
 userInfo={ServletConfig=org.apache.catalina.core.StandardWrapperFacade@7f127e0,
 ServletContext=org.apache.catalina.core.ApplicationContextFacade@6970e732,
 HttpServletRequest=org.apache.catalina.connector.RequestFacade@2b18fb03,
 HttpServletResponse=org.apache.catalina.connector.ResponseFacade@7507980f}
 storePageInBacktrackCache=true ) method=POST
 uri=/WebObjects/AdneroWeb.woa/ajax/0.0.17.1.1.1.0.1
 defaultFormValueEncoding=UTF-8 formValueEncodingDetectionEnabled=NO
 formValueEncoding=UTF-8 formValues={WOIsmapCoords =
 ({id:1,method:system.listMethods,params:[]}); }  response=null
 pageElement=null pageComponent=null currentComponent=null
 url=/WebObjects/AdneroWeb.woa urlApplicationNumber=-1
 distributionEnabled=false pageChanged=false pageReplaced=false

 ERROR 20:32:35 (com.adnero.finance.web.Application:?)  -got page
 com.adnero.finance.web.pages.Main name: com.adnero.finance.web.pages.Main
 subcomponents: null 


 I am guessing that this differences means that the ajax requests are not
 being handled by the Ajax Handler but are getting caught by the default
 handler or that they are falling back to pageWithName, (which then falls
 back to Main.class) when they should not be?

 My apache config for the proxy looks like this:

 RewriteEngine On

 RewriteCond %{REQUEST_URI} ^/WebObjects/Frameworks/ [NC]
 RewriteRule ^/WebObjects/Frameworks/(.+)$
 /WebServerResources/Frameworks/$1 [PT]

 RewriteCond %{REQUEST_URI} ^/WebObjects/Contents/ [NC]
 RewriteRule ^/WebObjects/Contents/(.+)$ /WebServerResources/Contents/$1
 [PT]

 RewriteCond %{REQUEST_URI}
 ^/WebObjects/AdneroWeb.woa/Contents/WebServerResources/ [NC]
 RewriteRule ^/WebObjects/AdneroWeb.woa/Contents/WebServerResources/(.+)$
 /WebServerResources/Contents/WebServerResources/$1 [PT]

 RewriteCond %{REQUEST_URI} ^/ishealthy$ [NC]
 RewriteRule ^/ishealthy$
 /WebObjects/AdneroWeb.woa/ra/Healthcheck/ishealthy [PT]

 Proxy *
 Order deny,allow
 Allow from all
 /Proxy

 ProxyPass / http://localhost:8080/ retry=0
 ProxyPassReverse / http://localhost:8080/
 ProxyPreserveHost on

 LogFormat %h (%{X-Forwarded-For}i) %l %u %t \%r\ %s %b \%{Referer}i\
 \%{User-Agent}i\
 ErrorLog /var/log/httpd/elasticbeanstalk-error_log
 

strange SELECT results in postgresql slave

2015-05-20 Thread Musall Maik
Hi,

I know many of you work with PostgreSQL so I'll try this here.

I have a strange case where a SELECT for a primary key returns 0 rows on one 
slave, while it returns the correct 1 row on another slave and on the master. 
It does however return that row on all slaves when queried with LIKE and 
trailing or leading wildcard.

psql version is 9.3.5, because that's what comes with Ubuntu 14.04 LTS
Master runs Ubuntu 14.04 LTS
Slave 1 runs also Ubuntu 14.04 LTS
Slave 2 runs Mac OS X 10.7, pgsql installed via homebrew

Both slaves are configured with streaming replication, and I've been using that 
setup for years, starting with psql 9.1, with no problems so far. Suspecting 
some weird problem, I already re-initialized slave 2 with a fresh backup and 
started replication from the beginning, so the database is fresh from a master 
copy, and is verified to be current.

2015-05-19 20:53:43.937 CEST LOG:  entering standby mode
2015-05-19 20:53:43.974 CEST LOG:  redo starts at 31/3F28
2015-05-19 20:53:45.522 CEST LOG:  consistent recovery state reached at 
31/40CCE6E8
2015-05-19 20:53:45.523 CEST LOG:  database system is ready to accept read only 
connections
2015-05-19 20:53:45.604 CEST LOG:  started streaming WAL from primary at 
31/4100 on timeline 1


So here's the query.

SELECT * FROM MyTable WHERE email = 'f...@example.com';

This returns 1 row on master and slave 1, but 0 on slave 2, while this query:

SELECT * FROM MyTable WHERE email LIKE 'f...@example.com%';

or this one

SELECT * FROM MyTable WHERE email LIKE '%f...@example.com';

returns the correct 1 row on all three systems. Note that this works with the 
wildcard on either end, or also somewhere in the middle, doesn't matter. Note: 
email is the primary key on this table.

This behaviour is the same with any address to be queried, and is also the same 
on a similar second table. This does NOT occur on any other table, which all 
have integer primary keys. There is also no problem when I select for other 
attributes on these tables.

Does anyone have a hint?

Thanks
Maik

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: WOSession serialisation redux

2015-05-20 Thread Chuck Hill
Can you just mark it as transient and re-create it on a lazy creation basis?  
I've not looked but that seems like an appropriate use of transient.

Chuck

On 2015-05-20, 6:45 PM, Paul Hoadley wrote:

On 20 May 2015, at 9:21 am, Paul Hoadley 
pa...@logicsquad.netmailto:pa...@logicsquad.net wrote:

On 20 May 2015, at 1:53 am, Ramsey Gurley 
rgur...@smarthealth.commailto:rgur...@smarthealth.com wrote:
On May 19, 2015, at 4:03 AM, Paul Hoadley 
pa...@logicsquad.netmailto:pa...@logicsquad.net wrote:
I've had a look at Ramsey's ERPersistentSessionStorage.framework, and my 
intention was to create something similar backed by memcached.  I got it 
working to the proof-of-concept level on a trivial app, but using native Java 
serialisation seems brittle.  (By which I mean it falls over pretty fast when 
you throw a serialisation-based approach into a substantial application.)
I'm curious about the falls over pretty fast part. What sort of problems do 
you have?
Serialization failures.  (To be clear, I'm talking about testing with my own 
memcached-based approach, but it's really only some very minor changes to your 
work to use memcached instead of the database as the back-end.)  Initially it 
was my own classes, which I could fix, but then I started hitting weirdness 
like this:
Caused by: java.io.NotSerializableException: java.lang.reflect.Field
It's not obvious to me where that's coming from, or how to fix it.

Having just discovered this:

-Dsun.io.serialization.extendedDebugInfo=true

I can report that the java.lang.reflect.Field is in an ERXDisplayGroup.  And 
here it is:

public class ERXDisplayGroupT extends WODisplayGroup {
private Field displayedObjectsField;

So is ERXDisplayGroup simply not serializable, and hence I'd need to pull it 
from any application that wanted to use ERPersistentSessionStorage.framework?


--
Paul Hoadley
http://logicsquad.net/



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  
(Webobjects-dev@lists.apple.commailto:Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/chill%40gevityinc.com

This email sent to ch...@gevityinc.commailto:ch...@gevityinc.com
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

RE: strange SELECT results in postgresql slave

2015-05-20 Thread Mark Cassidy
Well the obvious fix is to run PostgreSQL on the same OS and version of OS + 
PostgreSQL.  :)

1.  Have you verified that the PK index was built successfully during the 
restore?   Or, if you used pgbasebackup, then since it is physical not logical 
replication something may be mismatched. Tried re-indexing the PK on server2?

If the pk index is broken for some reason on server 2, then this could explain 
it because Pg may not use indexes at all when doing LIKEs ... even with the % 
at the end ...if your locale isn't appropriate.  So the explain analyze may 
show that the LIKEs are not using the index even if LIKE 'xyz%'.

2. Aside from a bug with Postgres on the Mac, it may possibly be due to a 
locale/encoding problem so that's the second thing I'd check.  Maybe the @ sign 
is throwing it off for the locale? (since the problems seem to be around the 
email addresses on slave 2).  Not sure why LIKE seems to work though in the 
case.

3. Make sure Pg is the same version on all three.
   select version();

Good luck.  (But I would not do streaming replication across different OSs like 
this.)

Sent from my Verizon Wireless 4G LTE smartphone


 Original message 
From: Musall Maik m...@selbstdenker.ag
Date: 05/20/2015 8:25 AM (GMT-05:00)
To: WebObjects-Dev Apple webobjects-dev@lists.apple.com
Subject: strange SELECT results in postgresql slave

Hi,

I know many of you work with PostgreSQL so I'll try this here.

I have a strange case where a SELECT for a primary key returns 0 rows on one 
slave, while it returns the correct 1 row on another slave and on the master. 
It does however return that row on all slaves when queried with LIKE and 
trailing or leading wildcard.

psql version is 9.3.5, because that's what comes with Ubuntu 14.04 LTS
Master runs Ubuntu 14.04 LTS
Slave 1 runs also Ubuntu 14.04 LTS
Slave 2 runs Mac OS X 10.7, pgsql installed via homebrew

Both slaves are configured with streaming replication, and I've been using that 
setup for years, starting with psql 9.1, with no problems so far. Suspecting 
some weird problem, I already re-initialized slave 2 with a fresh backup and 
started replication from the beginning, so the database is fresh from a master 
copy, and is verified to be current.

2015-05-19 20:53:43.937 CEST LOG:  entering standby mode
2015-05-19 20:53:43.974 CEST LOG:  redo starts at 31/3F28
2015-05-19 20:53:45.522 CEST LOG:  consistent recovery state reached at 
31/40CCE6E8
2015-05-19 20:53:45.523 CEST LOG:  database system is ready to accept read only 
connections
2015-05-19 20:53:45.604 CEST LOG:  started streaming WAL from primary at 
31/4100 on timeline 1


So here's the query.

SELECT * FROM MyTable WHERE email = 'f...@example.com';

This returns 1 row on master and slave 1, but 0 on slave 2, while this query:

SELECT * FROM MyTable WHERE email LIKE 'f...@example.com%';

or this one

SELECT * FROM MyTable WHERE email LIKE '%f...@example.com';

returns the correct 1 row on all three systems. Note that this works with the 
wildcard on either end, or also somewhere in the middle, doesn't matter. Note: 
email is the primary key on this table.

This behaviour is the same with any address to be queried, and is also the same 
on a similar second table. This does NOT occur on any other table, which all 
have integer primary keys. There is also no problem when I select for other 
attributes on these tables.

Does anyone have a hint?

Thanks
Maik

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/mcassidy%40escholar.com

This email sent to mcass...@escholar.com
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: WOSession serialisation redux

2015-05-20 Thread Paul Hoadley
On 20 May 2015, at 9:21 am, Paul Hoadley pa...@logicsquad.net wrote:

 On 20 May 2015, at 1:53 am, Ramsey Gurley rgur...@smarthealth.com wrote:
 
 On May 19, 2015, at 4:03 AM, Paul Hoadley pa...@logicsquad.net wrote:
 
 I’ve had a look at Ramsey’s ERPersistentSessionStorage.framework, and my 
 intention was to create something similar backed by memcached.  I got it 
 working to the proof-of-concept level on a trivial app, but using native 
 Java serialisation seems brittle.  (By which I mean it falls over pretty 
 fast when you throw a serialisation-based approach into a substantial 
 application.)
 
 I’m curious about the falls over pretty fast part. What sort of problems 
 do you have?
 
 Serialization failures.  (To be clear, I’m talking about testing with my own 
 memcached-based approach, but it’s really only some very minor changes to 
 your work to use memcached instead of the database as the back-end.)  
 Initially it was my own classes, which I could fix, but then I started 
 hitting weirdness like this:
 
 Caused by: java.io.NotSerializableException: java.lang.reflect.Field
 
 It’s not obvious to me where that’s coming from, or how to fix it.

Having just discovered this:

-Dsun.io.serialization.extendedDebugInfo=true

I can report that the java.lang.reflect.Field is in an ERXDisplayGroup.  And 
here it is:

 public class ERXDisplayGroupT extends WODisplayGroup {
   private Field displayedObjectsField;

So is ERXDisplayGroup simply not serializable, and hence I’d need to pull it 
from any application that wanted to use ERPersistentSessionStorage.framework?


-- 
Paul Hoadley
http://logicsquad.net/



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: WOSession serialisation redux

2015-05-20 Thread Paul Hoadley
On 21 May 2015, at 11:17 am, Chuck Hill ch...@gevityinc.com wrote:

 Can you just mark it as transient and re-create it on a lazy creation basis?  
 I’ve not looked but that seems like an appropriate use of transient.

Yep, that works.  Thanks Chuck.


-- 
Paul Hoadley
http://logicsquad.net/


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Ajax Servlet Deployment

2015-05-20 Thread Kevin Hinkson
Hi John,

Thanks for the tip. I tried that and it wasn’t the issue per say. I also tried 
re-ordering the frameworks.

I did finally figure it out. The local development environment used an https 
connection and the ElasticBeanstalk one did not. Combined with the secure 
cookie property being on in Wonder this meant that the session was not 
available to the browser. This seems to have caused the issue.

Thanks for your help.

 On May 20, 2015, at 9:23 AM, John Huss johnth...@gmail.com wrote:
 
 If you are aren't on a recent version of Wonder, you need to be for this to 
 work - Ajax in servlet. Probably fixed about a year ago.
 On Tue, May 19, 2015 at 4:14 PM Kevin Hinkson k...@coralstone.co 
 mailto:k...@coralstone.co wrote:
 Hi,
 I am attempting to deploy a web page where the page uses an 
 AjaxFlexibleFileUpload component. This works in the development setup. 
 However, once the page with the AjaxFlexibleFileUpload loads on the server 
 the two XHRs that run come back with 200 responses but they are completely 
 empty of content. This results in no file dialog appearing when a user 
 attempts to select an image for upload.
 
 The errors that show in the browser JS console are JSONRpcClientException: 
 error parsing result”, ReferenceError: Can't find variable: jsonrpc_0 and  
 ReferenceError: Can't find variable: jsonrpc_1.
 
 My local development setup is a (reverse) proxy through NGINX. The deployment 
 is to a AWS Elastic Beanstalk, in Tomcat 7, Java 7 which uses Apache as a 
 reverse proxy.
 
 I’ll admit I know very little about WebObjects and Ajax. It is not clear to 
 me that I have all the correct steps for using Ajax components. One thing I 
 did was to override pageWithName in the Application class.
 
 @Override
 public WOComponent pageWithName(String name, WOContext context)
 {
 log.error(application pageWithName  + name +   + context);
 WOComponent page = super.pageWithName(name, context);
 log.error(got page  + page);
 return page;
 }
 
 I noticed that when run locally there is nothing in the logs for the XHR 
 requests because they load fine. However, when deployed to a Beanstalk 
 instance I get the following.
 
 ERROR 20:32:35 (com.adnero.finance.web.Application:?)  -application 
 pageWithName null er.extensions.appserver.ERXWOServletContext contextID=0 
 requestSenderID=0.17.1.1.1.0.1 elementID=null 
 sessionID=GpMB9KKAiBu1Rdv4MqVNu0 request=er.extensions.appserver.ERXRequest 
 (er.extensions.appserver.ERXRequest httpVersion=HTTP/1.0 
 headers={accept=[*/*], accept-encoding=[gzip, deflate], 
 accept-language=[en-us], connection=[Keep-Alive], content-length=[50], 
 content-type=[text/plain], 
 cookie=[JSESSIONID=727EEEFD467421EFD51BB2A65A0707BF], dnt=[1], 
 host=[replaced.host.url], origin=[http://replaced.host.url 
 http://replaced.host.url/], 
 referer=[http://replaced.host.url/WebObjects/AdneroWeb.woa/wo/0.0.0.17.1 
 http://replaced.host.url/WebObjects/AdneroWeb.woa/wo/0.0.0.17.1], 
 remote_addr=[104.200.104.189], user-agent=[Mozilla/5.0 (Macintosh; Intel Mac 
 OS X 10_10_3) AppleWebKit/600.6.3 (KHTML, like Gecko) Version/8.0.6 
 Safari/600.6.3], x-forwarded-host=[replaced.host.url], 
 x-forwarded-server=[ip-172-31-26-217.ec2.internal], 
 x-requested-with=[XMLHttpRequest], x-webobjects-adaptor-version=[5.2], 
 x-webobjects-servlet-server-name=[replaced.host.url], 
 x-webobjects-servlet-server-port=[80]} content-length=50 cookies=null 
 userInfo={ServletConfig=org.apache.catalina.core.StandardWrapperFacade@7f127e0,
  ServletContext=org.apache.catalina.core.ApplicationContextFacade@6970e732, 
 HttpServletRequest=org.apache.catalina.connector.RequestFacade@2b18fb03, 
 HttpServletResponse=org.apache.catalina.connector.ResponseFacade@7507980f} 
 storePageInBacktrackCache=true ) method=POST 
 uri=/WebObjects/AdneroWeb.woa/ajax/0.0.17.1.1.1.0.1 
 defaultFormValueEncoding=UTF-8 formValueEncodingDetectionEnabled=NO 
 formValueEncoding=UTF-8 formValues={WOIsmapCoords = 
 ({id:1,method:system.listMethods,params:[]}); }  response=null 
 pageElement=null pageComponent=null currentComponent=null 
 url=/WebObjects/AdneroWeb.woa urlApplicationNumber=-1 
 distributionEnabled=false pageChanged=false pageReplaced=false
 
 ERROR 20:32:35 (com.adnero.finance.web.Application:?)  -got page 
 com.adnero.finance.web.pages.Main name: com.adnero.finance.web.pages.Main 
 subcomponents: null 
 
 
 I am guessing that this differences means that the ajax requests are not 
 being handled by the Ajax Handler but are getting caught by the default 
 handler or that they are falling back to pageWithName, (which then falls back 
 to Main.class) when they should not be?
 
 My apache config for the proxy looks like this:
 
 RewriteEngine On
 
 RewriteCond %{REQUEST_URI} ^/WebObjects/Frameworks/ [NC]
 RewriteRule ^/WebObjects/Frameworks/(.+)$ /WebServerResources/Frameworks/$1 
 [PT]
 
 RewriteCond %{REQUEST_URI} ^/WebObjects/Contents/ [NC]
 RewriteRule ^/WebObjects/Contents/(.+)$