This is another in the occasional series of meta or recursive posts prompted by the appearance of a specific query in the list of search terms used by people who have ended up here, despite the fact that I have not written about it.
In this case the query is the gnomic
No MIDlet-<n> registration
It looks as though it is probably an error message and it turns out that it is.
Like the subject of this post, it originates in the company formerly known as SUN‘s MIDP implementation.
If you do this at runtime
PushRegistry.registerConnection("socket://:8888", "xper.midlet.Lamiel", "*")
but the only thing in the JAD and/or JAR manifest of your MIDlet suite is this
MIDlet-1: UsefulMIDlet, UsefulMIDletIcon.png, xper.midlet.Colgrevance
and you are using the TCFKAS MIDP implementation then you will get a ClassNotFoundException with the message
No MIDlet-<n> registration
even if the MIDlet suite JAR contains the class xper.midlet.Lamiel
Why ?
Because, as it says, in the documentation
The named MIDlet MUST be registered in the application descriptor or the JAR manifest with a
MIDlet-<n>
record.
Adding something like this
MIDlet-2: PushableMIDlet, PushableMIDletIcon.png, xper.midlet.Lamiel
to the JAD and/or JAR manifest of the MIDlet suite in the example above would fix the problem.
The same problem, but not the same error message, occurs with static registration.
If the JAD and/or JAR manifest of the MIDlet suite only specifies these attributes
MIDlet-1: UsefulMIDlet, UsefulMIDletIcon.png, xper.midlet.Colgrevance
MIDlet-Push-1: socket://:8888, xper.midlet.Lamiel, *
then the MIDlet suite will not install.
As before, the second MIDlet needs to be registerd
MIDlet-1: UsefulMIDlet, UsefulMIDletIcon.png, xper.midlet.Colgrevance
MIDlet-2: PushableMIDlet, PushableMIDletIcon.png, xper.midlet.Lamiel
MIDlet-Push-1: socket://:8888, xper.midlet.Lamiel, *
Note that the ordinals of the
MIDlet-<n>
and
MIDlet-Push-<n>
attributes do not have to match, they identify the attributes not the MIDlets.
Copyright (c) 2011 By Simon Lewis. All Rights Reserved.
jad or manifest
MIDlet-1: MyProg,icon.png,com.MyProg
MIDlet-Name: MyProg
MIDlet-Push-1: sms://:55000,com.MyProg,*
the code works fine with most of Samsung mobiles but it gives me java.lang.ClassNotFoundException: No MIDlet- registration Exception when i trying to PushRegistry.registerConnection on Samsung B7722 and this is a dual SIMs mobile ….i test the code on tow other dual SIMs Samsung mobiles and the prog doesn’t work … would you please give me your opinion in this ?
Comment by Rasha Saeed — May 29, 2011 @ 12:03 pm
I guess the question is what are you trying to do with the call to PushRegistry.registerConnection() ? You have already registered one connection statically via the JAD/Manifest attributes. Are you trying to register another connection for the same MIDlet or another one ?
Comment by Simon Lewis — June 6, 2011 @ 7:25 pm
1st of all .. i would like to thank you for your replay
about the code
//---------------------------------------------------------------------------------
public static void check_push_registry() {
// push registry
String[] connections = PushRegistry.listConnections(false);
if (connections.length == 0) {
try {
PushRegistry.registerConnection("sms://:" + MyProg.port, MyProg.class.getName(), "*");
} catch (ClassNotFoundException e) {
LogForm.log(e, "MyMobile line 40");
} catch (IOException e) {
LogForm.log(e, "MyMobile line 42");
}
}
}
//---------------------------------------------------------------------------------
check_push_registry() is called when the program starts to check if there is any registered connection or not
my question is: “Is the 3 wrote lines in the jad or manifest enough for register a push registry?” so i should remove the check_push_registry() function and there is no need for “PushRegistry.registerConnection(“sms://:” + MyProg.port, MyProg.class.getName(), “*”);” line to be written in the code???
Comment by Rasha — June 7, 2011 @ 12:26 pm
Static registration of the push connection using a MIDlet-Push- entry should be sufficient, so you should not have to attempt to register the same push connection dynamically using a call to PushRegistry.registerConnection().
Having said that there are two situations where the static registration might fail, either if the MIDlet suite does not have the necessary permissions, or where the protocol is either not supported or push is not supported for that protocol. However, in either case failure to successfully register the push connection should result in the MIDlet suite itself not being installed.
If your static push registration does not succeed but the MIDlet suite still installs then the underlying MIDP implementation is broken. The documentation states quite clearly
If all the static Push declarations in the application descriptor can not be fulfilled during the installation, the user MUST be notified that there are conflicts and the
MIDlet suite MUST NOT be installed.
Comment by Simon Lewis — June 8, 2011 @ 6:30 pm
thank you it is solved the proplem
the static registration is enough and there is no need for the dynamic one
there is another request
the application is installed fine on the dual SIM mobile but when the mobile receive a sms msg on the specific port the application opens and ask which SIM i would like to used ( this is not desired) then the msg is lost after choosing any SIM number… as i said before the prog is functioning fine on others non-dual mobiles
would you please give me your opinion in this ?
Comment by rasha — June 15, 2011 @ 12:02 pm