Forums > Java

error: connect: outlet 2 of mxj out of range

January 5, 2008 | 10:39 pm

Hi,

It’s been a few months since I’ve been under the hood of this patch -
please forgive me if my terminology is a bit rusty.

I have one of Tim Bitson’s
(http://www.timbitson.com/Weather_Projects.html) weather stations
sending data into max through java/mxj. If I can get the class/object
to load properly, it works great. Here’s the problem:

1. Plug in the USB weather station
2. Boot up the computer (Mac PPC 10.4.11)
3. Open the "weather" patch in max (4.6.3)
4. The patch opens but shows these errors:

error: connect: outlet 2 of mxj out of range
error: connect: outlet 3 of mxj out of range
error: connect: outlet 4 of mxj out of range
error: connect: outlet 5 of mxj out of range
error: connect: outlet 6 of mxj out of range…

Also, I need to send "start" and "stop" messages to the mxj object in
order to start/stop the polling of the sensors.

when I click the message box I get this error:

error: simpleWeather.SimpleWeather doesn’t understand start

5. Here’s the trick… I close max and delete
simpleWeather.SimpleWeather.jar in the classes folder.

6. I rebuild the .jar in netbeans and then place it in the classes folder.

7. I open Max and make a new MXJ object and (beach ball for 2 seconds)
then the object loads perfectly. I close this patch w/o saving.

8. Open the "weather" patch in Max and now it works.

8. ???

9. I’m happy that I can get it to work, but this piece needs to be
installed in a gallery in a few months and I can’t expect the gallery
staff to hack my max patch…

It’s probably a simple oversight on my part as I am only an
accomplished Java hacker and not a programmer. It seems to me that it
is a problem relating to how I am declaring my outlets, or how the
"extends MaxObject implements Runnable" get initiated. However, that
wouldn’t explain why it works fine after a rebuild and replaced in the
classes folder.

I’m not sure what to send along, but have attached the .jar and will
paste the max patch below. As always I deeply appreciate any/all help
with this – hopefully it’s something simple and obvious (usually is).

Note: if I try to open a new patch and make a new mxj object (w/o
rebuilding the .jar) and type in the class simpleWeather.SimpleWeather
- it crashes Max.

THANKS!

Bart

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 161 60 29 196617 stop;
#P message 117 61 33 196617 start;
#P toggle 34 24 15 0;
#P newex 34 44 64 196617 metro 5000;
#P number 190 260 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 244 371 62 196617 prepend set;
#P flonum 351 203 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 386 205 100 196617 Solar;
#P flonum 316 167 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 351 169 100 196617 Lightning;
#P flonum 268 125 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 303 127 100 196617 Rain (inches?);
#P window setfont "Sans Serif" 14.;
#P message 246 403 107 196622 ENE;
#P window setfont "Sans Serif" 9.;
#P message 576 324 30 196617 NNW;
#P message 473 324 22 196617 NW;
#P message 500 324 16 196617 W;
#P message 420 411 32 196617 WSW;
#P message 424 324 22 196617 SW;
#P message 272 324 19 196617 SE;
#P message 196 324 14 196617 E;
#P message 158 324 24 196617 ENE;
#P message 310 324 25 196617 SSE;
#P message 386 324 30 196617 SSW;
#P message 348 324 14 196617 S;
#P message 234 324 24 196617 ESE;
#P message 120 324 19 196617 NE;
#P message 82 324 25 196617 NNE;
#P message 44 324 14 196617 N;
#P newex 179 289 431 196617 sel 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14;
#P flonum 173 229 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 208 231 100 196617 windspeed MPH;
#P flonum 127 186 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 162 188 100 196617 dewpoint degrees F;
#P flonum 82 153 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 117 155 100 196617 humidity%;
#P flonum 35 124 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 35 67 15 0;
#P newex 35 92 379 196617 mxj simpleWeather.SimpleWeather;
#P comment 70 126 120 196617 temperature degrees F;
#P connect 10 12 23 0;
#P connect 10 11 24 0;
#P connect 10 10 21 0;
#P connect 10 9 16 0;
#P connect 1 7 32 0;
#P connect 10 8 15 0;
#P connect 1 6 30 0;
#P connect 10 7 17 0;
#P connect 10 6 20 0;
#P connect 1 5 28 0;
#P connect 33 0 26 0;
#P connect 11 0 33 0;
#P connect 12 0 33 0;
#P connect 13 0 33 0;
#P connect 18 0 33 0;
#P connect 19 0 33 0;
#P connect 14 0 33 0;
#P connect 20 0 33 0;
#P connect 17 0 33 0;
#P connect 15 0 33 0;
#P connect 16 0 33 0;
#P connect 21 0 33 0;
#P connect 22 0 33 0;
#P connect 23 0 33 0;
#P connect 24 0 33 0;
#P connect 25 0 33 0;
#P connect 10 5 14 0;
#P connect 10 4 19 0;
#P connect 1 4 34 0;
#P connect 34 0 10 0;
#P connect 1 3 9 0;
#P connect 10 3 18 0;
#P connect 1 2 7 0;
#P connect 10 2 13 0;
#P connect 10 1 12 0;
#P connect 1 1 5 0;
#P connect 10 0 11 0;
#P connect 1 0 3 0;
#P connect 2 0 1 0;
#P connect 37 0 1 0;
#P connect 38 0 1 0;
#P connect 35 0 2 0;
#P connect 36 0 35 0;
#P window clipboard copycount 39;


January 7, 2008 | 8:54 pm

Update: I was able to get this to work. When the mxj would load w/o the outlets, I put a viewsource message into it and noticed that it was seeing the very first script I authored with that name.

This is strange because this class didn’t exist in the classpath – hadn’t for a long time. In fact, I have no idea where this class was located.

I deleted everything relating to this: the patch, the classes, the Java code… I then started from scratch (rebuilt the Java, imported the .jar into the classpath, etc.) and now it appears to be working quite well.

Anyone know where that old script was lingering? Since it wasn’t in my classpath, how could the mxj see it? and why, after putting in a new class, did max still want to load the old one?

Is there a possibility that my classpath is pointing to somewhere in addition to the classes folder?

bbw


Viewing 2 posts - 1 through 2 (of 2 total)