New stoker-web


 
Thanks Gary. I'll setup tomcat here to see if I can replicate your results.

If you switch back to the old war, it works for you, correct?

Gary
 
Gary,

I installed tomcat and dropped my war file in there. I fired it up and it worked out of the box. I used Tomcat 6

Here is what I did:
Expanded Tomcat war: tar -zxvf apache-tomcat-6.0.36.tar.gz
Created symlink: ln -s apache-tomcat-6.0.36 tomcat
Move to tomcat: cd tomcat
Dropped war file in the webapp directory: cp /tmp/stokerweb.war webapps
Started tomcat. bin/startup.sh

Navigate to page: http://x.x.x.x:8080/stokerweb

What version of tomcat are you using?

Thanks
 
I have spent most of my waking hours for the last 24 trying to figure out how to deploy stokerweb on Ubuntu 12.04 using the distro tomcat7 package and trying to keep all the non .deb file stuff in /usr/local. I have about 27 years of UNIX|C|sh|perl|http|html experience, but have not kept up with any of the web stuff since the emergence of java and servlets. It took me awhile, but I finally got tomcat7 running with all docs and examples installed from synaptic. It created all init.d files and started them and creates symlinks from /var/lib/tomcat7 to /etc/tomcat7. Once I figured out which was the canonical tomcat-users.xml (there is also one in /usr/share/tomcat7/skel/conf/) I then created a manager-gui user for tomcat so I could try to install stokerweb, but I have spent all morning trying to figure out how to get it running. I have managed to get it to show up in the Applications list on localhost:8080/manager, but it had missing pieces. Mind you my stoker is not turned on yet. One of the things I found in the logs indicated that it cannot find the env variable STOKERWEB_DIR which I know Gary N. put in his /etc/init.d/tomcat startup file, but I was hoping to have things a bit more modular so that all of the stuff involving the stokerweb is local to stokerweb directories. When I put the stokerweb.war file in the webapps dir it created a stokerweb dir with all of the stokerweb files in it, but it still would not run. I have read this whole thread and I thought Gary B. said that if stokerweb is installed right even if it cannot find the stoker it will bring up the screen. Is that right? If I figure it out before anyone replies to this I will definitely announce success and delete or edit this message.

Stew
 
I decided to add the STOKERWEB_DIR to /etc/init.d/tomcat7 and do things more the way Gary N. documents in his how-to. However, I had not yet succeeded in adding a stokerweb user with the default "." dir. So I decided to set the env var from shell before invoking addUser.jar . Below is the output from that. I then tried parens around the whole shell command and still get the null pointer exception.

What am I missing?

root@celeron:/usr/local/share/stokerweb# export STOKERWEB_DIR="/usr/local/share/stokerweb"; java -jar addUser.jar
Enter username: stoker
Enter password:
Retype password:
Exception in thread "main" java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Properties.java:435)
at java.util.Properties.load0(Properties.java:354)
at java.util.Properties.load(Properties.java:342)
at sweb.server.security.LoginProperties.<init>(LoginProperties.java:57)
at sweb.server.security.LoginProperties.getInstance(LoginProperties.java:85)
at sweb.server.security.admin.AddUser.addLoginAndPass(AddUser.java:38)
at sweb.server.security.admin.AddUser.main(AddUser.java:64)

Without a stokerweb user I followed the rest of Gary N.'s instructions and the tomcat manager gui reported a successful install, but when I load http:/localhost:8080/stokerweb I get:

type Status report

message /stokerweb/

description The requested resource (/stokerweb/) is not available.


Stew
 
Last edited:
Hey Stew. Sorry you're running into so much trouble getting stoker-web running.

The exception you posted is a known issue. Issue 22. Create an empty login.properties file in your $STOKERWEB_DIR and then try to run the addUser again.

If Stoker-web is correctly deployed, the default page will display. Do you see any errors in the tomcat/logs directory, the catalina.out file should have all the output from stokerweb.

Gary
 
Just to make sure that this wasn't a Tomcat 7 issue, I just downloaded and deployed stoker-web in Tomcat 7 and it worked for me. I followed the procedures outlined 3 posts ago. I did not use the GUI or the tomcat manager, I just plopped the war in the webapps directory and fired it up.

Gary
 
Don't feel bad, I forget to touch the login.properties file every time.

I think my issues came when I had multiple versions scattered across different areas.

Cleaned it all out, reinstalled and poof, the system came up. Gonna go get the stoker and test it out tomorrow.
 
Last edited:
I did:

root@celeron:/var/lib/tomcat7/webapps/stokerweb# touch login.properties
root@celeron:/var/lib/tomcat7/webapps/stokerweb# java -jar addUser.jar
Enter username: stoker
Enter password:
Retype password:
Exception in thread "main" java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Properties.java:435)
at java.util.Properties.load0(Properties.java:354)
at java.util.Properties.load(Properties.java:342)
at sweb.server.security.LoginProperties.<init>(LoginProperties.java:57)
at sweb.server.security.LoginProperties.getInstance(LoginProperties.java:85)
at sweb.server.security.admin.AddUser.addLoginAndPass(AddUser.java:38)
at sweb.server.security.admin.AddUser.main(AddUser.java:64)

root@celeron:/var/lib/tomcat7/webapps/stokerweb# chown tomcat7:tomcat7 login.properties
root@celeron:/var/lib/tomcat7/webapps/stokerweb# l
total 50868
-rw-r--r-- 1 tomcat7 tomcat7 417285 Nov 10 18:31 addUser.jar
-rw-r--r-- 1 tomcat7 tomcat7 677 Nov 10 18:31 log4j.properties
-rw-r--r-- 1 tomcat7 tomcat7 685 Nov 10 18:31 log4j.properties-DIST
-rw-r--r-- 1 tomcat7 tomcat7 0 Nov 11 10:38 login.properties
-rw-r--r-- 1 tomcat7 tomcat7 0 Nov 10 18:31 mpStokerWebDirstokerweb_app.log
-rw-r--r-- 1 tomcat7 tomcat7 1556 Nov 10 18:31 stokerweb.properties
-rw-r--r-- 1 tomcat7 tomcat7 1552 Nov 10 18:31 stokerweb.properties-DIST
-rw-r--r-- 1 tomcat7 tomcat7 51646815 Nov 10 18:31 stokerweb.war
root@celeron:/var/lib/tomcat7/webapps/stokerweb# java -jar addUser.jar
Enter username: stoker
Enter password:
Retype password:
Exception in thread "main" java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Properties.java:435)
at java.util.Properties.load0(Properties.java:354)
at java.util.Properties.load(Properties.java:342)
at sweb.server.security.LoginProperties.<init>(LoginProperties.java:57)
at sweb.server.security.LoginProperties.getInstance(LoginProperties.java:85)
at sweb.server.security.admin.AddUser.addLoginAndPass(AddUser.java:38)
at sweb.server.security.admin.AddUser.main(AddUser.java:64)
root@celeron:/var/lib/tomcat7/webapps/stokerweb# export STOKERWEB_DIR="/usr/local/share/stokerweb"; java -jar addUser.jar
Enter username: stoker
Enter password:
Retype password:
Exception in thread "main" java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Properties.java:435)
at java.util.Properties.load0(Properties.java:354)
at java.util.Properties.load(Properties.java:342)
at sweb.server.security.LoginProperties.<init>(LoginProperties.java:57)
at sweb.server.security.LoginProperties.getInstance(LoginProperties.java:85)
at sweb.server.security.admin.AddUser.addLoginAndPass(AddUser.java:38)
at sweb.server.security.admin.AddUser.main(AddUser.java:64)


login.properties is still 0 size.

Who is throwing the exception? STOKERWEB_DIR should not be NULL even if I do not set the env var. I thought maybe the password was too short (bbq) so I lengthened it to 5 chars. Username sure can't be NULL. catalina.out shows:

root@celeron:/var/lib/tomcat7/webapps/stokerweb# l ../../logs/catalina.out
-rw-r--r-- 1 tomcat7 root 0 Nov 11 07:35 ../../logs/catalina.out

However in catalina.out.1.gz I find:

Nov 10, 2012 5:19:20 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /var/lib/tomcat7/webapps/stokerweb.war
StokerWebServletConfig...
log4j:WARN No appenders could be found for logger (sweb.server.StokerWebProperti
es).
log4j:WARN Please initialize the log4j system properly.
Error loading stokerWeb.properties, likely caused by error while adding stokerWebDir to classpath

log4j.properties:

log4j.rootLogger=DEBUG, file, stdout

# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=/var/log/stokerweb_app.log
log4j.appender.file.MaxFileSize=10MB
log4j.appender.file.MaxBackupIndex=1
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.properties lines 1-15/15 (END)

and there is a 0 size logfile:

root@celeron:/var/lib/tomcat7/webapps/stokerweb# l /var/log/stokerweb_app.log
-rw-r--r-- 1 root root 0 Nov 10 18:18 /var/log/stokerweb_app.log


Stew
 
I just did the following sequence:
root@celeron:/usr/local/share/stokerweb# touch login.properties
root@celeron:/usr/local/share/stokerweb# java -jar addUser.jar
Enter username: stoker
Enter password:
Retype password:
14:31:33,810 INFO LoginProperties:39 - User: [stoker] added

Since I had added STOKERWEB_DIR to /etc/init.d/tomcat7 and loaded it to the current shell instance I guess addUser.jar needed me to be there. So now I had a login.properties file with a single user, but reloading stokerweb from manager-gui still gives me the not found error that I have been posting. I then did:

root@celeron:/usr/local/share/stokerweb# cp login.properties /var/lib/tomcat7/webapps/stokerweb/

And reloaded again, with the same negative result.

I then undeployed and redeployed and still the same not found error.

/var/lib/tomcat7/logs/catalina.out:

Nov 11, 2012 1:24:43 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/stokerweb] has started
Nov 11, 2012 1:24:44 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/stokerweb] is completed
Nov 11, 2012 2:33:31 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/stokerweb] has started
Nov 11, 2012 2:33:31 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/stokerweb] is completed
Nov 11, 2012 2:34:26 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/stokerweb] has started
Nov 11, 2012 2:34:26 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/stokerweb] is completed
Nov 11, 2012 2:40:10 PM org.apache.catalina.startup.HostConfig checkResources
INFO: Undeploying context [/stokerweb]
Nov 11, 2012 2:40:38 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /var/lib/tomcat7/webapps/stokerweb
 
Last edited:
I've had been having issues, I just wiped out the war file from both my STOKERWEB_DIR and the war file from webapps, including it's directory. Downloaded the new WAR to a different machine and used the manager to deploy from there. I'm thinking I either had some mismatched WAR files or permission issues.

To make things easier, refer to me as Noles. After years of coaching, I'll answer to it.
 
Yeah, I've done that dozens of times with no change in behavior. I have not done any VM stuff since the early days of whatever the 1st VM on Linux, and I've never setup a virtual domain webserver. I am just trying to keep things as simple as possible. The fact that catalina.out reports the deployment but attempting to load http://localhost:8080/stokerweb keeps giving me the same message about /stokerweb/ not being available. I have modified the distro /etc/init.d/tomcat7 to point to both /usr/local/share/stokerweb and /var/lib/tomcat7/webapps/stokerweb with no change in behavior. I am restarting tomcat with each major change and either reloading or redeploying stokerweb each time. /var/log/stokerweb_app.log was created when I first deployed stokerweb at 0 length, and added a line when I finally succeeded in adding a user. mpStokerWebDirstokerweb_app.log is 0 length in both /var/lib/tomcat7/webapps/stokerweb and /usr/local/share/stokerweb.

I am wondering if there is a problem with the version of java, particularly since some java plugins are disabled by firefox. As near as I can tell the only version of java I have installed is openjdk:

root@celeron:/var/lib/tomcat7/webapps/stokerweb# java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.5) (6b24-1.11.5-0ubuntu1~12.04.1)
OpenJDK Server VM (build 20.0-b12, mixed mode)
but tomcat7 shows:

Server Information
Tomcat Version JVM Version JVM Vendor OS Name OS Version OS Architecture Hostname IP Address
Apache Tomcat/7.0.26 1.6.0_24-b24 Sun Microsystems Inc. Linux 3.2.0-32-generic-pae i386 celeron 192.168.1.67
(some of the stuff was not cut by the mouse; it said something about /usr/lib/jvm/java-6-sun)

Could that be an issue? When I look in /usr/lib/jvm I only see openjdk stuff.

Synaptic does not show sun java. Should I get it from Oracle? I wish ubuntu let you choose larger environments instead of wading through an hours worth of java listings in synaptic to see something.
 
I use the jdk from Sun. I can't say the other does not work, since I've never tried it. The Sun jdk just expands to which ever folder it's run in. I set my JAVA_HOME to that.
 
Stew, I also tried to get this running on Ubuntu and finally gave up. I'm very knowledgeable of Windows, but know nothing about Linux and I never could find any documentation that walked me through getting java setup and after trying a few different installs I just went with a Windows 7 VM instead. If you do get it setup and have the time it would be great to get the steps required starting with the Java setup after the initial Ubuntu install.

Thanks,
 
Success! (maybe)

I finally got the stokerweb logo screen up. I have not actually tried the stoker with it because I just got this far.

What I finally did was to set a PPA for oracle java and install oracle-java6-installer using synaptic. That still did not work, so I deleted all of the openjdk stuff with synaptic and stopped tomcat7 and firefox, restarted firefox and then tried to restart tomcat7. I got an error from /etc/init.d/tomcat7 that JAVA_HOME was not set. I added a static value of /usr/lib/jvm/java-6-oracle/ in that file. Made sure that stokerweb.war and not a stokerweb dir existed in /var/lib/tomcat7/webapps/ and started tomcat7. It took several seconds for tomcat to initialize, but when I finally loaded http://localhost:8080/manager/ stokerweb was on the list. I clicked on it, and again it took several seconds for stokerweb to initialize and bring up the logo screen. I guess I will next go out in the freezing weather to setup the stoker in my outdoor kitchen and then I will check several browsers on several devices (IOS4, IOS5, Android ICS tablet with several browsers, windoze exploder, windoze safari, lynx :) and whatever else I can find to throw at it. When I have a complete report then I will write up my instructions and what I think I have learned about compatibility and incompatibility.

Stew
 
Not so quick!

I can only get as far as the logo screen, but it shows no connection at the top even if I login. This is true for FF 16.02 on ubuntu 12.04, as well as opera12.10.xx, epiphany and chromium. lynx did not have javascript and could not run it. ;) On my WinXP SP2 box running new version of FF and old versions of Chrome and Safari I got the same results by entering hostname:8080/stokerweb/ . Exploder (9?) made things much harder by blocking intranet content and then trying to help me by interpolating all sorts of extraneous things. It did finally connect and show the logo. My Toshiba Thrive running ICS was able to connect using FF, but the builtin browser and opera mini wanted to use hostname:8080/stokerweb/ as a search string and even when I added http://hostname:8080/stokerweb/ they would not connect but gave me a search result. On the iphone 3GS with IOS4.x I was completely unsuccessful because the iphone always wants to come in from the internet I think.

Meanwhile nothing has been logged in

-rw-r--r-- 1 tomcat7 tomcat7 0 Nov 13 15:10 mpStokerWebDirstokerweb_app.log

Nothing helpful in the tomcat logs either.

Gary B. Any idea where else to look or what else to look for?


Stew
 
Glad to see you're getting further.

If you get the stoker-web page in the not connected state, then it's a connection issue between stoker-web and the stoker. Are you able to get the json response form the stoker from your ubuntu machine? http://<stokerIP>/stoker.json. Stoker-web will check that page first to throw up the not-connected status.

You should at least see the stdout from stoker-web in the catalina.out file in the logs directory. I'll look up passing in the log4j configuration options into tomcat to see if you can get a stoker-web out log. That will be key given your current problem.
 
It is still freezing outside here at 11:00AM. I did not think to hit json when I had the stoker up yesterday. I will try that later today. I was periodically checking the stoker by simply hitting the webpage, since the stoker frequently has to be restarted several times to get an IP connection from the wireless adapter. I was also running stokerlog. Could that have been a problem?

I do not see anything obvious in catalina.out. A couple of years ago I worked for a couple of months trying to create a perl script that would create a logfile that I could feed to gnuplot. I got defeated by my inability to figure out how to deal with the fact that stoker json output does not maintain slots for unconnected probes. I gave up at that point. I do have a sample json output from that exercise:

{"stoker":{"sensors":[{"id":"DD000012591D2830","name":"Turkey","al":0, \
"ta":170,"th":32,"tl":32,"tc":66.1,"blower":null},
{"id":"38000012592A9930","name":"Pit","al":0,"ta":250,"th":32,"tl":32, \
"tc":65.8,"blower":null}],
"blowers":null}}

Is that the sort of thing I should see in catalina.out? When I deployed stokerweb.war the last time it unpacked a huge mpStokerWebDirstokerweb_app.log that had a lot if information in it. I overwrote it with /usr/local/share/stokerweb/mpStokerWebDirstokerweb_app.log partially to determine if my instance of stokerweb was logging to it.

Is there someplace to enter values for my probe and fan ID's?

Oh yeah, I have an old white stoker running firmware 2.6.0.254.

It would really be nice to have some kind of stokerweb debug log that I could look through. Is there some way to capture stderr to a file?

Even better would be if I could run stokerweb standalone without the webserver in the way.


Stew
 
A few minutes ago, running without stokerlog also going:

[]http://hostname/stoker.json:[/]

{"stoker":{"sensors":[{"id":"260000125918C830","name":"Food3","al":0,"ta":300,"th":32,"tl":32,"tc":32.9,"blower":null},
{"id":"DD000012591D2830","name":"Food1","al":0,"ta":300,"th":32,"tl":32,"tc":33.4,"blower":null},
{"id":"38000012592A9930","name":"Fire","al":0,"ta":27.5,"th":32,"tl":32,"tc":34,"blower":"0E00000026A53605"}],
"blowers":[{"id":"0E00000026A53605","name":"Blower","on":0}]}}

(Meanwhile the IP address of the wireless adapter and stoker were swapped from yesterday, so I had to edit stokerweb.properties in both locations since I am not sure which one is actually being used.)

Now when I look at catalina.out I see hundreds of lines of output since reloading stokerweb at 16:53 today. The output starts on line 201977 and continues to line 203752. Much of the early part of that contains messages about thread that are left open that could lead to severe leaks. Did I read something in this BBS thread about that being part of the design so you can dynamically detach and attach the stoker. Those messages continue until line 202352.

The next set of messages have to do with config'ing the servlet. log4j was unable to open the logfile because I forgot to chown the file to tomcat7.

Then a lot of noise because I thought the stoker was at one IP while it had swapped with the wireless adapter (I thought wireless to enet adapters were supposed to give up their IP to the connected equipment. Is that called bridge mode?).

Line 203220 it tries to connect to the correct IP and gives more promising output. It successfully gets the probe and fan IDs. Then it gets to line 203267 and logs:

16:55:09,466 ERROR StokerWebConfiguration:303 - Stokerweb config file [/usr/local/share/stokerweb/CookerConfig.json] was not found
java.io.FileNotFoundException: /usr/local/share/stokerweb/CookerConfig.json (No such file or directory)

Do I need to create that file? Or just make /usr/local/share/stokerlog owned by tomcat7
Next I get log output of the connection to yahoo for weather. It runs from line 203323-203441 with what look like a lot of successful messages passed back and forth with yahoo. Then it throws a couple of 404's:

<< "<div id="ygma"><a href="http://us.rd.yahoo.com/404/*http://www.yahoo.com"><img src=http://l.yimg.com/a/i/yahoo.gif width=147 height=31 border=0 alt="Yahoo!"></a><div><a href="http://us.rd.yahoo.com/404/*http://www.yahoo.com">Yahoo!</a> - <a href="http://us.rd.yahoo.com/404/*http://help.yahoo.com">Help</a></div></div><div id="bd"><p>The requested URL was not found on this server.</p>[\n]"
16:55:10,168 DEBUG wire:63 - << "<p>Please check the URL for proper spelling and capitalization. If[\n]"
16:55:10,168 DEBUG wire:63 - << "you're having trouble locating a destination on Yahoo!, try visiting the[\n]"
16:55:10,168 DEBUG wire:63 - << "<strong><a[\n]"
16:55:10,168 DEBUG wire:63 - << "href="http://us.rd.yahoo.com/404/*http://www.yahoo.com">Yahoo! home[\n]"
16:55:10,169 DEBUG wire:63 - << "page</a></strong> or look through a list of <strong><a[\n]"
16:55:10,169 DEBUG wire:63 - << "href="http://us.rd.yahoo.com/404/*http://docs.yahoo.com/docs/family/more/">Yahoo!'s[\n]"
16:55:10,169 DEBUG wire:63 - << "online services</a></strong>. Also, you may find what you're looking for[\n]"
16:55:10,169 DEBUG wire:63 - << "if you try searching below.</p>[\n]"

then a reported failure to fetch weather. Then repeat most of the whole weather thing.

I never do get a display of anything except the logo and some of the buttons, including [sign-in] which has seemed to work from the 1st time I got the logo to display.

As I am coming to know what to look for, I found tini login and probe reporting in yesterday's log too. After I finished most of the above message I closed and then reopened catalina.out and found reports of the fan waking up stokerweb just a few minutes ago. So it looks like stoker and stokerweb may actually be talking but no output of graphs or gauges is getting to the firefox screen. Could I be missing some sort of required plugin?

EDIT:

I just did a chown tomcat7:tomcat7 to /usr/local/share/stokerweb and touched /usr/local/share/stokerweb/CookerConfig.json and also did a chown to it. Now I get a different error in catalina.out:

18:07:50,394 ERROR StokerWebConfiguration:317 - IO Exception reading stokerweb config file [/usr/local/share/stokerweb/CookerConfig.json]
java.io.EOFException: No content to map to Object due to end of input
at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2775)

This is right after he tells me the IDs of all the probes and the format of the data.

Still no output to [pre]http://localhost:8080/stokerweb[/pre] except logo page.

What is the proper way to mark a url so it does not show as a link?


Stew
 
Hey Stew,

The missing CookerConfig.json is ok. you should be presented the configuration screen if that file is found to be missing.

Rename the log4j.properties.orig file and remove the .orig. Copy the file to the webapps/stokerweb/WEB-INF/classes directory which tomcat expanded for you. =Delete your catalina.out file, restart stoker-web, give it a minute to start and then email me both the catlalina.out file and the stokerweb.out file.

Thanks
 

 

Back
Top