Netbeans - Error al generar applet RuntimeException

 
Vista:
Imágen de perfil de Pablo

Error al generar applet RuntimeException

Publicado por Pablo (1 intervención) el 23/08/2017 20:31:53
Hola compañeros, un saludo a todos, vengo por estos rumbos porque necesito de su ayuda y experiencia, habitualmente no utilizo java, me enfoco mas en PHP y otros, pero tengo que hacer un sistema de control biometrico y para controlar el hardware necesito desarrollar un applet en java.

Ya tengo el código y si lo pruebo en netbeans funciona, pero al generar el jar y cargar el applet en un html, me da un error y no se como solucionarlo, el mensaje es el siguiente:


1
2
RuntimeException
java.lang.ExceptionInInitializerError

Espero puedan ayudarme, dejo el codigo de archivo principal para que puedan ver si alli tengo algun error:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package formularioApplet;
 
//import BaseDatos.ConexionBD;
import BaseDatos.ConexionBD;
import com.digitalpersona.onetouch.DPFPDataPurpose;
import com.digitalpersona.onetouch.DPFPFeatureSet;
import com.digitalpersona.onetouch.DPFPGlobal;
import com.digitalpersona.onetouch.DPFPSample;
import com.digitalpersona.onetouch.DPFPTemplate;
import com.digitalpersona.onetouch.capture.DPFPCapture;
import com.digitalpersona.onetouch.capture.event.DPFPDataAdapter;
import com.digitalpersona.onetouch.capture.event.DPFPDataEvent;
import com.digitalpersona.onetouch.capture.event.DPFPErrorAdapter;
import com.digitalpersona.onetouch.capture.event.DPFPErrorEvent;
import com.digitalpersona.onetouch.capture.event.DPFPReaderStatusAdapter;
import com.digitalpersona.onetouch.capture.event.DPFPReaderStatusEvent;
import com.digitalpersona.onetouch.capture.event.DPFPSensorAdapter;
import com.digitalpersona.onetouch.capture.event.DPFPSensorEvent;
import com.digitalpersona.onetouch.processing.DPFPEnrollment;
import com.digitalpersona.onetouch.processing.DPFPFeatureExtraction;
import com.digitalpersona.onetouch.processing.DPFPImageQualityException;
import com.digitalpersona.onetouch.verification.DPFPVerification;
import com.digitalpersona.onetouch.verification.DPFPVerificationResult;
import java.awt.Image;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import static java.util.logging.Level.SEVERE;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
 
/**
*
* @author Samo
*/
public class CapturaHuellaApplet extends javax.swing.JApplet {
 
/**
* Initializes the applet CapturaHuellaApplet
*/
@Override
public void init() {
Iniciar();
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(CapturaHuellaApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(CapturaHuellaApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(CapturaHuellaApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(CapturaHuellaApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
 
/* Create and display the applet */
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
initComponents();
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
}
 
//Atributos necesarios para el manejo de huellas digitales
private DPFPCapture Lector = DPFPGlobal.getCaptureFactory().createCapture();
private DPFPEnrollment Reclutador = DPFPGlobal.getEnrollmentFactory().createEnrollment();
private DPFPVerification Verificador = DPFPGlobal.getVerificationFactory().createVerification();
private DPFPTemplate template;
public static String TEMPLATE_PROPERTY = "template";
public DPFPFeatureSet featuresinscripcion;
public DPFPFeatureSet featuresverificacion;
 
ConexionBD con = new ConexionBD();
 
//Metodo que ejecuta todas las acciones del lector de huellas
protected void Iniciar(){
Lector.addDataListener (new DPFPDataAdapter(){
@Override public void dataAcquired(final DPFPDataEvent e){
SwingUtilities.invokeLater(new Runnable(){
@Override public void run(){
EnviarTexto("La huella digital ha sido capturada");
ProcesarCaptura(e.getSample());
}
});
}
});
 
Lector.addReaderStatusListener(new DPFPReaderStatusAdapter(){
@Override public void readerConnected(final DPFPReaderStatusEvent e){
SwingUtilities.invokeLater(new Runnable(){
@Override public void run(){
EnviarTexto("El sensor de huella digital esta activado o conectado");
}
});
}
@Override public void readerDisconnected(final DPFPReaderStatusEvent e){
SwingUtilities.invokeLater(new Runnable(){
@Override public void run(){
EnviarTexto("El sensor de huella dibgital esta desactivado o no conectado");
}
});
}
});
 
Lector.addSensorListener(new DPFPSensorAdapter(){
@Override public void fingerTouched(final DPFPSensorEvent e){
SwingUtilities.invokeLater(new Runnable(){
@Override public void run(){
EnviarTexto("El dedo ha sido colocado sobre el lectorde de huellas");
}
});
}
@Override public void fingerGone(final DPFPSensorEvent e){
SwingUtilities.invokeLater(new Runnable(){
@Override public void run(){
EnviarTexto("El dedo ha sido quitado del lector de huellas");
}
});
}
});
 
Lector.addErrorListener(new DPFPErrorAdapter(){
public void errorReader(final DPFPErrorEvent e){
SwingUtilities.invokeLater(new Runnable(){
@Override public void run(){
EnviarTexto("Error: "+e.getError());
}
});
}
});
} //Fin metodo iniciar
 
//Aqui se obtiene la informacion de la huella dgital
public DPFPFeatureSet extraerCaracteristicas(DPFPSample sample, DPFPDataPurpose purpose){
DPFPFeatureExtraction extractor = DPFPGlobal.getFeatureExtractionFactory().createFeatureExtraction();
 
try{
return extractor.createFeatureSet(sample, purpose);
} catch(DPFPImageQualityException e){
return null;
}
}
 
public void ProcesarCaptura(DPFPSample sample){
featuresinscripcion = extraerCaracteristicas(sample, DPFPDataPurpose.DATA_PURPOSE_ENROLLMENT);
featuresverificacion = extraerCaracteristicas(sample, DPFPDataPurpose.DATA_PURPOSE_VERIFICATION);
 
if (featuresinscripcion != null)
try{
System.out.println("Las caracteristicas de la huella");
Reclutador.addFeatures(featuresinscripcion);
 
Image image = CrearImagenHuella(sample);
DibujarHuella(image);
 
// BtnVerificar.setEnabled(true);
// BtnIdentificar.setEnabled(true);
 
}catch(DPFPImageQualityException ex){
System.err.println("Error: "+ex.getMessage());
}finally{
EstadoHuellas();
 
switch(Reclutador.getTemplateStatus()){
case TEMPLATE_STATUS_READY:
stop();
setTemplate(Reclutador.getTemplate());
EnviarTexto("La plantilla de la huella ha sido creada, ya puede verificarla o identificarla");
// btnIdentificar.setEnabled(false);
// btnVerificar.setEnabled(false);
btnGuardar.setEnabled(true);
btnGuardar.grabFocus();
break;
 
case TEMPLATE_STATUS_FAILED:
Reclutador.clear();
stop();
EstadoHuellas();
setTemplate(null);
// JOptionPane.showMessageDialog(CapturaHuellaApplet.this, "La plantilla de la huella no pudo ser creada, repita el proceso.");
start();
break;
}
}
}
 
public Image CrearImagenHuella(DPFPSample sample){
return DPFPGlobal.getSampleConversionFactory().createImage(sample);
}
 
public void DibujarHuella(Image image){
lblImagenHuella.setIcon(new ImageIcon(
image.getScaledInstance(lblImagenHuella.getWidth(),
lblImagenHuella.getHeight(),
image.SCALE_DEFAULT
)
));
repaint();
}
 
public void EstadoHuellas(){
EnviarTexto("Muestra de huellas necesarias para guardar template "+Reclutador.getFeaturesNeeded());
}
 
public void EnviarTexto(String string){
txtArea.append(string + "\n");
}
 
public void start(){
Lector.startCapture();
EnviarTexto("Utilizando el lector de huella dactilar");
}
 
public void stop(){
Lector.stopCapture();
EnviarTexto("No se esta usando el lector de huella dactilar");
}
 
public DPFPTemplate getTemplate(){
return template;
}
 
public void setTemplate(DPFPTemplate template){
DPFPTemplate old = this.template;
this.template = template;
firePropertyChange(TEMPLATE_PROPERTY, old, template);
}
 
public void guardarHuella() throws SQLException{
ByteArrayInputStream datosHuella = new ByteArrayInputStream(template.serialize());
Integer tamanoHuella = template.serialize().length;
String nombre = JOptionPane.showInputDialog("Nombre:");
 
try{
Connection cn = con.conectar();
PreparedStatement guardarStmt = cn.prepareStatement("INSERT INTO somhue(huenombre,huehuella) values (?,?)");
guardarStmt.setString(1,nombre);
guardarStmt.setBinaryStream(2, datosHuella, tamanoHuella);
guardarStmt.execute();
guardarStmt.close();
JOptionPane.showMessageDialog(null, "Huella guardada correctamente");
con.desconectar();
btnGuardar.setEnabled(false);
//btnVerificar.grabFocus();
}catch(SQLException ex){
System.err.println("Error al guardar los datos de la huella.");
}finally{
con.desconectar();
}
}
 
public CapturaHuellaApplet() {
/* try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Imposible modificar el tema visual", "Lookandfeel invalido.",
JOptionPane.ERROR_MESSAGE);
}

initComponents();*/
}//*/
 
/**
* This method is called from within the init() method to initialize the
* form. WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
 
jPanel1 = new javax.swing.JPanel();
lblImagenHuella = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
btnGuardar = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
txtArea = new javax.swing.JTextArea();
 
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED), "Huella digital", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));
 
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(lblImagenHuella, javax.swing.GroupLayout.PREFERRED_SIZE, 340, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(22, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(lblImagenHuella, javax.swing.GroupLayout.DEFAULT_SIZE, 231, Short.MAX_VALUE)
.addContainerGap())
);
 
jPanel2.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
 
btnGuardar.setText("Guardar huella");
btnGuardar.setEnabled(false);
btnGuardar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnGuardarActionPerformed(evt);
}
});
 
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnGuardar)
.addGap(143, 143, 143))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(24, 24, 24)
.addComponent(btnGuardar)
.addContainerGap(25, Short.MAX_VALUE))
);
 
txtArea.setColumns(20);
txtArea.setRows(5);
jScrollPane1.setViewportView(txtArea);
 
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE))
);
}// </editor-fold>
 
private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
try{
guardarHuella();
Reclutador.clear();
lblImagenHuella.setIcon(null);
start();
}catch(SQLException ex){
Logger.getLogger(CapturaHuellaApplet.class.getName()).log(Level.SEVERE,null,ex);
}
}
 
 
// Variables declaration - do not modify
private javax.swing.JButton btnGuardar;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JLabel lblImagenHuella;
private javax.swing.JTextArea txtArea;
// End of variables declaration
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Error al generar applet RuntimeException

Publicado por mirog (1 intervención) el 31/10/2017 03:36:35
hola, tengo el mismo problema, lograste solucionarlo?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar