• No se han encontrado resultados

Migración de código en ambientes distribuidos . Plataforma Aglets

N/A
N/A
Protected

Academic year: 2017

Share "Migración de código en ambientes distribuidos . Plataforma Aglets"

Copied!
59
0
0

Texto completo

(1)
(2)

Autor:

 

Garc

Autor:

 

Garc

í

í

a

a

 

 

Mart

Mart

í

í

n,

n,

 

 

Santiago

Santiago

Director:

 

(3)

Índice

Í

Í

ndice

ndice

I.

Definición

 

del

 

Problema

II.

Conceptos

 

Generales

III.

Debug

IV.

Sistema

 

de

 

carga

 

de

 

clases

 

en

 

Java

V.

AgletClassLoader

VI.

Entendiendo

 

la

 

Excepción

VII.

Resolviendo

 

el

 

problema

 

(4)

Información

 

Adicional

Informaci

Informaci

ó

ó

n

n

 

 

Adicional

Adicional

Composición

 

de

 

software

 

para

 

la

 

ejecución

Composici

(5)

I.

Definición

 

del

 

Problema

I.

I.

Definici

Definici

ó

ó

n

n

 

 

del

del

 

 

Problema

Problema

MigrarSitios MigrarSitios ParentAglet ParentAglet Create MigrarSitios MigrarSitios Tarea 1. Execute 2. Results

MigrarSitios

MigrarSitios

Tarea 1. Execute 2. Results

MigrarSitios

MigrarSitios

Tarea 1. Execute 2. Results Last

Destination Trip Code

3.

PC 1

PC 2

PC 3

PC N JVM JVM JVM JVM TAHITI TAHITI TAHITI TAHITI

NextHost

NextHost

NextHost

NextHost

JDK

 

1.5

JDK

 

1.5

(6)

I.

Definición

 

del

 

Problema

I.

I.

Definici

Definici

ó

ó

n

n

 

 

del

del

 

 

Problema

Problema

MigrarSitios MigrarSitios ParentAglet ParentAglet Create MigrarSitios MigrarSitios MigrarSitios MigrarSitios Tarea 1. Execute 2. Results

MigrarSitios

MigrarSitios

Tarea 1. Execute 2. Results Last 

Destination  Trip Code

3.

PC 1

PC 2

PC 3

PC N JVM JVM JVM JVM TAHITI TAHITI TAHITI TAHITI

NextHost

JDK

 

6

JDK

 

6

(7)

I.

Definición

 

del

 

Problema

I.

I.

Definici

Definici

ó

ó

n

n

 

 

del

del

 

 

Problema

Problema

PC 2

Importancia

 

de

 

Resolver

 

el

 

Problema

Importancia

 

de

 

Resolver

 

el

 

Problema

(8)

Índice

Í

Í

ndice

ndice

I.

Definición

 

del

 

Problema

II.

Conceptos

 

Generales

III.

Debug

IV.

Sistema

 

de

 

carga

 

de

 

clases

 

en

 

Java

V.

AgletClassLoader

VI.

Entendiendo

 

la

 

Excepción

VII.

Resolviendo

 

el

 

problema

 

(9)

II.

Conceptos

 

Generales

II.

(10)

II.

Conceptos

 

Generales

II.

(11)

II.

Conceptos

 

Generales

II.

(12)

II.

Conceptos

 

Generales

II.

II.

Conceptos

Conceptos

 

 

Generales

Generales

Pc2

Pc2

Pc3

Pc3

Pc4

Pc4

Pc1

Pc1

code

code

code

code

3.

4.

(13)

II.

Conceptos

 

Generales

II.

II.

Conceptos

Conceptos

 

 

Generales

Generales

MAP2

MAP2

MAP3

MAP3

MAP4

MAP4

MAP1

MAP1

agent

agent

agent

(14)

II.

Conceptos

 

Generales

II.

(15)

Índice

Í

Í

ndice

ndice

I.

Definición

 

del

 

Problema

II.

Conceptos

 

Generales

III.

Debug

IV.

Sistema

 

de

 

carga

 

de

 

clases

 

en

 

Java

V.

AgletClassLoader

VI.

Entendiendo

 

la

 

Excepción

VII.

Resolviendo

 

el

 

problema

 

(16)

III.

Debug

III.

(17)

public

 

class

 

MigrarSitios

 

extends

 

Aglet

 

{

SlaveItinerary

 

slaveTrip

 

=

 

null;

public

 

void

 

onCreation(Object

 

ini)

 

{

Estructura

 

estructura

 

=

 

(Estructura)

 

ini;

}

public

 

void

 

run()

 

{

if(slaveTrip.atLastDestination())

 

{

 

… }

 

}

class

 

Tarea

 

extends

 

Task

 

{

public

 

void

 

execute(SeqItinerary

 

i)

 

{ … }

}

}

public

 

class

 

ParentAglet

 

extends

 

Aglet

 

{

{variables

 

privadas

 

de

 

la

 

clase}

public

 

void

 

onCreation(Object

 

init)

 

{

 

… }

public

 

boolean

 

handleMessage(Message

 

msg)

 

{

 

...

 

}

}

III.

Debug

III.

(18)

Consola localhost:4500

[Warning: The hostname seems not having domain name.

Please try ‐resolve option to resolve the fully qualified hostname or use ‐domain option to manually specify the domain name.] ***** Addr: atp://localhost:5000 place: 

No integrity check because no security domain is authenticated.

java.io.IOException: FileNotFound: 

/home/santi/Desktop/java/aglets/public/[Ljava/lang/Object;.class

{Líneas de excepción} …

java.io.IOException: FileNotFound: /home/santi/Desktop /java/aglets/public/[B.class

{Líneas de excepción} …

Padre Finalizado

Consola localhost:5000

[Warning: The hostname seems not having domain name.

Please try ‐resolve option to resolve the fully qualified hostname or use ‐domain option to manually specify the domain name.]

java.io.IOException: atp://localhost:4500/[Ljava/lang/Object;.class

{Líneas de excepción} …

java.io.IOException: atp://localhost:4500/[B.class

III.

Debug

III.

(19)

public class SimpleAglet extends Aglet {

boolean migrado = false;  String[] lista = null;

public void run() {

System.out.println("Empieza Run()");  if (migrado)

{

lista = new String[2]; lista[0] = "String0‐1";  lista[1] = "String1‐1"; for (String s : lista) 

{   System.out.println(s);   } }

else {

migrado = true; lista = new String[2]; lista[0] = "String0‐0";  lista[1] = "String1‐0"; for (String s : lista) 

{ System.out.println(s); } try 

{ dispatch(new java.net.URL("atp://localhost:5000")); }  catch (Exception e) 

{ System.out.println("Failed dispatch to 5000");e.getMessage(); } }

} }

III.

Debug

III.

(20)

Consola localhost:4500

[Warning: The hostname seems not having domain name.

Please try ‐resolve option to resolve the fully qualified hostname or use ‐domain option to manually specify the domain name.] Empieza Run()

String0‐0 String1‐0

***** Addr: atp://localhost:5000 place: 

No integrity check because no security domain is authenticated.

java.io.IOException: FileNotFound: 

/home/santi/Desktop/java/aglets/public/[Ljava/lang/String;.class

{Líneas de excepción} …

Failed dispatch to 5000

Consola localhost:5000

[Warning: The hostname seems not having domain name.

Please try ‐resolve option to resolve the fully qualified hostname or use ‐domain option to manually specify the domain name.]

java.io.IOException: atp://localhost:4500/[Ljava/lang/String;.class

{Líneas de excepción} …

java.lang.ClassNotFoundException: [Ljava.lang.String;

{Líneas de excepción} …

III.

Debug

III.

(21)

III.

Debug

III.

III.

Debug

Debug

URLConnectionForATP MAFAgentSystem_ATPClient

InputStream is = connection.getInputStream();

AtpConnectionImpl SocketConnection AgletClassLoader

byte[] res = loadResourceFromCodeBase(String);

byte[][] result = agentsystem.fetch_class(null, url.toString(), agent_profile); 

InputStream is = 

connection.getInputStream(); InputStream _inputStream =  _connection.getInputStream();

new BufferedInputStream(_socket.getInputStream(),  BUFFSIZE);

_inputStream

null

throw new IOException(url.toString());

throw new IOException(ex.getClass().getName() + «:» + ex_getMessage());

(22)

596: try {

597: C la ss c l = find Re so lve d C la ss(na me ); 598:

599: if(c l != null) {

600: lo g.d e b ug ("Using c la ss" + na me + "in re so lve d c a c he"); 601: re turnc l;

602: } {…}

681: try {

682: c lazz = findSy ste mC lass(name );

/ * Líne a d o nd e d ifie re JDK 1.5 y JDK 6*/

683: if(c la zz != null) 684: {

685: lo g.d e b ug ("Lo a d ing "+ na me + " fro m Syste m"); 686: re turnc la zz;

687: } 688: }

689: c a tc h(C la ssNo tFo und Exc e p tio n e x) {}

III.

Debug

III.

(23)

Índice

Í

Í

ndice

ndice

I.

Definición del Problema

II.

Conceptos Generales

III.

Debug

IV.

Sistema

 

de

 

carga

 

de

 

clases

 

en

 

Java

V.

AgletClassLoader

(24)

IV.

Sistema

 

de

 

carga

 

de

 

clases

 

en

 

Java

  

IV.

IV.

Sistema

Sistema

 

 

de

de

 

 

carga

carga

 

 

de

de

 

 

clases

clases

 

 

en

en

 

 

Java

Java

  

  

Classloader

Classloader

(25)

El

 

Modelo

 

de

 

Delegación

El

 

Modelo

 

de

 

Delegaci

El

 

Modelo

 

de

 

Delegaci

ó

ó

n

n

$JAVAHOME/jre/lib/rt.jar

$JAVAHOME/jre/lib/ext/*.jar

(26)

Encadenamiento

 

seguro

 

de

 

tipos

Encadenamiento

 

seguro

 

de

 

tipos

Encadenamiento

 

seguro

 

de

 

tipos

Loader

 

Constraints

Loader

 

Constraints

Loader

 

Constraints

B.class

B.class

D.class

D.class

A.class

A.class

C.class

C.class

B.class

B.class

D.class

D.class

A.class

A.class

C.class

C.class

(27)

B.class

B.class

D.class

D.class

A.class

A.class

C.class

C.class

B.class

B.class

D.class

D.class

A.class

A.class

C.class

C.class

Constant

 

Pool

 ‐

Runtime

 

Constant

  

Pool

Constant

 

Pool

 

Constant

 

Pool

 

Runtime

Runtime

 

 

Constant

Constant

  

  

Pool

Pool

Constant

 

Pool

 

A

Constant

 

Pool

 

B

Constant

 

Pool

 

D

Constant

 

Pool

 

C

Runtime

Constant

 

Pool

 

A

Runtime

Constant

 

Pool

 

B

Runtime

Constant

 

Pool

 

C

Runtime

Constant

 

(28)

Runtime

 

Constant

 

Pool

Runtime

 

Constant

 

Pool

Runtime

 

Constant

 

Pool

Método

 

Class.getName()

 ‐

Ejemplo

M

(29)

Índice

Í

Í

ndice

ndice

I.

Definición

 

del

 

Problema

II.

Conceptos

 

Generales

III.

Debug

IV.

Sistema

 

de

 

carga

 

de

 

clases

 

en

 

Java

V.

AgletClassLoader

VI.

Entendiendo

 

la

 

Excepción

VII.

Resolviendo

 

el

 

problema

 

(30)

Método

 

loadClass()

M

(31)

Índice

Í

Í

ndice

ndice

I.

Definición

 

del

 

Problema

II.

Conceptos

 

Generales

III.

Debug

IV.

Sistema

 

de

 

carga

 

de

 

clases

 

en

 

Java

V.

AgletClassLoader

VI.

Entendiendo

 

la

 

Excepción

VII.

Resolviendo

 

el

 

problema

 

(32)

VI.

Entendiendo

 

la

 

Excepción

VI.

VI.

Entendiendo

Entendiendo

 

 

la

la

 

 

Excepci

Excepci

ó

ó

n

n

1.

(33)

atp://localhost:4500/

1.

VI.

Entendiendo

 

la

 

Excepción

VI.

VI.

Entendiendo

Entendiendo

 

 

la

la

 

 

Excepci

Excepci

ó

ó

n

n

URLConnectionForATP MAFAgentSystem_ATPClient AtpConnectionImpl AgletClassLoader

byte[] res = loadResourceFromCodeBase(String)

throw new IOException(url.toString())

throw new IOException(ex.getClass().getName() + «:» + ex_getMessage());

SocketConnection

(34)

[Ljava/lang/String;.class

2.

VI.

Entendiendo

 

la

 

Excepción

VI.

VI.

Entendiendo

Entendiendo

 

 

la

la

 

 

Excepci

Excepci

ó

ó

n

n

(Referencia Original)

(Modif. getName())

(Modif. getName())

(Modif. 

(35)

Índice

Í

Í

ndice

ndice

I.

Definición

 

del

 

Problema

II.

Conceptos

 

Generales

III.

Debug

IV.

Sistema

 

de

 

carga

 

de

 

clases

 

en

 

Java

V.

AgletClassLoader

VI.

Entendiendo

 

la

 

Excepción

VII.

Resolviendo

 

el

 

problema

 

(36)

Excepciones

 

hasta

 

el

 

momento

Excepciones

 

hasta

 

el

 

momento

Excepciones

 

hasta

 

el

 

momento

java.io.IOException:

 

FileNotFound:

 

/home/santi/Desktop/java/aglets/public/[Ljava/lang/Object;.class

 ParentAglet

java.io.IOException:

 

atp://localhost:4500/[B.class

 ParentAglet

java.io.IOException:

 

FileNotFound:

 

/home/santi/Desktop/java/aglets/public/[Ljava/lang/String;.class

(37)

Bug

 

ID

Bug

 

ID

Bug

 

ID

Bug ID: 6434149

Synopsis(cl) ClassLoader.loadClass() throws java.lang.ClassNotFoundException: [Ljava.lang.String; in JDK 6.0

DescriptionConsider this simple test program: public class test {

public static void main(String[] args) throws Exception { String[] s = new String[] { "123" };

String clName = s.getClass().getName();

test.class.getClassLoader().loadClass(clName); }

}

This runs fine on JDK 1.5, but throws this exception on JDK 6.0:

Exception in thread "main" java.lang.ClassNotFoundException: [Ljava.lang.String; at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251)

at test.main(test.java:7)

Posted Date : 2006-06-05 21:54:58.0

(38)

¿ findSystemClass()

 

=

 

loadClass()?

¿

¿

findSystemClass()

findSystemClass()

 

 

=

=

 

 

loadClass()?

loadClass()?

protected final Class<?> findSystemClass(String name)

throws ClassNotFoundException {

check();

ClassLoader system = getSystemClassLoader(); if (system == null)

{

if (!checkName(name))

throw new ClassNotFoundException(name); return findBootstrapClass(name);

}

return system.loadClass(name); }

Implementación

 

findSystemClass()

Implementaci

(39)

Si

 

las

 

“loader

 

constraints” son

 

violadas,

 

un

 

error

 

java.lang.LinkageError

 

será lanzado.

[Warning: The hostname seems not having domain name.

Please try -resolve option to resolve the fully qualified hostname or use -domain option to manually specify the domain name.]

java.lang.LinkageError: SimpleAglet

at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) at com.ibm.aglets.tahiti.AgletClassLoader.findClassInternal(AgletClassLoader.java:682) at com.ibm.aglets.tahiti.AgletClassLoader.loadClass(AgletClassLoader.java:609) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:247) …

{Líneas de excepción} …

596: try {

597: C la ss c l = find Re so lve d C la ss(na me ); 598:

599: if(c l != null) {

600: lo g.d e b ug ("Using c la ss" + na me + "in re so lve d c a c he"); 601: re turnc l;

602: } {…}

681: try {

682: c lazz = C lass.fo rName (name ,false ,this);

/ * Líne a d o nd e d ifie re JDK 1.5 y JDK 6*/

683: if(c la zz != null) 684: {

685: lo g.d e b ug ("Lo a d ing "+ na me + " fro m Syste m"); 686: re turnc la zz;

687: } 688: }

(40)

Prueba

 

4

 ‐

LinkageErrorProof

Prueba

 

4

 

Prueba

 

4

 

LinkageErrorProof

LinkageErrorProof

Bootstrap

Class

 

Loader

Extension

Class

 

Loader

System

 

Class

 

Loader

Parent

Class

 

Loader

Child

Class

 

Loader

$JAVAHOME/jre/lib/rt.jar

$JAVAHOME/jre/lib/ext/*.jar

(41)

class LinkageErrorProof_Child extends ClassLoader {

int i= 0;

public LinkageErrorProof_Child(ClassLoader cl) { super(cl);   }

protected synchronized Class loadClass(String name, boolean resolve)  throws ClassNotFoundException{ Class clazz = null;

try{ if(i==0){

i++;

(1) clazz=Class.forName(name,false,???);

} else{

(2) clazz=Class.forName(name,false,???);

} } 

catch(Error ex){e.printStackTrace();} finally{return clazz;}

}

public void test(String n,boolean b) throws ClassNotFoundException{ ((LinkageErrorProof_Parent)this.getParent()).setChild(this);

this.loadClass(n,b); }

}

Prueba

 

4

 ‐

LinkageErrorProof

Prueba

 

4

 

(42)

Prueba

 

4

 ‐

LinkageErrorProof

Prueba

 

4

 

Prueba

 

4

 

LinkageErrorProof

LinkageErrorProof

(1)

 

clazz=Class.forName(name,false,this);

 

(LinkageErrorProof_Child)

(2)

 

clazz=Class.forName(name,false,this);

 

(LinkageErrorProof_Child)

(3)

 

Indistinto

 

ya

 

que

 

el

 

error

 

se

 

debería

 

haber

 

producido.

(4)

 

Indistinto

 

ya

 

que

 

el

 

error

 

se

 

debería

 

haber

 

producido.

(1)

 

clazz=Class.forName(name,false,this);

 

(LinkageErrorProof_Child)

(2)

 

clazz=Class.forName(name,false,this);

 

(LinkageErrorProof_Child)

(3)

 

Indistinto

 

ya

 

que

 

el

 

error

 

se

 

debería

 

haber

 

producido.

(4)

 

Indistinto

 

ya

 

que

 

el

 

error

 

se

 

debería

 

haber

 

producido.

1.

LinkageErrorProof_Parent

Class

 

Loader

LinkageErrorProof_Child

 

Class

 

Loader

(1) – 1era. Invocación

(2) – 2da. Invocación

(43)

Prueba

 

4

 ‐

LinkageErrorProof

Prueba

 

4

 

Prueba

 

4

 

LinkageErrorProof

LinkageErrorProof

(1)

 

clazz=Class.forName(name,false,

 

this);

 

(LinkageErrorProof_Child)

(2)

 

clazz=Class.forName(name,false,

 

this.getParent());

 

(LinkageErrorProof_Child)

(3)

 

clazz=Class.forName(name,false,this);

 

(LinkageErrorProof_Parent)

(4)

 

Indistinto

 

ya

 

que

 

el

 

error

 

se

 

debería

 

haber

 

producido.

(1)

 

clazz=Class.forName(name,false,

 

this);

 

(LinkageErrorProof_Child)

(2)

 

clazz=Class.forName(name,false,

 

this.getParent());

 

(LinkageErrorProof_Child)

(3)

 

clazz=Class.forName(name,false,this);

 

(LinkageErrorProof_Parent)

(4)

 

Indistinto

 

ya

 

que

 

el

 

error

 

se

 

debería

 

haber

 

producido.

2.

LinkageErrorProof_Parent

Class

 

Loader

LinkageErrorProof_Child

 

Class

 

Loader

(1) – 1era. Invocación

(2) – 2da. Invocación

(3) – 3era. Invocación

if then

else

(44)

Prueba

 

4

 ‐

LinkageErrorProof

Prueba

 

4

 

Prueba

 

4

 

LinkageErrorProof

LinkageErrorProof

(1)

 

clazz=Class.forName(name,false,

 

this);

 

(LinkageErrorProof_Child)

(2)

 

clazz=Class.forName(name,false,

 

this.getParent());

 

(LinkageErrorProof_Child)

(3)

 

clazz=Class.forName(name,false,this.getChild());

 

(LinkageErrorProof_Parent)

(4)

 

Indistinto

 

ya

 

que

 

el

 

error

 

se

 

debería

 

haber

 

producido.

(1)

 

clazz=Class.forName(name,false,

 

this);

 

(LinkageErrorProof_Child)

(2)

 

clazz=Class.forName(name,false,

 

this.getParent());

 

(LinkageErrorProof_Child)

(3)

 

clazz=Class.forName(name,false,this.getChild());

 

(LinkageErrorProof_Parent)

(4)

 

Indistinto

 

ya

 

que

 

el

 

error

 

se

 

debería

 

haber

 

producido.

3.

LinkageErrorProof_Parent

Class

 

Loader

LinkageErrorProof_Child

 

Class

 

Loader

(1) – 1era. Invocación

(3) – 3era. Invocación

(2) – 2era. Invocación

if then

else

(45)

Prueba

 

4

 ‐

LinkageErrorProof

Prueba

 

4

 

Prueba

 

4

 

LinkageErrorProof

LinkageErrorProof

(1)

 

clazz=Class.forName(name,false,

 

this.getParent());

 

(LinkageErrorProof_Child)

(2)

 

Indistinto

 

ya

 

que

 

el

 

error

 

se

 

debería

 

haber

 

producido.

(3)

 

clazz=Class.forName(name,false,

 

this);

 

(LinkageErrorProof_Parent)

(4)

 

Indistinto

 

ya

 

que

 

el

 

error

 

se

 

debería

 

haber

 

producido.

(1)

 

clazz=Class.forName(name,false,

 

this.getParent());

 

(LinkageErrorProof_Child)

(2)

 

Indistinto

 

ya

 

que

 

el

 

error

 

se

 

debería

 

haber

 

producido.

(3)

 

clazz=Class.forName(name,false,

 

this);

 

(LinkageErrorProof_Parent)

(4)

 

Indistinto

 

ya

 

que

 

el

 

error

 

se

 

debería

 

haber

 

producido.

4.

LinkageErrorProof_Parent

Class

 

Loader

LinkageErrorProof_Child

 

Class

 

Loader

(1) – 1era. Invocación

(3) – 2era. Invocación

(46)

Prueba

 

4

 ‐

LinkageErrorProof

Prueba

 

4

 

Prueba

 

4

 

LinkageErrorProof

LinkageErrorProof

(1)

 

clazz=Class.forName(name,false,

 

this.getParent());

 

(LinkageErrorProof_Child)

(2)

 

clazz=Class.forName(name,false,

 

this.getParent());

 

(LinkageErrorProof_Child)

(3)

 

clazz=Class.forName(name,false,

 

this.getChild());

 

(LinkageErrorProof_Parent)

(4)

 

Indistinto

 

ya

 

que

 

el

 

error

 

se

 

debería

 

haber

 

producido.

(1)

 

clazz=Class.forName(name,false,

 

this.getParent());

 

(LinkageErrorProof_Child)

(2)

 

clazz=Class.forName(name,false,

 

this.getParent());

 

(LinkageErrorProof_Child)

(3)

 

clazz=Class.forName(name,false,

 

this.getChild());

 

(LinkageErrorProof_Parent)

(4)

 

Indistinto

 

ya

 

que

 

el

 

error

 

se

 

debería

 

haber

 

producido.

5.

LinkageErrorProof_Parent

Class

 

Loader

LinkageErrorProof_Child

 

Class

 

Loader

(1) – 1era. Invocación

(3) – 2da. Invocación

(2) – 3era. Invocación

if then

if then

(47)

Prueba

 

4

 ‐

LinkageErrorProof

Prueba

 

4

 

Prueba

 

4

 

LinkageErrorProof

LinkageErrorProof

(1)

 

clazz=Class.forName(name,false,

 

this.getParent());

 

(LinkageErrorProof_Child)

(2)

 

clazz=Class.forName(name,false,

 

this);

 

(LinkageErrorProof_Child)

(3)

 

clazz=Class.forName(name,false,

 

this.getChild());

 

(LinkageErrorProof_Parent)

(4)

 

Indistinto

 

ya

 

que

 

el

 

error

 

se

 

debería

 

haber

 

producido.

(1)

 

clazz=Class.forName(name,false,

 

this.getParent());

 

(LinkageErrorProof_Child)

(2)

 

clazz=Class.forName(name,false,

 

this);

 

(LinkageErrorProof_Child)

(3)

 

clazz=Class.forName(name,false,

 

this.getChild());

 

(LinkageErrorProof_Parent)

(4)

 

Indistinto

 

ya

 

que

 

el

 

error

 

se

 

debería

 

haber

 

producido.

6.

LinkageErrorProof_Parent

Class

 

Loader

LinkageErrorProof_Child

 

Class

 

Loader

(1) – 1era. Invocación

(3) – 2da. Invocación

(2) – 3era. Invocación

if then

if then

(48)

Prueba

 

4

 ‐

LinkageErrorProof

Prueba

 

4

 

Prueba

 

4

 

LinkageErrorProof

LinkageErrorProof

(1)

 

clazz=Class.forName(name,false,

 

this);

 

(LinkageErrorProof_Child)

(2)

 

clazz=Class.forName(name,false,

 

this.getParent());

 

(LinkageErrorProof_Child)

(3)

clazz=Class.forName(name,false,this.getSystemClassLoader());(LinkageErrorProof_Parent)

(4)

 

Indistinto

 

ya

 

que

 

la

 

clase

 

ha

 

sido

 

encontrada.

(1)

 

clazz=Class.forName(name,false,

 

this);

 

(LinkageErrorProof_Child)

(2)

 

clazz=Class.forName(name,false,

 

this.getParent());

 

(LinkageErrorProof_Child)

(3)

clazz=Class.forName(name,false,this.getSystemClassLoader());(LinkageErrorProof_Parent)

(4)

 

Indistinto

 

ya

 

que

 

la

 

clase

 

ha

 

sido

 

encontrada.

7.

LinkageErrorProof_Parent

Class

 

Loader

LinkageErrorProof_Child

 

Class

 

Loader

System

 

Class

 

Loader

$CLASSPATH

(1) – 1era. Invocación

(2) – 2da. Invocación

(3) – 3era. Invocación

if then

else

(49)

Entendiendo

 

la

 

Excepción

Entendiendo

 

la

 

Excepci

Entendiendo

 

la

 

Excepci

ó

ó

n

n

java.lang.LinkageError

java.lang.LinkageError

(50)

Estructura

 

de

 

la

 

Constraint

 

Table

Estructura

 

de

 

la

 

Constraint

 

Table

Estructura

 

de

 

la

 

Constraint

 

Table

Initiating

 

Loader

 

1

Initiating

 

Loader

 

2

Initiating

 

Loader

 

n

Defining

 

Loader

(51)

Ejecución

 

SimpleAglet

Ejecuci

Ejecuci

ó

ó

n

n

 

 

SimpleAglet

SimpleAglet

AgletClassLoader

forName(“java.lang.String”,false,AgletClassLoader)

forName(

(52)

Ejecución

 

SimpleAglet

Ejecuci

Ejecuci

ó

ó

n

n

 

 

SimpleAglet

SimpleAglet

AgletClassLoader

forName(“java.lang.String”,false,AgletClassLoader)

forName(

forName(

java.lang.String

java.lang.String

,false,AgletClassLoader)

,false,AgletClassLoader)

AgletClassLoader

(1era.

 

Invocación)

(2da.

 

Invocación)

(53)

Solución

 

al

 

LinkageError

Soluci

Soluci

ó

ó

n

n

 

 

al

al

 

 

LinkageError

LinkageError

Bootstrap

Class

 

Loader

Extension

Class

 

Loader

System

 

Class

 

Loader

User

Defined

Class

 

Loader

User

Defined

Class

 

Loader

$JAVAHOME/jre/lib/rt.jar

$JAVAHOME/jre/lib/ext/*.jar

$CLASSPATH

java.lang.LinkageError

Nivel

 

superior

 

en

 

la

 

jerarquía

Nivel

 

superior

 

en

 

la

 

jerarquía

Correcto

 

uso

 

de

 

forName(String,boolean,ClassLoader)

Correcto

 

uso

 

de

 

forName(String,boolean,ClassLoader)

(54)

Solución

 

al

 

LinkageError

Soluci

Soluci

ó

ó

n

n

 

 

al

al

 

 

LinkageError

LinkageError

Bootstrap

Class

 

Loader

Extension

Class

 

Loader

System

 

Class

 

Loader

AgletClassLoader

Class

 

Loader

$JAVAHOME/jre/lib/rt.jar

$JAVAHOME/jre/lib/ext/*.jar

$CLASSPATH

Jerarquía

 

de

 

classloaders

 

– Plataforma

 

Aglets

 

Jerarqu

(55)

Solución

 

al

 

LinkageError

Soluci

Soluci

ó

ó

n

n

 

 

al

al

 

 

LinkageError

LinkageError

596: try {

597: C la ss c l = find Re so lve d C la ss(na me ); 598:

599: if(c l != null) {

600: lo g.d e b ug ("Using c la ss" + na me + "in re so lve d c a c he"); 601: re turnc l;

602: } {…}

681: try {

682: c lazz = C lass.fo rName (name ,false , this.g e tSy ste mC lassLo ade r());

/ * Líne a d o nd e d ifie re JDK 1.5 y JDK 6*/

683: if(c la zz != null) 684: {

685: lo g.d e b ug ("Lo a d ing "+ na me + " fro m Syste m"); 686: re turnc la zz;

687: } 688: }

689: c a tc h(C la ssNo tFo und Exc e p tio n e x) {}

Invocación

 

correcta

 

del

 

método

 

forName()

 

Invocaci

(56)

Solución

 

al

 

LinkageError

Soluci

Soluci

ó

ó

n

n

 

 

al

al

 

 

LinkageError

LinkageError

Consola localhost:4500

[Warning: The hostname seems not having domain name.

Please try ‐resolve option to resolve the fully qualified hostname or use ‐domain option to manually specify the domain name.] Empieza Run()

String0‐0 String1‐0

***** Addr: atp://localhost:5000 place: 

No integrity check because no security domain is authenticated.

Consola localhost:5000

[Warning: The hostname seems not having domain name.

Please try ‐resolve option to resolve the fully qualified hostname or use ‐domain option to manually specify the domain name.] Empieza Run()

(57)

Solución

 

al

 

LinkageError

Soluci

Soluci

ó

ó

n

n

 

 

al

al

 

 

LinkageError

LinkageError

Consola localhost:4500

[Warning: The hostname seems not having domain name.

Please try ‐resolve option to resolve the fully qualified hostname or use ‐domain option to manually specify the domain name.] ***** Addr: atp://localhost:5000 place: 

No integrity check because no security domain is authenticated.

Padre Finalizado Consola localhost:5000

[Warning: The hostname seems not having domain name.

(58)

Índice

Í

Í

ndice

ndice

I.

Definición

 

del

 

Problema

II.

Conceptos

 

Generales

III.

Debug

IV.

Sistema

 

de

 

carga

 

de

 

clases

 

en

 

Java

V.

AgletClassLoader

VI.

Entendiendo

 

la

 

Excepción

VII.

Resolviendo

 

el

 

problema

 

(59)

VIII.

Conclusión

VIII.

Referencias

Documento similar

public static void main(String[] args) { String counterFile = args[0];. int initialValue

&#34;RegEnumValueA&#34; (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpValueName As String, lpcbValueName As Long, ByVal lpReserved As Long, lpType As Long, lpData As

After a general review of how the presence of background fluxes leads to 4d BF couplings (section 6.1), we study the ap- pearance of discrete gauge symmetries when there is only

The purpose of this work is to consider type II compactifications where open strings modes (and in particular Wilson lines) enter the potential generated by fluxes on equal footing

in the first one [79] we describe the type IIA physical realization of the unoriented topological string introduced by Walcher, describe its M-theory lift, and show that it allows

In other words, different supercritical string theories living in different spacetime dimensions are connected to each other via a process of tachyon condensation.. Tachyon

In this thesis, we consider the embedding of inflation in Type IIB string theory, with the inflaton given by the position modulus of a D7-brane, an open string.. The inflaton

We showed that taking these corrections into account, a tensionless string arises in three infi- nite distance limits, where quantum effects are under control, which is dual to