Sessions not working in Sinatra app when packaged with warbler - sinatra

I've created a simple sinatra app, but can't get sessions to work when running it as an executable war.
I've verified that it works when run via "jruby -S rackup", but when run with "java -jar myapp.war", I find that the session is reset on each request:
INFO: Winstone Servlet Engine v0.9.10 running: controlPort=disabled
session: {"session_id"=>"75936d3d21367f5c1896e749ba401d7715e41a5fd01317484faa44d80c8afaea", "csrf"=>"60367cb6c5ead39b2669668ed28db3a1", "tracking"=>{"
HTTP_USER_AGENT"=>"9f3d63482f1fb48a317c5c9e2de6196f9cd239cc", "HTTP_ACCEPT_LANGUAGE"=>"66eae971492938c2dcc2fb1ddc8d7ec3196037da"}}
Jul 20, 2014 8:00:20 PM winstone.Logger logInternal
INFO: 0:0:0:0:0:0:0:1 - [20/Jul/2014 20:00:20] "GET / " 200 765 0.1670
session: {"session_id"=>"19d266ffb8ccb29108464961e68fa9e29f1c3b45e0097806b4cbc8db156d71d7", "csrf"=>"5ac12991c2ec8d4acf22180d79c494c2", "tracking"=>{"
HTTP_USER_AGENT"=>"9f3d63482f1fb48a317c5c9e2de6196f9cd239cc", "HTTP_ACCEPT_LANGUAGE"=>"66eae971492938c2dcc2fb1ddc8d7ec3196037da"}, "name"=>"john"}
Jul 20, 2014 8:00:31 PM winstone.Logger logInternal
INFO: 0:0:0:0:0:0:0:1 - [20/Jul/2014 20:00:31] "GET /login/john " 200 9 0.0240
session: {"session_id"=>"60f161941822b4f0fae9085db58fe9ea30e86d56dc16fff2ea5859bb4008c58f", "csrf"=>"7dd3977bef9fca9c7ed9b77fdc774657", "tracking"=>{"
HTTP_USER_AGENT"=>"9f3d63482f1fb48a317c5c9e2de6196f9cd239cc", "HTTP_ACCEPT_LANGUAGE"=>"66eae971492938c2dcc2fb1ddc8d7ec3196037da"}}
Jul 20, 2014 8:00:40 PM winstone.Logger logInternal
Other than setting sessions to be enabled, is there any special setup that is needed to have sessions work when the app is packaged with warbler and run as an executable war?

nothing special should be needed - I tried your sample and it worked fine.
it's probably a bug with the jruby-rack version you're using ... please try >= 1.1.15
also I would recommend to try out the jetty webserver (you'll find an option at config/warbler.rb) ... I'll try to make sure jetty is the default for a future Warbler version.

Related

Using Render hosting app to deploy my project- Error Cannot find module

Follows Heroku becoming a paid app, I am trying other options.
Does anyone have experience uploading a MongoDB server-based project to "Render" Application Hosting?
This is the repo I want to deploy:
https://github.com/myyoss/FUNDLE_A_WORDLE_CLONE
On the app settings I use for the Build Command: "yarn" (and it seems to works cause I get "Build successful" message).
But for the Start Command I can't get the correct command/path.
I keep getting this error:
==> Build successful :
Oct 7 06:41:33 PM ==> Deploying…
Oct 7 06:42:01 PM ==> Starting service with ‘node dist/server.js’
Oct 7 06:42:06 PM internal/modules/cjs/loader.js:888
Oct 7 06:42:06 PM throw err;
Oct 7 06:42:06 PM ^
Oct 7 06:42:06 PM
Oct 7 06:42:06 PM Error: Cannot find module ‘…/routes/userRoutes’
Can someone please take a look at the repo LINK and tell me what I'm doing wrong?
On an other project I used "node dist/server.js" for the Start Command and it worked just fine.
I think your problem may be here, where you use "../routes/userRoutes". You want to use "./routes/userRoutes" since the location of that file is relative to the root directory, ./
This answer may be helpful re: routing errors, and Render's quickstart for Node/Express is also worth a look.

Launching a slave Jenkins node when a change is pushed to GitHub

I'm trying to build a project on Jenkins when a change is pushed to GitHub.
I'm using GitHub plugin and building on a slave node.
If the slave is online, everything works fine. However, if the slave is offline, Jenkins doesn't try to launch the slave node and ignores the notification from GitHub.
The following log is output to jenkins.log when the slave is online:
May 30, 2016 4:16:31 PM org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber onEvent
INFO: Received POST for https://github.com/myname/myproject
May 30, 2016 4:16:31 PM org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber$1 run
INFO: Poked MyProject
May 30, 2016 4:16:33 PM com.cloudbees.jenkins.GitHubPushTrigger$1 run
INFO: SCM changes detected in MyProject. Triggering #22
However, if the slave is offline, the build is not triggered:
May 30, 2016 4:15:58 PM org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber onEvent
INFO: Received POST for https://github.com/myname/myproject
May 30, 2016 4:15:58 PM org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber$1 run
INFO: Poked MyProject
Starting a build by clicking "Build Now" always makes the slave node online. How can I build a project by GitHub changes on a slave node which might be offline?
Update:
I found the following message on "GitHub Hook Log" of the project:
Started on May 30, 2016 6:00:46 PM
We need to schedule a new build to get a workspace, but deferring 561ms in the hope that one will become available soon (all_suitable_nodes_are_offline)
Done. Took 0.23 sec
No changes
Update(2016/06/01):
This is the current slave setting:
Contents of /var/lib/jenkins/bin/start-slave:
#!/bin/bash -eux
gcloud compute instances start ci-slave --zone us-central1-f
ssh ci-slave /var/lib/jenkins/bin/start

Can no longer deploy to Bluemix Rules Engine Service

When I originally set up my Rules Engine service in Bluemix, I could deploy from my Eclipse Juno environment just fine. I just tried to deploy a new project this morning, and I got the following error in the deployment report in Eclipse:
ilog.rules.res.model.IlrAlreadyExistException: Unknown RuleApp: /RefillRulesApp/1.0. at
com.ibm.rules.res.internal.MutableRepositoryRESTAdapter.addRuleApp(MutableRepositoryRESTAdapter.java:86)
at
com.ibm.rules.decisionservice.internal.RESClient$3.execute(RESClient.java:332)
at
com.ibm.rules.decisionservice.internal.RESClient$3.execute(RESClient.java:1)
at
com.ibm.rules.decisionservice.internal.RESClient.safeInvokeRES(RESClient.java:132)
at
com.ibm.rules.decisionservice.internal.RESClient.deploy(RESClient.java:299)
at
com.ibm.rules.decisionservice.internal.DsResRestClient.deploy(DsResRestClient.java:168)
at
com.ibm.rules.studio.model.decisionservice.impl.Server.deploy(Server.java:310)
at
com.ibm.rules.decisionservice.DsRuleAppDeployManager.deploy(DsRuleAppDeployManager.java:38)
at
com.ibm.rules.decisionservice.DsDeployManager.deploy(DsDeployManager.java:88)
at
com.ibm.rules.studio.decisionservice.SDsXOMDeploymentJob.deploy(SDsXOMDeploymentJob.java:203)
at
com.ibm.rules.studio.decisionservice.SDsRuleAppDeploymentJob.deployRuleApp(SDsRuleAppDeploymentJob.java:101)
at
com.ibm.rules.studio.decisionservice.SDsRuleAppDeploymentJob.deploy(SDsRuleAppDeploymentJob.java:65)
at
com.ibm.rules.studio.decisionservice.SDsXOMDeploymentJob.runInWorkspace(SDsXOMDeploymentJob.java:81)
at
org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)**
I checked the RES console server log and there isn't any untoward messages in it
The Decision Server version infomation looks like this:
Version: Decision Server 8.7.0.1 , Decision Engine 1.10.0 Patch level: Build #2 on 2015-03-13 16:54:27 Release status: COMMERCIAL
Persistence Type: datasource (DB2/LINUXX8664 SQL10070) Startup
Time: Jan 29, 2016 4:17:18 PM GMT-05:00 Last Update Time: Feb 2, 2016
3:01:23 PM GMT-05:00
I checked for updates to the Eclipse plugin, and it looks like I am up to date.
If I check in the Explorer in the RES console, I can see that it partially deployed:
Deploy Picture
Notice how the rule app is greyed-out.
Any ideas? Thanks...
I found that if I deploy the RuleApp from a 'Rule project for Decision Service', I get the same error. Can you deploy it from a RuleApp project which references a 'Standard Rule Project'? That should fix the issue.

What can be issue with Tomcat that it starts in RUN mode but in debug mode it hangs forever?

I am using STS(eclipse) and facing a weird issue with Tomcat. It was running fine and all of a sudden it started giving issues. Firstly it responded very slowly and after it did not respond at all in debug mode. While it runs fine when is started in RUN mode but when debugging it waits for something after -
May 15, 2013 9:03:51 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
May 15, 2013 9:03:51 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.32
May 15, 2013 9:03:53 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
The server is stuck forever, seems like it is asking for something from somewhere or so. I did many things like - deleting the server and setting the whole thing again, took a different Tomcat. I did not change any set up for sure.
Make sure you don't have any breakpoints set, this could cause the server to pause during startup.
Check if you have any breakpoints in the declaration of a method
public void myMethod( ParamType myParameter ){ //breakpoint in this line
...
}
You would see the break point marked as [entry] in the breakpoints view in Debug perspective instead of [line: XX] as breakspoints inside implementation are shown.
Disable that breakpoint and try to start server in Debug. This worked for me, hope this helps someone.

Unable to run ./cim.sh for ATG 10.1.2 using Weblogic App Server

Hi Everyone,
I have installed ATG 10.1.2 , along with CRS , Search , CSC on my Linux machine. I'm using weblogic as my application server. However, when i try to run ./cim.sh , I get an error which is as follows
It says that its unable to find the class weblogic.utils.classloaders.ClassFinder .
I have set my environment variables as follows :
export JAVA_HOME=/home/install/mediaStore/jdk1.6.0_41
export PATH=$JAVA_HOME/bin:/home/install/software/ant/apache-ant-1.8.2/bin:/home/install/Oracle11gR2/install/product/11.2.0/dbhome_1/bin:$PATH
export ANT_HOME=/home/install/software/ant/apache-ant-1.8.2
export PATH=$PATH:ANT_HOME/bin
export DYNAMO_ROOT=/home/install/mediaStore/ATG/ATG10.1.2
export DYNAMO_HOME=$DYNAMO_ROOT/home
export ATGJRE=$JAVA_HOME/bin/java
export CLASSPATH=/home/install/Oracle11gR2/install/product/11.2.0/dbhome_1/jdbc/lib/ojdbc6.jar:$CLASSPATH
export WEBLOGIC_HOME=/home/install/mediaStore/Weblogic
export WEBLOGIC_SERVER=$WEBLOGIC_HOME/wlserver_12.1
[install#JJPLRHEL01 bin]$ ./cim.sh
The following installed ATG components are being used to launch:
ATGPlatform version 10.1.2 installed at /home/install/mediaStore/ATG/ATG10.1.2
Error Thu Feb 28 15:21:35 IST 2013 1362045095625 / **atg.nucleus.NucleusResources->cantResolveComponent : Unable to resolve component /atg/dynamo/service/validation/JavaxValidatorFactory** java.lang.NoClassDefFoundError: weblogic/utils/classloaders/ClassFinder
Error Thu Feb 28 15:21:35 IST 2013 1362045095625 / at javax.validation.Validation.byProvider(Validation.java:166)
Error Thu Feb 28 15:21:35 IST 2013 1362045095625 / ***Caused by :java.lang.ClassNotFoundException: weblogic.utils.classloaders.ClassFinder***
Error Thu Feb 28 15:21:35 IST 2013 1362045095625 / at
Any help or views or guidance would be highly appreciated .
Thanks ,
Aazim
I added the following to my classpath
/home/install/mediaStore/Weblogic/wlserver_12.1/server/lib/wls-api.jar
Also, currently ATG 10.1.2 does not support Weblogic 12.1. So, you won't be able to configure CRS with it.