

This problem has given me serious problems on three different occasions. To summarize the problem, I've created an h:selectOneMenu control on a form. I've set the value attribute to be a property of a Seam component. The value is supposed to serve a bi-directional purpose. If it is non-null when the control is rendered, then the specified value will be selected in the resulting combo box. I haven't had any problems at all getting this to work. The problem is with the other direction. When the user selects a new item in the combo box, the property in the value field is supposed to get set using the class setter for the property.
So, I've had several issues, including just not understanding some things. I will try to document them all here.
- The name specified in the value field should be a Seam component property, NOT a Seam context variable. For example, you should probably be using value="#{myList.selectedValue}" AND NOT value="#{selectedValue}". The first way will call the setSelectedValue() method of the class corresponding to the myList Seam component. The second will get the correct value when rendered, but I don't believe it will result in setting the value when it's changed. But I might be wrong about that.
- The name you specify must equate to a Seam component name (i.e. something specified as @Name("name"). So, in the example above, you would need a class with @Name("myList") that defines a selectedValue property and implements a getter and setter for the selectedValue property. Note that if it's an EJB3.0 bean, then you will also need to define the getter and setter in the corresponding interface.
- Of course, you're probably going to want to promote the changed value to a Seam context, so you'll probably declare the selectedValue property as an outjected context variable by placing an @Out annotation above the property declaration.
- This to me was one of the trickier points that I did not see documented anywhere: the setter method is NOT called when the user selects one of the items in the combo box. Coming from a heavy JavaScript background, I assumed I'd see the setter get called each time I changed the combo box selection. However, instead, the setter is only called when the page goes away. Note, that if you have commandLinks on the page that rerender the page, that will also cause the setter to get called. Hence, the value should remain set after a rerender. The setter gets called whether the destination page is the same page or not. So, if you're debugging and trying to follow along, don't expect the setter to get called until a button is pressed.
- This one was also tricky for my JavaScript-addled brain. The valueChangedListener attribute is NOT used to specify a method that gets called when the user selects a new item. The valueChangedListener only gets called when the property value changes.
- Now for the most tricky point of all. THE selectOneMenu control MUST RESIDE IN THE SAME FORM AS THE BUTTON WHICH IS USED TO EXIT THE PAGE!!! I spent about eight hours trying to figure this one out. My page had two separate forms, one of them for my wizard-style buttons (because they are defined in a template.xhtml). I finally discovered the cause of the problem when I realized that one button on the page that just did a reselect of data for the combo box DID result in calling the setter, but the other button (to go to the next page) DID NOT!!. Once I put all the buttons into the same form as the combo box, it worked perfectly.
It seems that if you are seeing this message, something is wrong with your JBoss installation. I ended up getting this error message after a weird sequence of events. First, my computer completely froze up on me -- like a memory problem or something. My application was running in JBoss (through eclipse) at the time. Then, after turning the computer off and back on, I repeatedly got an error when I tried to start JBoss that port 1098 was already in use (I documented the fix for this in another entry: "Port already in use: 1098").
Once I fixed the port problem, I started getting the already installed mbean error. A little research showed that I needed to try either reinstalling JBoss, or messing around with stuff in the deployment directory (the JBoss deployment directory, not the eclipse one). So, I deleted a few folders in there. Then the error went away, but JBoss wouldn't start because it needed those folders. I was able to fix this problem by retrieving the folders from a backup location. Then everything worked fine again.
I wouldn't really recommend this approach. Probably better to resinstall JBoss if you have this problem and can't easily make it go away. The first thing you might check for is if you have your application EAR deployed in both the eclipse deployment location and the JBoss server deployment location.
JBoss tries to use port 1098. But there is nothing preventing another application from using it if it finds it first. I actually had a bit torrent using the port. I disabled the torrent and jboss started fine.
I discovered the application that was using the port by typing netstat -b from the command line in Windows XP. I understand this command only works in XP. Look around to find something similar if you're not on XP.
One condition that causes this error is if JBoss was shut down improperly (or if it's still running). In that case, you might just want to reboot.
There is a way to reserve port numbers so that other applications don't use them. Also, it is possible to change the port number that JBoss uses. You can read the directions to do either of these here.
By
default a Seam application (from seam-gen) or copied from a sample, will
display a welcome message on the first post-login screen. To change or remove
this message, edit the messages_en.properties file (and any other translated
message files). Find the entry for:
org.jboss.seam.loginFailed
and either change it to an empty string to remove the message, or to whatever welcome
message you want. Note that when I tried this, the change WAS NOT
hot-deployable. I had to restart the app server to get the message to go away.
The message resource files can be found in rCMS/src (where rCMS is the name of
my project).