Oppure

Loading
17/02/09 15:39
ingnuccio
Sto utilizzando un offuscatore per cercare di proteggere i file class, in rete ho visto che il più consigliato è proGuard. Dopo aver settato il tutto l'offuscatore mi tira fuori il file jar, però quando mando in esecuzione il programma va in errore. Dall'errore il problema è relativo al fatto che utilizzo RMI!
Nella guida su proGuard ho trovato la seguente:

Reportedly, the easiest way to handle RMI code is to process the code with ProGuard first and then invoke the rmic tool. If that is not possible, you may want to try something like this:

-keepattributes Exceptions

-keep interface * extends java.rmi.Remote {
<methods>;
}

-keep class * implements java.rmi.Remote {
<init>(java.rmi.activation.ActivationID, java.rmi.MarshalledObject);
}

The first -keep option keeps all your Remote interfaces and their methods. The second one keeps all the implementations, along with their particular RMI constructors, if any.

The Exceptions attribute has to be kept too, because the RMI handling code performs introspection to check whether the method signatures are compatible.

Ora io sto utilizzando la gui di proGuard, sono andato in Shrinking ed ho spuntato l'opzione:

RMI interfaces ed RMI implementantions aggiungendo le classi relative!! Ma ugualmente il programma va in errore!!!

Questo è l'errore:

17-feb-2009 16.25.26 server.grafica.ServerInitFrame <init>
GRAVE: null
java.rmi.server.ExportException: remote object implements illegal remote interface; nested exception is:
java.lang.IllegalArgumentException: illegal remote method encountered: public abstract boolean interfacce.IDatabase.connetti()
at sun.rmi.server.UnicastServerRef.exportObject(Unknown Source)
at java.rmi.server.UnicastRemoteObject.exportObject(Unknown Source)
at java.rmi.server.UnicastRemoteObject.exportObject(Unknown Source)
at java.rmi.server.UnicastRemoteObject.<init>(Unknown Source)
at java.rmi.server.UnicastRemoteObject.<init>(Unknown Source)
at server.dipacam.Database.<init>(Unknown Source)
at server.dipacam.c.<init>(Unknown Source)
at server.grafica.ServerInitFrame.<init>(Unknown Source)
at server.grafica.a.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: illegal remote method encountered: public abstract boolean interfacce.IDatabase.connetti()
at sun.rmi.server.Util.checkMethod(Unknown Source)
at sun.rmi.server.Util.getRemoteInterfaces(Unknown Source)
at sun.rmi.server.Util.getRemoteInterfaces(Unknown Source)
at sun.rmi.server.Util.createProxy(Unknown Source)
... 17 more
Uncaught error fetching image:
java.lang.NullPointerException
at sun.awt.image.URLImageSource.getConnection(Unknown Source)
at sun.awt.image.URLImageSource.getDecoder(Unknown Source)
at sun.awt.image.InputStreamImageSource.doFetch(Unknown Source)
at sun.awt.image.ImageFetcher.fetchloop(Unknown Source)
at sun.awt.image.ImageFetcher.run(Unknown Source)

Qualcuno ha qualche soluzione? Sicuramente sbaglio io in qualcosa perchè non ho mai utilizzato proGuard e questa è la prima volta!

Altrimenti mi potete proporre un offuscatore che magari già utilizzate?

Da premettere che nella mia applicazione utilizzo come tecnologie: RMI, HSQLDB come database, Jasper report per fare i report di stampa, e bouncycastel per la crittografia.

Grazie a chiunque possa darmi un aiuto

Grazie
aaa
18/02/09 17:10
eddiewrc
macchè offuscare... open source e licenza libera!:k:
aaa
18/02/09 18:07
ingnuccio
Postato originariamente da eddiewrc:

macchè offuscare... open source e licenza libera!:k:


Uhm però questo è un software bello grosso!! Ci ho lavorato su un paio di mesetti!! E sinceramente non mi va che arriva il furbetto di turno fa un reverse engineering fa suo il programma e lo vende pure!

O sbaglio?
aaa
19/02/09 9:48
eddiewrc
1. se parliamo di software open source non serve fare reverse niente... semplicemente i sorgenti sono disponibili
2. rilascialo sotto licenza GNU GPL, la proprietà intelletuale è tua e lo puoi anche vendere!
aaa
22/02/09 17:24
netarrow
premetto che non ho mai usato un ofuscatore.
però guardando gli errori che ti da, come mai i nomi delle classi e dei metodi sono comprensibili?non è che hai offuscato metà programma (ad esempio la parte server) e non l'altra metà e quindi alcuni nomi non tornano?

Inoltre il suggerimento che ti viene dato nella documentazione:
Reportedly, the easiest way to handle RMI code is to process the code with ProGuard first and then invoke the rmic tool.

Hai seguito questa indicazione? perchè rmic genera la stub se non ricordo male, quindi se generi la stub partendo dal codice normale e poi offuschi magari si creano delle incongruenze.


aaa
17/03/09 12:07
ingnuccio
grazie a tutti, alla fine ho risolto non utilizzando l'offuscatore :k:
aaa