BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 02-13-2007, 05:15 AM   #1 (permalink)
New Member
 
Join Date: Feb 2007
Model: 8800
Posts: 4
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with code that supposedly need signing

Please Login to Remove!

Hi,

I´m developing an application for blackberry. In the simulator, the application runs good but, when I deploy it in the Blackberry device, It says: "Error starting <app>: Module <app> must be signed with the RIM Runtime Code Signing Key (RRT)".

I´ve readed the documentation about Signed APIs on the blackberry website and I´ve looking for signed classes on my code; I´ve not used any signed class on my code. Furthermore, when I´ve compiled my blackberry application with the JDE (version 4.1 and 4.2), the compiler didn´t show any message concerning to the signing process. In fact, if I open my .cod file with the Signature Tool, and all the rows are "Not Requiered" signature; specifically, the row signerID RRT is in "Not Required" status.

What can I do? Somebody could help me?

Thanks in advance.
Offline  
Old 02-13-2007, 05:48 AM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2007
Model: 8800
Carrier: Orange
Posts: 181
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

The signature tool will say Not Required if you don't have the keys installed (at least it used to for me).

It may be that you are importing a package that includes signed classes. If so change them to only include the specific classes that you require.

I'd keep stripping the application down until it works and then you know what class is causing the problem.
Offline  
Old 02-13-2007, 06:10 AM   #3 (permalink)
New Member
 
Join Date: Feb 2007
Model: 8800
Posts: 4
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your fast response, bdowling.

All the imports in my application are specific imports to classes, never to general packages. In any case, I will try to stripping the application down until it works.

If somebody has had the same problem and could help me, I will be very grateful to her.
Offline  
Old 02-13-2007, 06:52 AM   #4 (permalink)
New Member
 
Join Date: Feb 2007
Model: 8800
Posts: 4
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi again:

I´ve isolated the code that supposedly need singning. Without this class, the code runs (but it haven´t any funcionality):

Code:
import java.io.IOException;
import java.io.InputStream;

import javax.microedition.io.Connector;
import javax.microedition.io.StreamConnection;


/**
 * 
 * Clase auxiliar que maneja las conexiones HTTP al servidor de aplicaciones que provee
 * de la capa de datos a la aplicación. 
 * 
 * @author vferrer
 *
 */
public class ConnectionThread extends Thread implements Observable {

	private static final int TIMEOUT = 500; //tiempo en ms para un TIMEOUT
	
	//Lista de Observadores: clases que esperan la notificación de esta clase
	private Observer observer;
	
	//Constantes válidas para el protocolo HTTP
    private static final String[] HTTP_PROTOCOL = {"h t t p ://", "h t t p :\\"};
    
    private String theURL;

    private volatile boolean startThread = false;
    private volatile boolean stopThread = false;

    public ConnectionThread() {
    	
    }
    
    /**
     * Obtiene la URL sobre la que está trabajando el hilo. Es un método sincronizado
     * dado que sólo un hilo puede acceder a la URL al mismo tiempo. 
     * 
     * @return la URL sobre la que está trabajando el hilo
     */
    public synchronized String getUrl() {
        return theURL;
    }

    /**
     * Establece la URL sobre la que trabajará el hilo y lanza su ejecución, poniendo
     * a true la bandera de comienzo del Thread
     * 
     * @param url la URL sobre la que debe trabajar el hilo 
     */
    private void fetch(String url) {
        startThread = true;
        theURL = url;
    }

    /**
     * Cierra el hilo. Para ello, pone a true la bandera de parada del Thread
     */
    public void stop() {
    	stopThread = true;
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Thread#run()
     */
    public void run() {
    	for(;;) {
    		//control del thread -> duerme el hilo si no tiene que operar 
    		while(!startThread && !stopThread) {
    			try {
    				sleep(TIMEOUT);
    			} catch (InterruptedException e) {
    				System.err.println(e.toString());
                }
    		}
            
    		//Condición de salida -> Termina el hilo
            if (stopThread) {
            	return;
            }
           
            //Obtención de los datos desde la conexión HTTP correspondiente
            synchronized(this) {
            	//Abrimos la conexión H T T P y extraemos los datos
            	StreamConnection s = null;
             	try {
             		s = (StreamConnection) Connector.open(getUrl());
             		InputStream input = s.openInputStream();

             		byte[] data = new byte[256];
             		int len = 0;
             		StringBuffer raw = new StringBuffer();
             		while (-1 != (len = input.read(data))) {
             			raw.append(new String(data, 0, len));
                    }   

             		//Convierte los datos crudos en un String                                 
             		String text = raw.toString();

             		//Dado que ya tenemos os datos, avisamos al Observador	
             		notifyObservers(text);
             		
             		//Cerramos el stream de entrada
             		input.close();

             		//Cerramos el stream de la conexión
             		s.close();
             	} catch (IOException e) {
             		//En caso de excepción, logueamos y notificamos al Observador con el texto de la Excepción
             		System.err.println(e.toString());
             		notifyObservers(e.toString());
             	}
             	
             	//Reseteamos el estado del hilo, para que se quede dormido
             	startThread = false;
            }
    	}
    }
    
    /**
     * Valida la URL sobre la que se desea trabajar y delega en el método fetch()
     * 
     * @param url la URL sobre la que el hilo trabajará
     */
    public void fetchPage(String url) {
        //Normaliza la URL (pasando a minúsculas) 
        String lcase = url.toLowerCase();
        boolean validHeader = false;
        int i = 0;

        //Comprueba que la dirección contiene alguna de las cadenas identificadoras de
        //una URL válida
        for (i = H T T P_PROTOCOL.length - 1; i >= 0; --i) {
            if (-1 != lcase.indexOf(H T T P_PROTOCOL[i])) {
                validHeader = true;
                break;
            }
        }
        
        //En caso de que la dirección no fuera válida, le agrega el identificador de 
        //URL válida
        if (!validHeader) {
            url = H T T P_PROTOCOL[0] + url; 
        }

        //Delega en este método
        fetch(url);
    }

    /*
     * (non-Javadoc)
     * @see es.none.blackberry.Observable#addObserver(es.inicom.blackberry.Observer)
     */
	public void addObserver(Observer observer) {
		this.observer = observer;	
	}

	/*
	 * (non-Javadoc)
	 * @see es.none.blackberry.Observable#notifyObservers(java.lang.Object)
	 */
	public void notifyObservers(Object object) {
		observer.update(this, object);
	}
}
(The white spaces on the string "HTTP" are needed to post the message in this forum)

Observable / Observer are two interfaces defined by me to implement the pattern "Observer/Observable".

Do you think this code need signing?

Thanks.
Offline  
Old 02-13-2007, 12:40 PM   #5 (permalink)
New Member
 
Join Date: Feb 2007
Model: 8800
Posts: 4
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I´ve been isolated the code that throws the message "Error starting <app>: Module <app> must be signed with the RIM Runtime Code Signing Key (RRT)". It is the code:

Code:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setIgnoringElementContentWhitespace(true);
Document document = null;
That code is relative to the XML implementation from the W3C´s DOM Specification. When that code is commented the application runs on the BlackBerry; and when is discommented, it isn´t run.

The JavaDoc of the RIM Device Java Library for the version 4.1.0 don´t indicates that any of these classes need to be signed. Why do you think the error could occurs? I´m very confused.

Thanks in advance.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright © 2004-2014 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.