问:
Spark Standalone Cluster - Slave not connecting to Master
I am trying to setup a Spark standalone cluster following the official documentation.

My master is on a local vm running ubuntu and I also have one worker running in the same machine. It is connecting and I am able to see its status in the WebUI of the master.

Here is the WebUi image -

But when I try to connect a slave from another machine, I am not able to do it.

This is the log message I get in the worker when I start from another machine.
I have tried using start-slaves.sh from the master after updating conf\slaves and also start-slave.sh spark://spark:7077 from the slave.

[Master hostname - spark; Worker hostanme - worker]

```<code>15/07/01 11:54:16 WARN ReliableDeliverySupervisor: Association with remote system [akka.tcp://sparkMaster@spark:7077] has failed, address is now gated for [5000] ms. Reason is: [Association failed with [akka.tcp://sparkMaster@spark:7077]].
15/07/01 11:54:59 ERROR Worker: All masters are unresponsive! Giving up.
15/07/01 11:54:59 INFO Utils: Shutdown hook called
</code>```

When I try to telnet from the slave to the master, this is what I get -

```<code>root@worker:~# telnet spark 7077
Trying 10.xx.xx.xx...
Connected to spark.
Escape character is '^]'.
Connection closed by foreign host.
</code>```

Telnet seems to work but the connection is closed as soon as it is established. Could this have something to do with the problem ?

I have added the master and slave IP addresses in /etc/hosts on both machines.
I followed all the solutions given at SPARK + Standalone Cluster: Cannot start worker from another machine
but they have not worked for me.

I have the following config set in spark-env.sh in both machines -

export SPARK_MASTER_IP=spark

export SPARK_WORKER_PORT=44444

Any help is greatly appreciated.

答:
I just launched my own spark cluster with version 2.10. The way I solved my problem is the following:</p>

```<code> ./sbin/start-master.sh -h <your_ip>
</code>```

Body:
I am trying to setup a Spark standalone cluster following the official documentation.

My master is on a local vm running ubuntu and I also have one worker running in the same machine. It is connecting and I am able to see its status in the WebUI of the master.

Here is the WebUi image -

But when I try to connect a slave from another machine, I am not able to do it.

This is the log message I get in the worker when I start from another machine.
I have tried using start-slaves.sh from the master after updating conf\slaves and also start-slave.sh spark://spark:7077 from the slave.

[Master hostname - spark; Worker hostanme - worker]

15/07/01 11:54:16 WARN ReliableDeliverySupervisor: Association with remote system [akka.tcp://sparkMaster@spark:7077] has failed, address is now gated for [5000] ms. Reason is: [Association failed with [akka.tcp://sparkMaster@spark:7077]].
15/07/01 11:54:59 ERROR Worker: All masters are unresponsive! Giving up.
15/07/01 11:54:59 INFO Utils: Shutdown hook called

When I try to telnet from the slave to the master, this is what I get -

root@worker:~# telnet spark 7077
Trying 10.xx.xx.xx...
Connected to spark.
Escape character is '^]'.
Connection closed by foreign host.

Telnet seems to work but the connection is closed as soon as it is established. Could this have something to do with the problem ?

I have added the master and slave IP addresses in /etc/hosts on both machines.
I followed all the solutions given at SPARK + Standalone Cluster: Cannot start worker from another machine
but they have not worked for me.

I have the following config set in spark-env.sh in both machines -

export SPARK_MASTER_IP=spark

export SPARK_WORKER_PORT=44444

Any help is greatly appreciated.

Body:
I just launched my own spark cluster with version 2.10. The way I solved my problem is the following:

 ./sbin/start-master.sh -h <your_ip>


来源: stackexchange

问:
How can I get value of this child?
It's not current id that user logged... it's other uid from other user when other user send a request.

答:
From what I understand, you want to get to know whenever you receive a friend request. I see that you've created a Friend_req node and have each user's keys inside it. This is good. I assume that you do have a minimal grasp of Firebase and flattening of data.

With this assumption, my answer is that you need a childEventListener on the node that you need to track for friend requests. The childEventListener has a onChildAdded() method that downloads data whenever a new child is added to the code ( in your case, a new friend request ). Here's a basic implementation.

```<code>FirebaseDatabase.getInstance().getReference().child("Friend_req")
    .child(yourUserKey).addChildEventListener(new ChildEventListener() {

public void onChildAdded(DataSnapshot dataSnapshot, String s) {
//Get notified on friend request
}

 @Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
}

@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {

                                            }

@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {

                                            }

@Override
public void onCancelled(DatabaseError databaseError) {

}
});
</code>```

ContentLicense: CC BY-SA 3.0

Title: How can I get value of this child?

Body:
From what I understand, you want to get to know whenever you receive a friend request. I see that you've created a Friend_req node and have each user's keys inside it. This is good. I assume that you do have a minimal grasp of Firebase and flattening of data.

With this assumption, my answer is that you need a childEventListener on the node that you need to track for friend requests. The childEventListener has a onChildAdded() method that downloads data whenever a new child is added to the code ( in your case, a new friend request ). Here's a basic implementation.

FirebaseDatabase.getInstance().getReference().child("Friend_req")
    .child(yourUserKey).addChildEventListener(new ChildEventListener() {

public void onChildAdded(DataSnapshot dataSnapshot, String s) {
//Get notified on friend request
}

 @Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
}

@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {

                                            }

@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {

                                            }

@Override
public void onCancelled(DatabaseError databaseError) {

}
});


问:
show img with url in laravel 5.4
I have a image that want show in slide show I use html tag ,
I'm new in laravel and I don't Know How to show image in my blade.
How I can use  tag in laravel?

答:
```<code><img src="{{ asset('/public/upload/image.jpg') }}">
</code>```

If your image in public folder

Title: show img with url in laravel 5.4

Body:
<img src="{{ asset('/public/upload/image.jpg') }}">

If your image in public folder


问:
My responsive menu gets gliched
I am working on my responsive menu that will be on desktop view a normal horizontal menu, but when the screen is smaller than 992px a hamburger style button will appear which will toggle a push-in side menu.

The problem i am facing is that the menu glitches when resizing the window aka switching between desktop and mobile view.

Here is my code:

```<code><!DOCTYPE html>
<html lang="en">
<head>
<title>Menu</title>
<meta charset="utf-8">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

<link rel="stylesheet" type="text/css" href="style.css">
</head>

<body>

<div class="container">
</code>```

my css:

```<code>@media screen and (min-width: 992px) {

}
</code>```

and my js:

```<code>$(document).ready(function(){
    $('#mobile-icon').click(function(){
        $(this).toggleClass('closed');
    });

    $('.expander-icon').click(function(){
        $(this).parent().toggleClass('active-menu');

    });

});

$(window).on('load resize', function () {
    var screenWidth = $( window ).width();
    if(screenWidth < 992){
        $('.u').addClass('isMobile');

        $('#icon').click(function(){
            $(this).toggleClass("open closed");
            if($( "#con" ).hasClass( "open" )){
                $('.gation').css('margin-left',"0");

            }
            else{
                $('.asdn').css('margin-left',"-70%");
            }
        });

    }
});
</code>```

答:
I don't know if I fully understand what you're trying to do here but the first issue I see is that you're adding a click event to mr-mobile-icon constantly while while the window is resized.  These click events don't erase existing click events, they stack.  After the window has resized, you might have hundreds of click events on mr-mobile-icon, all telling the browser to change css attributes.

You'll want to remove the click event assignment from the window resize and load event and just use the one you've already got in the document.ready.  If you scope the screenWidth variable to be globally-accessible, you can use it inside your click function.

Here's a basic example of what I'm suggesting, with your other code removed:

```<code>var screenWidth = $( window ).width();

$(document).ready(function(){

    $('#mr-mobile-icon').click(function(){
         if(screenWidth < 992) {
           // do whatever needs to happen for mobile
        } else {
            // do whatever needs to happen for desktop
        }
    });

});

$(window).on('resize', function () {
    screenWidth = $( window ).width();
});
</code>```

Title: My responsive menu gets gliched

Body:
I am working on my responsive menu that will be on desktop view a normal horizontal menu, but when the screen is smaller than 992px a hamburger style button will appear which will toggle a push-in side menu.

The problem i am facing is that the menu glitches when resizing the window aka switching between desktop and mobile view.

Here is my code:

<!DOCTYPE html>

<title>Menu</title>
<meta charset="utf-8">

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

<link rel="stylesheet" type="text/css" href="style.css">

my css:

@media screen and (min-width: 992px) {

}

and my js:

$(document).ready(function(){
    $('#mobile-icon').click(function(){
        $(this).toggleClass('closed');
    });

    $('.expander-icon').click(function(){
        $(this).parent().toggleClass('active-menu');

    });

});

$(window).on('load resize', function () {
    var screenWidth = $( window ).width();
    if(screenWidth < 992){
        $('.u').addClass('isMobile');

        $('#icon').click(function(){
            $(this).toggleClass("open closed");
            if($( "#con" ).hasClass( "open" )){
                $('.gation').css('margin-left',"0");

            }
            else{
                $('.asdn').css('margin-left',"-70%");
            }
        });

    }
});

Body:
I don't know if I fully understand what you're trying to do here but the first issue I see is that you're adding a click event to mr-mobile-icon constantly while while the window is resized.  These click events don't erase existing click events, they stack.  After the window has resized, you might have hundreds of click events on mr-mobile-icon, all telling the browser to change css attributes.

You'll want to remove the click event assignment from the window resize and load event and just use the one you've already got in the document.ready.  If you scope the screenWidth variable to be globally-accessible, you can use it inside your click function.

Here's a basic example of what I'm suggesting, with your other code removed:

var screenWidth = $( window ).width();

$(document).ready(function(){

    $('#mr-mobile-icon').click(function(){
         if(screenWidth < 992) {
           // do whatever needs to happen for mobile
        } else {
            // do whatever needs to happen for desktop
        }
    });

});

$(window).on('resize', function () {
    screenWidth = $( window ).width();
});


问:
Spring Data JPA ManyToOne Bidirectional
Problem: it works till i try to add Student obejcts to Database, but the tables are being created correctly .
I can't simplify the post any further. But it's mainly code that doesn't require a lot of reading, it's a simple spring data repository service model. I posted it all due to the fact idk what am i doing wrong. Problem is in the JPA mapping.
I got the example from over here http://www.java2s.com/Tutorial/Java/0355__JPA/OneToManyBidirectional.htm

MDOELS

```<code>@Entity
public class Department {
    @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
    private int id;
    private String name;

    @OneToMany(mappedBy="department")
    private Collection<Student> students;

    public Department() {
    }

    public Department(String name) {
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String deptName) {
        this.name = deptName;
    }

    public Collection<Student> getStudents() {
        return students;
    }

    public void setStudent(Collection<Student> students) {
        this.students = students;
    }

    public String toString() {
        return "Department id: " + getId() +
                ", name: " + getName();
    }
}

@Entity
public class Student {
    @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
    private int id;
    private String name;

    @ManyToOne (cascade=CascadeType.ALL)
    private Department department;

    public Student() {
    }

    public Student(String name, Department department) {
        this.name = name;
        this.department = department;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Department getDepartment() {
        return department;
    }

    public void setDepartment(Department department) {
        this.department = department;
    }

    public String toString() {
        return "\n\nID:" + id + "\nName:" + name + "\n\n" + department;
    }
}
</code>```

REPOSITORIES

```<code>@Repository
public interface DepartmentRepository extends JpaRepository<Department, Integer> {
    Department findByName(String name);

}

@Repository
public interface StudentRepository extends JpaRepository<Student, Integer> {
    Student findByName(String name);
}
</code>```

SERVICES

```<code>@Service
public class StudentService {
    private final StudentRepository studentRepository;

    @Autowired
    public StudentService(StudentRepository studentRepository) {
        this.studentRepository = studentRepository;

    }

    public void addToDatabase(Student student) {
        this.studentRepository.saveAndFlush(student);

    }

    public Student getStudentByName(String name) {
        return studentRepository.findByName(name);
    }
}
@Service
public class DepartmentService {
    private final DepartmentRepository departmentRepository;

    @Autowired
    public DepartmentService(DepartmentRepository departmentRepository) {
        this.departmentRepository = departmentRepository;

    }

    public void addToDataBase(List<Department> department) {
        this.departmentRepository.save(department);
        department.forEach(this.departmentRepository::saveAndFlush);
    }
    public Department getDepartmentByName(String name){
        return  this.departmentRepository.findByName(name);
    }
}
</code>```

My main method

```<code>@Component
public class Terminal implements CommandLineRunner {
    private final StudentService studentService;
    private final DepartmentService departmentService;

    @Autowired
    public Terminal(StudentService studentService, DepartmentService departmentService) {
        this.studentService = studentService;
        this.departmentService = departmentService;
    }

        @Override
        public void run(String... strings) throws Exception {
            Department department = new Department("dep1");
            Department department1 = new Department("dep2");
            Department department2 = new Department("dep3");
            Department department3 = new Department("dep4");
            List<Department> departments = new ArrayList<>(Arrays.asList(department, department1, department2, department3));
            this.departmentService.addToDataBase(departments);
    //
            Student student = new Student("pesho", department);
            Student student11 = new Student("gosho", department1);
            this.studentService.addToDatabase(student11);
            this.studentService.addToDatabase(student);
            student = new Student("sasho", department2);
            this.studentService.addToDatabase(student);
    //        System.out.println(this.studentService.getStudentByName("gosho").getDepartment1());
    //        System.out.println("CHECKING ONE TO ONE BIDIRECTIONAL: " + this.departmentService.getDepartmentByName("dep1").getStudent());

        }
    }
</code>```

So here when i try to add students in the students table it gives an error
The error is the fallowing

```<code>Caused by: org.hibernate.PersistentObjectException: detached entity passed to persist: app.models.Department
</code>```

答: Well I can't understand you problem completely but here's what I would like to add. Cascading for add operation is not implemented or it's incomplete. Hope it helps.</p>

Title: Spring Data JPA ManyToOne Bidirectional

Body:
Problem: it works till i try to add Student obejcts to Database, but the tables are being created correctly .
I can't simplify the post any further. But it's mainly code that doesn't require a lot of reading, it's a simple spring data repository service model. I posted it all due to the fact idk what am i doing wrong. Problem is in the JPA mapping.
I got the example from over here http://www.java2s.com/Tutorial/Java/0355__JPA/OneToManyBidirectional.htm

MDOELS

@Entity
public class Department {
    @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
    private int id;
    private String name;

    @OneToMany(mappedBy="department")
    private Collection<Student> students;

    public Department() {
    }

    public Department(String name) {
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String deptName) {
        this.name = deptName;
    }

    public Collection<Student> getStudents() {
        return students;
    }

    public void setStudent(Collection<Student> students) {
        this.students = students;
    }

    public String toString() {
        return "Department id: " + getId() +
                ", name: " + getName();
    }
}

@Entity
public class Student {
    @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
    private int id;
    private String name;

    @ManyToOne (cascade=CascadeType.ALL)
    private Department department;

    public Student() {
    }

    public Student(String name, Department department) {
        this.name = name;
        this.department = department;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Department getDepartment() {
        return department;
    }

    public void setDepartment(Department department) {
        this.department = department;
    }

    public String toString() {
        return "\n\nID:" + id + "\nName:" + name + "\n\n" + department;
    }
}

REPOSITORIES

@Repository
public interface DepartmentRepository extends JpaRepository<Department, Integer> {
    Department findByName(String name);

}

@Repository
public interface StudentRepository extends JpaRepository<Student, Integer> {
    Student findByName(String name);
}

SERVICES

@Service
public class StudentService {
    private final StudentRepository studentRepository;

    @Autowired
    public StudentService(StudentRepository studentRepository) {
        this.studentRepository = studentRepository;

    }

    public void addToDatabase(Student student) {
        this.studentRepository.saveAndFlush(student);

    }

    public Student getStudentByName(String name) {
        return studentRepository.findByName(name);
    }
}
@Service
public class DepartmentService {
    private final DepartmentRepository departmentRepository;

    @Autowired
    public DepartmentService(DepartmentRepository departmentRepository) {
        this.departmentRepository = departmentRepository;

    }

    public void addToDataBase(List<Department> department) {
        this.departmentRepository.save(department);
        department.forEach(this.departmentRepository::saveAndFlush);
    }
    public Department getDepartmentByName(String name){
        return  this.departmentRepository.findByName(name);
    }
}

My main method

@Component
public class Terminal implements CommandLineRunner {
    private final StudentService studentService;
    private final DepartmentService departmentService;

    @Autowired
    public Terminal(StudentService studentService, DepartmentService departmentService) {
        this.studentService = studentService;
        this.departmentService = departmentService;
    }

        @Override
        public void run(String... strings) throws Exception {
            Department department = new Department("dep1");
            Department department1 = new Department("dep2");
            Department department2 = new Department("dep3");
            Department department3 = new Department("dep4");
            List<Department> departments = new ArrayList<>(Arrays.asList(department, department1, department2, department3));
            this.departmentService.addToDataBase(departments);
    //
            Student student = new Student("pesho", department);
            Student student11 = new Student("gosho", department1);
            this.studentService.addToDatabase(student11);
            this.studentService.addToDatabase(student);
            student = new Student("sasho", department2);
            this.studentService.addToDatabase(student);
    //        System.out.println(this.studentService.getStudentByName("gosho").getDepartment1());
    //        System.out.println("CHECKING ONE TO ONE BIDIRECTIONAL: " + this.departmentService.getDepartmentByName("dep1").getStudent());

        }
    }

So here when i try to add students in the students table it gives an error
The error is the fallowing

Caused by: org.hibernate.PersistentObjectException: detached entity passed to persist: app.models.Department


问:
r1c1 formula not working
I am trying to rank values using column J and tie breaker in column K with the result populating in column N. Column J & K are values.

Somehow it only generates one value wherever my cell is pointed at, which means if I run the vba codes at cell C19, it will just populate value 1 in C19, not from N6 where I want the results to be.

Here are my codes,

```<code>Sub test()
Dim LR1 As Long
LR1 = Range("J" & Rows.Count).End(xlUp).Row
With Range("N6:N" & LR1)
   ActiveCell.FormulaR1C1 = "=1+SUMPRODUCT(--(R6C10:R33C10<RC[-4]))+SUMPRODUCT(--(R6C11:R33C11<RC[-3]),--(R6C10:R33C10=RC[-4]))"
End With
End Sub
</code>```

I am not sure what went wrong. I tried to do it manually using the excel formula and its working fine but not my vba codes.

答:
ActiveCell is your issue.

Change
ActiveCell.FormulaR1C1 = "=1+SUMPRODUCT(--(R6C10:R33C10<RC[-4]))+SUMPRODUCT(--(R6C11:R33C11<RC[-3]),--(R6C10:R33C10=RC[-4]))"

To .FormulaR1C1 = "=1+SUMPRODUCT(--(R6C10:R33C10<RC[-4]))+SUMPRODUCT(--(R6C11:R33C11<RC[-3]),--(R6C10:R33C10=RC[-4]))"

Remove that and it should do what you want.

You will want to fully qualify your Range references that way they aren't depending on the ActiveSheet. This will provide you with consistent behavior and results.

Title: r1c1 formula not working

Body:
I am trying to rank values using column J and tie breaker in column K with the result populating in column N. Column J & K are values.

Somehow it only generates one value wherever my cell is pointed at, which means if I run the vba codes at cell C19, it will just populate value 1 in C19, not from N6 where I want the results to be.

Here are my codes,

Sub test()
Dim LR1 As Long
LR1 = Range("J" & Rows.Count).End(xlUp).Row
With Range("N6:N" & LR1)
   ActiveCell.FormulaR1C1 = "=1+SUMPRODUCT(--(R6C10:R33C10<RC[-4]))+SUMPRODUCT(--(R6C11:R33C11<RC[-3]),--(R6C10:R33C10=RC[-4]))"
End With
End Sub

I am not sure what went wrong. I tried to do it manually using the excel formula and its working fine but not my vba codes.


问:
Error message while developing Android Studio VPN Application
The Following message appear While developing an Open VPN application :
07-04 21:33:34.998 20337-21875/pioneers.safwat.myvpn6 E/AndroidRuntime: FATAL EXCEPTION: OpenVPNManagementThread
                                                                        java.lang.UnsatisfiedLinkError: Native method not found: pioneers.safwat.myvpn6.NativeUtils.jniclose:(I)V
                                                                            at pioneers.safwat.myvpn6.NativeUtils.jniclose(Native Method)
                                                                            at pioneers.safwat.myvpn6.OpenVpnManagementThread.protectFileDescriptor(OpenVpnManagementThread.java:175)
                                                                            at pioneers.safwat.myvpn6.OpenVpnManagementThread.processNeedCommand(OpenVpnManagementThread.java:387)
                                                                            at pioneers.safwat.myvpn6.OpenVpnManagementThread.processCommand(OpenVpnManagementThread.java:227)
                                                                            at pioneers.safwat.myvpn6.OpenVpnManagementThread.processInput(OpenVpnManagementThread.java:198)
                                                                            at pioneers.safwat.myvpn6.OpenVpnManagementThread.run(OpenVpnManagementThread.java:146)
                                                                            at java.lang.Thread.run(Thread.java:841)
07-04 21:33:35.288 20337-20337/pioneers.safwat.myvpn6 E/ActivityThread: Activity pioneers.safwat.myvpn6.MainActivity_vpn has leaked ServiceConnection pioneers.safwat.myvpn6.MainActivity_vpn$1@42537e00 that was originally bound here
                                                                        android.app.ServiceConnectionLeaked: Activity pioneers.safwat.myvpn6.MainActivity_vpn has leaked ServiceConnection pioneers.safwat.myvpn6.MainActivity_vpn$1@42537e00 that was originally bound here
                                                                            at android.app.LoadedApk$ServiceDispatcher.(LoadedApk.java:979)
                                                                            at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:873)
                                                                            at android.app.ContextImpl.bindServiceAsUser(ContextImpl.java:1850)
                                                                            at android.app.ContextImpl.bindService(ContextImpl.java:1838)
                                                                            at android.content.ContextWrapper.bindService(ContextWrapper.java:503)
                                                                            at pioneers.safwat.myvpn6.MainActivity_vpn.onCreate(MainActivity_vpn.java:53)
                                                                            at android.app.Activity.performCreate(Activity.java:5372)
                                                                            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
                                                                            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2270)

Nativeutilis Class:

```<code>public class NativeUtils {
    public static native byte[] rsasign(byte[] input,int pkey) throws InvalidKeyException;
    public static native String[] getIfconfig() throws  IllegalArgumentException;
    static native void jniclose(int fdint);

    static {
    //  System.loadLibrary("opencv_java");
        System.loadLibrary("stlport_shared");
        System.loadLibrary("opvpnutil");
        System.loadLibrary("openvpn");
        System.loadLibrary("ssl");
        if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN)
        System.loadLibrary("crypto");
    }
}
</code>```

The OpenVpnManagementThread Class:

```<code>   public class OpenVpnManagementThread implements Runnable, OpenVPNManagement {

    private static final String TAG = "Durai";
    private LocalSocket mSocket;
    private VpnProfile mProfile;
    private OpenVPNService mOpenVPNService;
    private LinkedList<FileDescriptor> mFDList = new LinkedList<FileDescriptor>();
    private LocalServerSocket mServerSocket;
    private boolean mReleaseHold = true;
    private boolean mWaitingForRelease = false;
    private long mLastHoldRelease = 0;

    private static final Vector<OpenVpnManagementThread> active = new Vector<OpenVpnManagementThread>();
    private LocalSocket mServerSocketLocal;

    private pauseReason lastPauseReason = pauseReason.noNetwork;

    public OpenVpnManagementThread(VpnProfile profile, OpenVPNService openVpnService) {
        mProfile = profile;
        mOpenVPNService = openVpnService;

        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(openVpnService);
        boolean managemeNetworkState = prefs.getBoolean("netchangereconnect", true);
        if (managemeNetworkState)
            mReleaseHold = false;

    }

    public boolean openManagementInterface(@NotNull Context c) {
        // Could take a while to open connection
        int tries = 8;

        String socketName = (c.getCacheDir().getAbsolutePath() + "/" + "mgmtsocket");
        // The mServerSocketLocal is transferred to the LocalServerSocket, ignore warning

        mServerSocketLocal = new LocalSocket();

        while (tries > 0 && !mServerSocketLocal.isConnected()) {
            try {
                mServerSocketLocal.bind(new LocalSocketAddress(socketName,
                        LocalSocketAddress.Namespace.FILESYSTEM));
            } catch (IOException e) {
                // wait 300 ms before retrying
                try {
                    Thread.sleep(300);
                } catch (InterruptedException e1) {
                }

            }
            tries--;
        }

        try {

            mServerSocket = new LocalServerSocket(mServerSocketLocal.getFileDescriptor());
            return true;
        } catch (IOException e) {
            VpnStatus.logException(e);
        }
        return false;

    }

    public void managmentCommand(String cmd) {
        try {
            if (mSocket != null && mSocket.getOutputStream() != null) {
                mSocket.getOutputStream().write(cmd.getBytes());
                mSocket.getOutputStream().flush();
            }
        } catch (IOException e) {
            // Ignore socket stack traces
        }
    }

    @Override
    public void run() {
        byte[] buffer = new byte[2048];
        //  mSocket.setSoTimeout(5); // Setting a timeout cannot be that bad

        String pendingInput = "";
        synchronized (active) {
            active.add(this);
        }

        try {
            // Wait for a client to connect
            mSocket = mServerSocket.accept();
            InputStream instream = mSocket.getInputStream();
            // Close the management socket after client connected

            mServerSocket.close();
            // Closing one of the two sockets also closes the other
            //mServerSocketLocal.close();

            while (true) {
                int numbytesread = instream.read(buffer);
                if (numbytesread == -1)
                    return;

                FileDescriptor[] fds = null;
                try {
                    fds = mSocket.getAncillaryFileDescriptors();
                } catch (IOException e) {
                    VpnStatus.logException("Error reading fds from socket", e);
                }
                if (fds != null) {
                    Collections.addAll(mFDList, fds);
                }

                String input = new String(buffer, 0, numbytesread, "UTF-8");

                pendingInput += input;

                pendingInput = processInput(pendingInput);

            }
        } catch (IOException e) {
            if (!e.getMessage().equals("socket closed") && !e.getMessage().equals("Connection reset by peer"))
                VpnStatus.logException(e);
        }
        synchronized (active) {
            active.remove(this);
        }
    }

    //! Hack O Rama 2000!
    private void protectFileDescriptor(FileDescriptor fd) {
        Exception exp;
        try {
            Method getInt = FileDescriptor.class.getDeclaredMethod("getInt$");
            int fdint = (Integer) getInt.invoke(fd);
            boolean result = mOpenVPNService.protect(fdint);
            if (!result)
                VpnStatus.logWarning("Could not protect VPN socket");
            NativeUtils.jniclose(fdint);
            return;
        } catch (NoSuchMethodException e) {
            exp = e;
        } catch (IllegalArgumentException e) {
            exp = e;
        } catch (IllegalAccessException e) {
            exp = e;
        } catch (InvocationTargetException e) {
            exp = e;
        } catch (NullPointerException e) {
            exp = e;
        }

        Log.d("Openvpn", "Failed to retrieve fd from socket: " + fd);
        VpnStatus.logException("Failed to retrieve fd from socket (" + fd + ")", exp);
    }

    private String processInput(String pendingInput) {

        while (pendingInput.contains("\n")) {
            String[] tokens = pendingInput.split("\\r?\\n", 2);
            processCommand(tokens[0]);
            if (tokens.length == 1)
                // No second part, newline was at the end
                pendingInput = "";
            else
                pendingInput = tokens[1];
        }
        return pendingInput;
    }

    private void processCommand(String command) {
        //Log.i(TAG, "Line from managment" + command);

        if (command.startsWith(">") && command.contains(":")) {
            String[] parts = command.split(":", 2);
            String cmd = parts[0].substring(1);
            String argument = parts[1];

            if (cmd.equals("INFO")) {
                /* Ignore greeting from management */
                return;
            } else if (cmd.equals("PASSWORD")) {
                processPWCommand(argument);
            } else if (cmd.equals("HOLD")) {
                handleHold();
            } else if (cmd.equals("NEED-OK")) {
                processNeedCommand(argument);
            } else if (cmd.equals("BYTECOUNT")) {
                processByteCount(argument);
            } else if (cmd.equals("STATE")) {
                processState(argument);
            } else if (cmd.equals("PROXY")) {
                processProxyCMD(argument);
            } else if (cmd.equals("LOG")) {
                processLogMessage(argument);
            } else if (cmd.equals("RSA_SIGN")) {
                processSignCommand(argument);
            } else {
                VpnStatus.logWarning("MGMT: Got unrecognized command" + command);
                Log.i(TAG, "Got unrecognized command" + command);
            }
        } else if (command.startsWith("SUCCESS:")) {
            /* Ignore this kind of message too */
            return;
        } else if (command.startsWith("PROTECTFD: ")) {
            FileDescriptor fdtoprotect = mFDList.pollFirst();
            if (fdtoprotect != null)
                protectFileDescriptor(fdtoprotect);
        } else {
            Log.i(TAG, "Got unrecognized line from managment" + command);
            VpnStatus.logWarning("MGMT: Got unrecognized line from management:" + command);
        }
    }

    private void processLogMessage(String argument) {
        String[] args = argument.split(",", 4);
        Log.d("OpenVPN", argument);

        VpnStatus.LogLevel level;
        if (args[1].equals("I")) {
            level = VpnStatus.LogLevel.INFO;
        } else if (args[1].equals("W")) {
            level = VpnStatus.LogLevel.WARNING;
        } else if (args[1].equals("D")) {
            level = VpnStatus.LogLevel.VERBOSE;
        } else if (args[1].equals("F")) {
            level = VpnStatus.LogLevel.ERROR;
        } else {
            level = VpnStatus.LogLevel.INFO;
        }

        int ovpnlevel = Integer.parseInt(args[2]) & 0x0F;
        String msg = args[3];

        if (msg.startsWith("MANAGEMENT: CMD"))
            ovpnlevel = Math.max(4, ovpnlevel);

        VpnStatus.logMessageOpenVPN(level, ovpnlevel, msg);
    }

    private void handleHold() {
        if (mReleaseHold) {
            releaseHoldCmd();
        } else {
            mWaitingForRelease = true;
            VpnStatus.updateStatePause(lastPauseReason);

        }
    }

    private void releaseHoldCmd() {
        if ((System.currentTimeMillis() - mLastHoldRelease) < 5000) {
            try {
                Thread.sleep(3000);
            } catch (InterruptedException ignored) {
            }

        }
        mWaitingForRelease = false;
        mLastHoldRelease = System.currentTimeMillis();
        managmentCommand("hold release\n");
        managmentCommand("bytecount " + mBytecountInterval + "\n");
        managmentCommand("state on\n");
    }

    public void releaseHold() {
        mReleaseHold = true;
        if (mWaitingForRelease)
            releaseHoldCmd();

    }

    private void processProxyCMD(String argument) {
        String[] args = argument.split(",", 3);
        SocketAddress proxyaddr = ProxyDetection.detectProxy(mProfile);

        if (args.length >= 2) {
            String proto = args[1];
            if (proto.equals("UDP")) {
                proxyaddr = null;
            }
        }

        if (proxyaddr instanceof InetSocketAddress) {
            InetSocketAddress isa = (InetSocketAddress) proxyaddr;

            VpnStatus.logInfo(R.string.using_proxy, isa.getHostName(), isa.getPort());

            String proxycmd = String.format(Locale.ENGLISH, "proxy HTTP %s %d\n", isa.getHostName(), isa.getPort());
            managmentCommand(proxycmd);
        } else {
            managmentCommand("proxy NONE\n");
        }

    }

    private void processState(String argument) {
        String[] args = argument.split(",", 3);
        String currentstate = args[1];

        if (args[2].equals(",,"))
            VpnStatus.updateStateString(currentstate, "");
        else
            VpnStatus.updateStateString(currentstate, args[2]);
    }

    private void processByteCount(String argument) {
        //   >BYTECOUNT:{BYTES_IN},{BYTES_OUT}
        int comma = argument.indexOf(',');
        long in = Long.parseLong(argument.substring(0, comma));
        long out = Long.parseLong(argument.substring(comma + 1));
        VpnStatus.updateByteCount(in, out);
    }
    private void processNeedCommand(String argument) {
        int p1 = argument.indexOf('\'');
        int p2 = argument.indexOf('\'', p1 + 1);
        String needed = argument.substring(p1 + 1, p2);
        String extra = argument.split(":", 2)[1];
        String status = "ok";
        if (needed.equals("PROTECTFD")) {
            FileDescriptor fdtoprotect = mFDList.pollFirst();
            protectFileDescriptor(fdtoprotect);
        } else if (needed.equals("DNSSERVER")) {
            mOpenVPNService.addDNS(extra);
        } else if (needed.equals("DNSDOMAIN")) {
            mOpenVPNService.setDomain(extra);
        } else if (needed.equals("ROUTE")) {
            String[] routeparts = extra.split(" ");

            if (routeparts.length == 5) {
                if (BuildConfig.DEBUG) Assert.assertEquals("dev", routeparts[3]);
                mOpenVPNService.addRoute(routeparts[0], routeparts[1], routeparts[2], routeparts[4]);
            } else if (routeparts.length >= 3) {
                mOpenVPNService.addRoute(routeparts[0], routeparts[1], routeparts[2], null);
            } else {
                VpnStatus.logError("Unrecognized ROUTE cmd:" + Arrays.toString(routeparts) + " | " + argument);
            }

        } else if (needed.equals("ROUTE6")) {
            String[] routeparts = extra.split(" ");
            mOpenVPNService.addRoutev6(routeparts[0], routeparts[1]);
        } else if (needed.equals("IFCONFIG")) {
            String[] ifconfigparts = extra.split(" ");
            int mtu = Integer.parseInt(ifconfigparts[2]);
            mOpenVPNService.setLocalIP(ifconfigparts[0], ifconfigparts[1], mtu, ifconfigparts[3]);
        } else if (needed.equals("IFCONFIG6")) {
            mOpenVPNService.setLocalIPv6(extra);

        } else if (needed.equals("PERSIST_TUN_ACTION")) {
            // check if tun cfg stayed the same
            status = mOpenVPNService.getTunReopenStatus();
        } else if (needed.equals("OPENTUN")) {
            if (sendTunFD(needed, extra))
                return;
            else
                status = "cancel";
        } else {
            Log.e(TAG, "Unkown needok command " + argument);
            return;
        }
        String cmd = String.format("needok '%s' %s\n", needed, status);
        managmentCommand(cmd);
    }
    private boolean sendTunFD(String needed, String extra) {
        Exception exp;
        if (!extra.equals("tun")) {
            VpnStatus.logError(String.format("Device type %s requested, but only tun is possible with the Android API, sorry!", extra));
            return false;
        }
        ParcelFileDescriptor pfd = mOpenVPNService.openTun();
        if (pfd == null)
            return false;

        Method setInt;
        int fdint = pfd.getFd();
        try {
            setInt = FileDescriptor.class.getDeclaredMethod("setInt$", int.class);
            FileDescriptor fdtosend = new FileDescriptor();
            setInt.invoke(fdtosend, fdint);
            FileDescriptor[] fds = {fdtosend};
            mSocket.setFileDescriptorsForSend(fds);
            String cmd = String.format("needok '%s' %s\n", needed, "ok");
            managmentCommand(cmd);
            mSocket.setFileDescriptorsForSend(null);
            pfd.close();
            return true;
        } catch (NoSuchMethodException e) {
            exp = e;
        } catch (IllegalArgumentException e) {
            exp = e;
        } catch (IllegalAccessException e) {
            exp = e;
        } catch (InvocationTargetException e) {
            exp = e;
        } catch (IOException e) {
            exp = e;
        }
        VpnStatus.logException("Could not send fd over socket", exp);
        return false;
    }

    private void processPWCommand(String argument) {
        String needed;
        try {

            int p1 = argument.indexOf('\'');
            int p2 = argument.indexOf('\'', p1 + 1);
            needed = argument.substring(p1 + 1, p2);
            if (argument.startsWith("Verification Failed")) {
                proccessPWFailed(needed, argument.substring(p2 + 1));
                return;
            }
        } catch (StringIndexOutOfBoundsException sioob) {
            VpnStatus.logError("Could not parse management Password command: " + argument);
            return;
        }
        String pw = null;

        if (needed.equals("Private Key")) {
            pw = mProfile.getPasswordPrivateKey();
        } else if (needed.equals("Auth")) {
            String usercmd = String.format("username '%s' %s\n",
                    needed, VpnProfile.openVpnEscape(mProfile.mUsername));
            managmentCommand(usercmd);
            pw = mProfile.getPasswordAuth();
        }
        if (pw != null) {
            String cmd = String.format("password '%s' %s\n", needed, VpnProfile.openVpnEscape(pw));
            managmentCommand(cmd);
        } else {
            VpnStatus.logError(String.format("Openvpn requires Authentication type '%s' but no password/key information available", needed));
        }
    }

    private void proccessPWFailed(String needed, String args) {
        VpnStatus.updateStateString("AUTH_FAILED", needed + args,R.string.state_auth_failed, VpnStatus.ConnectionStatus.LEVEL_AUTH_FAILED);
    }
    private static boolean stopOpenVPN() {
        synchronized (active) {
            boolean sendCMD = false;
            for (OpenVpnManagementThread mt : active) {
                mt.managmentCommand("signal SIGINT\n");
                sendCMD = true;
                try {
                    if (mt.mSocket != null)
                        mt.mSocket.close();
                } catch (IOException e) {
                }
            }
            return sendCMD;
        }
    }

    @Override
    public void networkChange() {
        if (!mWaitingForRelease)
            managmentCommand("network-change\n");
    }

    public void signalusr1() {
        mReleaseHold = false;

        if (!mWaitingForRelease)
            managmentCommand("signal SIGUSR1\n");
        else
            VpnStatus.updateStatePause(lastPauseReason);
    }

    public void reconnect() {
        signalusr1();
        releaseHold();
    }
    private void processSignCommand(String b64data) {
        String signed_string = mProfile.getSignedData(b64data);
        if (signed_string == null) {
            managmentCommand("rsa-sig\n");
            managmentCommand("\nEND\n");
            stopOpenVPN();
            return;
        }
        managmentCommand("rsa-sig\n");
        managmentCommand(signed_string);
        managmentCommand("\nEND\n");
    }
    @Override
    public void pause(pauseReason reason) {
        lastPauseReason = reason;
        signalusr1();
    }

    @Override
    public void resume() {
        releaseHold();
        /* Reset the reason why we are disconnected */
        lastPauseReason = pauseReason.noNetwork;
    }
    @Override
    public boolean stopVPN() {
        return stopOpenVPN();
    }
}
</code>```

The MainActivity_vpn Class:

```<code>public class MainActivity_vpn extends Activity {
protected OpenVPNService mService;
boolean mBound = false;
private ServiceConnection mConnection = new ServiceConnection() {
    @Override
    public void onServiceConnected(ComponentName className,
                                   IBinder service) {
        OpenVPNService.LocalBinder binder = (OpenVPNService.LocalBinder) service;
        mService = binder.getService();
        mBound = true;
    }
    @Override
    public void onServiceDisconnected(ComponentName arg0) {
        mService =null;
        mBound = false;
    }
};
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main_vpn);
    Intent intent = new Intent(getBaseContext(), OpenVPNService.class);
    intent.setAction(OpenVPNService.START_SERVICE);
    bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
    registerReceiver(broadcastReceiver, new IntentFilter("CONNECTION_CHANGE"));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    getMenuInflater().inflate(R.menu.settingsmenu, menu);
    return true;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    if (Constants.isVPNConnected){
        // disable connect button if VPN is connected
        menu.getItem(0).setEnabled(false);
        // enable disconnect button if VPN is connected
        menu.getItem(1).setEnabled(true);
    } else{
        // enable connect button if VPN is disconnected
        menu.getItem(0).setEnabled(true);
        // disable disconnect button if VPN is disconnected
        menu.getItem(1).setEnabled(false);
    }
    return super.onPrepareOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
        case R.id.action_startvpn:
            configureAndStartVpn() ;
            return true ;
        case R.id.action_stopvpn:
            stopVPN() ;
            return true ;
        case R.id.action_removeProfile:
            removeProfile();
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
private void removeProfile() {

    final ProfileManager pm = ProfileManager.getInstance(MainActivity_vpn.this) ;
    final VpnProfile profile = pm.getProfileByName(Constants.VPN_PROFILE_NAME) ;

    if (profile != null) {
                        stopVPN() ;
                        pm.removeProfile(getApplicationContext(),profile);
                        int duration = Toast.LENGTH_SHORT;
                        Toast toast = Toast.makeText(MainActivity_vpn.this,"The VPN Configuration is deleted", duration);
                        toast.show();
    } else {
                int duration = Toast.LENGTH_LONG;
        Toast toast = Toast.makeText(MainActivity_vpn.this,"There are no VPN Configurations to delete", duration);toast.show();
    }
}
private void stopVPN() {
    try{
        ProfileManager.setConntectedVpnProfileDisconnected(MainActivity_vpn.this);
        if(mService.getManagement()!=null)
            mService.getManagement().stopVPN();
    }
    catch (Exception ex){
    }
}
private void configureAndStartVpn() {
    try {
                EditText Et_Ovpn = (EditText) findViewById(R.id.et_ovpn);

                String retVal = Et_Ovpn.getText().toString();

                if (retVal != null && retVal.trim().length()>0) {

                    byte[] buffer = retVal.getBytes() ;

                    VpnProfile vp = saveProfile(buffer) ;

                    if (vp != null) {
                        startVPN(vp) ;
                    }
                }
                else {
                    int duration = Toast.LENGTH_LONG;
                    Toast toast = Toast.makeText(MainActivity_vpn.this,"Connecting using the last vpn configuration", duration);
                    toast.show();
                    startVPN();
                }
    } catch (Exception e) {
        e.printStackTrace() ;
    }
}
private VpnProfile saveProfile(byte [] data) {

    ConfigParser cp = new ConfigParser();
    try {
        InputStreamReader isr = new InputStreamReader(new ByteArrayInputStream(data));
        cp.parseConfig(isr);
        VpnProfile vp = cp.convertProfile();
        ProfileManager vpl = ProfileManager.getInstance(this);
        vp.mName = Constants.VPN_PROFILE_NAME ;
        vpl.addProfile(vp);
        vpl.saveProfile(this, vp);
        vpl.saveProfileList(this);
        return vp ;
    } catch(Exception e) {
        return null ;
    }
}
public void startVPN(VpnProfile vp) {
    Intent intent = new Intent(getApplicationContext(),LaunchVPN.class);
    intent.putExtra(LaunchVPN.EXTRA_KEY, vp.getUUID().toString());
    intent.setAction(Intent.ACTION_MAIN);
    startActivity(intent);
}
private void startVPN() {

    ProfileManager pm = ProfileManager.getInstance(this) ;
    VpnProfile profile = pm.getProfileByName(Constants.VPN_PROFILE_NAME) ;

    if (profile == null) {
        int duration = Toast.LENGTH_LONG;
        Toast toast = Toast.makeText(MainActivity_vpn.this,"There are no VPN Configurations.So paste the .OVPN and try", duration);
        toast.show();
        return ;
    }

    Intent intent = new Intent(this,LaunchVPN.class);
    intent.putExtra(LaunchVPN.EXTRA_KEY, profile.getUUID().toString());
    intent.setAction(Intent.ACTION_MAIN);
    startActivity(intent);
}
BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
        stopVPN();
        startVPN();
    }
};

@Override
protected void onDestroy() {
    super.onDestroy();
    unregisterReceiver(broadcastReceiver);
}
</code>```

}

答:
i didn't take in my consideration that declarations of native methods should placed in the class with the same name and package as in donor project.
once i change the package name for native method the problem solved</p>

Body:
The Following message appear While developing an Open VPN application :
07-04 21:33:34.998 20337-21875/pioneers.safwat.myvpn6 E/AndroidRuntime: FATAL EXCEPTION: OpenVPNManagementThread
                                                                        java.lang.UnsatisfiedLinkError: Native method not found: pioneers.safwat.myvpn6.NativeUtils.jniclose:(I)V
                                                                            at pioneers.safwat.myvpn6.NativeUtils.jniclose(Native Method)
                                                                            at pioneers.safwat.myvpn6.OpenVpnManagementThread.protectFileDescriptor(OpenVpnManagementThread.java:175)
                                                                            at pioneers.safwat.myvpn6.OpenVpnManagementThread.processNeedCommand(OpenVpnManagementThread.java:387)
                                                                            at pioneers.safwat.myvpn6.OpenVpnManagementThread.processCommand(OpenVpnManagementThread.java:227)
                                                                            at pioneers.safwat.myvpn6.OpenVpnManagementThread.processInput(OpenVpnManagementThread.java:198)
                                                                            at pioneers.safwat.myvpn6.OpenVpnManagementThread.run(OpenVpnManagementThread.java:146)
                                                                            at java.lang.Thread.run(Thread.java:841)
07-04 21:33:35.288 20337-20337/pioneers.safwat.myvpn6 E/ActivityThread: Activity pioneers.safwat.myvpn6.MainActivity_vpn has leaked ServiceConnection pioneers.safwat.myvpn6.MainActivity_vpn$1@42537e00 that was originally bound here
                                                                        android.app.ServiceConnectionLeaked: Activity pioneers.safwat.myvpn6.MainActivity_vpn has leaked ServiceConnection pioneers.safwat.myvpn6.MainActivity_vpn$1@42537e00 that was originally bound here
                                                                            at android.app.LoadedApk$ServiceDispatcher.(LoadedApk.java:979)
                                                                            at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:873)
                                                                            at android.app.ContextImpl.bindServiceAsUser(ContextImpl.java:1850)
                                                                            at android.app.ContextImpl.bindService(ContextImpl.java:1838)
                                                                            at android.content.ContextWrapper.bindService(ContextWrapper.java:503)
                                                                            at pioneers.safwat.myvpn6.MainActivity_vpn.onCreate(MainActivity_vpn.java:53)
                                                                            at android.app.Activity.performCreate(Activity.java:5372)
                                                                            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
                                                                            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2270)

Nativeutilis Class:

public class NativeUtils {
    public static native byte[] rsasign(byte[] input,int pkey) throws InvalidKeyException;
    public static native String[] getIfconfig() throws  IllegalArgumentException;
    static native void jniclose(int fdint);

    static {
    //  System.loadLibrary("opencv_java");
        System.loadLibrary("stlport_shared");
        System.loadLibrary("opvpnutil");
        System.loadLibrary("openvpn");
        System.loadLibrary("ssl");
        if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN)
        System.loadLibrary("crypto");
    }
}

The OpenVpnManagementThread Class:

   public class OpenVpnManagementThread implements Runnable, OpenVPNManagement {

    private static final String TAG = "Durai";
    private LocalSocket mSocket;
    private VpnProfile mProfile;
    private OpenVPNService mOpenVPNService;
    private LinkedList<FileDescriptor> mFDList = new LinkedList<FileDescriptor>();
    private LocalServerSocket mServerSocket;
    private boolean mReleaseHold = true;
    private boolean mWaitingForRelease = false;
    private long mLastHoldRelease = 0;

    private static final Vector<OpenVpnManagementThread> active = new Vector<OpenVpnManagementThread>();
    private LocalSocket mServerSocketLocal;

    private pauseReason lastPauseReason = pauseReason.noNetwork;

    public OpenVpnManagementThread(VpnProfile profile, OpenVPNService openVpnService) {
        mProfile = profile;
        mOpenVPNService = openVpnService;

        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(openVpnService);
        boolean managemeNetworkState = prefs.getBoolean("netchangereconnect", true);
        if (managemeNetworkState)
            mReleaseHold = false;

    }

    public boolean openManagementInterface(@NotNull Context c) {
        // Could take a while to open connection
        int tries = 8;

        String socketName = (c.getCacheDir().getAbsolutePath() + "/" + "mgmtsocket");
        // The mServerSocketLocal is transferred to the LocalServerSocket, ignore warning

        mServerSocketLocal = new LocalSocket();

        while (tries > 0 && !mServerSocketLocal.isConnected()) {
            try {
                mServerSocketLocal.bind(new LocalSocketAddress(socketName,
                        LocalSocketAddress.Namespace.FILESYSTEM));
            } catch (IOException e) {
                // wait 300 ms before retrying
                try {
                    Thread.sleep(300);
                } catch (InterruptedException e1) {
                }

            }
            tries--;
        }

        try {

            mServerSocket = new LocalServerSocket(mServerSocketLocal.getFileDescriptor());
            return true;
        } catch (IOException e) {
            VpnStatus.logException(e);
        }
        return false;

    }

    public void managmentCommand(String cmd) {
        try {
            if (mSocket != null && mSocket.getOutputStream() != null) {
                mSocket.getOutputStream().write(cmd.getBytes());
                mSocket.getOutputStream().flush();
            }
        } catch (IOException e) {
            // Ignore socket stack traces
        }
    }

    @Override
    public void run() {
        byte[] buffer = new byte[2048];
        //  mSocket.setSoTimeout(5); // Setting a timeout cannot be that bad

        String pendingInput = "";
        synchronized (active) {
            active.add(this);
        }

        try {
            // Wait for a client to connect
            mSocket = mServerSocket.accept();
            InputStream instream = mSocket.getInputStream();
            // Close the management socket after client connected

            mServerSocket.close();
            // Closing one of the two sockets also closes the other
            //mServerSocketLocal.close();

            while (true) {
                int numbytesread = instream.read(buffer);
                if (numbytesread == -1)
                    return;

                FileDescriptor[] fds = null;
                try {
                    fds = mSocket.getAncillaryFileDescriptors();
                } catch (IOException e) {
                    VpnStatus.logException("Error reading fds from socket", e);
                }
                if (fds != null) {
                    Collections.addAll(mFDList, fds);
                }

                String input = new String(buffer, 0, numbytesread, "UTF-8");

                pendingInput += input;

                pendingInput = processInput(pendingInput);

            }
        } catch (IOException e) {
            if (!e.getMessage().equals("socket closed") && !e.getMessage().equals("Connection reset by peer"))
                VpnStatus.logException(e);
        }
        synchronized (active) {
            active.remove(this);
        }
    }

    //! Hack O Rama 2000!
    private void protectFileDescriptor(FileDescriptor fd) {
        Exception exp;
        try {
            Method getInt = FileDescriptor.class.getDeclaredMethod("getInt$");
            int fdint = (Integer) getInt.invoke(fd);
            boolean result = mOpenVPNService.protect(fdint);
            if (!result)
                VpnStatus.logWarning("Could not protect VPN socket");
            NativeUtils.jniclose(fdint);
            return;
        } catch (NoSuchMethodException e) {
            exp = e;
        } catch (IllegalArgumentException e) {
            exp = e;
        } catch (IllegalAccessException e) {
            exp = e;
        } catch (InvocationTargetException e) {
            exp = e;
        } catch (NullPointerException e) {
            exp = e;
        }

        Log.d("Openvpn", "Failed to retrieve fd from socket: " + fd);
        VpnStatus.logException("Failed to retrieve fd from socket (" + fd + ")", exp);
    }

    private String processInput(String pendingInput) {

        while (pendingInput.contains("\n")) {
            String[] tokens = pendingInput.split("\\r?\\n", 2);
            processCommand(tokens[0]);
            if (tokens.length == 1)
                // No second part, newline was at the end
                pendingInput = "";
            else
                pendingInput = tokens[1];
        }
        return pendingInput;
    }

    private void processCommand(String command) {
        //Log.i(TAG, "Line from managment" + command);

        if (command.startsWith(">") && command.contains(":")) {
            String[] parts = command.split(":", 2);
            String cmd = parts[0].substring(1);
            String argument = parts[1];

            if (cmd.equals("INFO")) {
                /* Ignore greeting from management */
                return;
            } else if (cmd.equals("PASSWORD")) {
                processPWCommand(argument);
            } else if (cmd.equals("HOLD")) {
                handleHold();
            } else if (cmd.equals("NEED-OK")) {
                processNeedCommand(argument);
            } else if (cmd.equals("BYTECOUNT")) {
                processByteCount(argument);
            } else if (cmd.equals("STATE")) {
                processState(argument);
            } else if (cmd.equals("PROXY")) {
                processProxyCMD(argument);
            } else if (cmd.equals("LOG")) {
                processLogMessage(argument);
            } else if (cmd.equals("RSA_SIGN")) {
                processSignCommand(argument);
            } else {
                VpnStatus.logWarning("MGMT: Got unrecognized command" + command);
                Log.i(TAG, "Got unrecognized command" + command);
            }
        } else if (command.startsWith("SUCCESS:")) {
            /* Ignore this kind of message too */
            return;
        } else if (command.startsWith("PROTECTFD: ")) {
            FileDescriptor fdtoprotect = mFDList.pollFirst();
            if (fdtoprotect != null)
                protectFileDescriptor(fdtoprotect);
        } else {
            Log.i(TAG, "Got unrecognized line from managment" + command);
            VpnStatus.logWarning("MGMT: Got unrecognized line from management:" + command);
        }
    }

    private void processLogMessage(String argument) {
        String[] args = argument.split(",", 4);
        Log.d("OpenVPN", argument);

        VpnStatus.LogLevel level;
        if (args[1].equals("I")) {
            level = VpnStatus.LogLevel.INFO;
        } else if (args[1].equals("W")) {
            level = VpnStatus.LogLevel.WARNING;
        } else if (args[1].equals("D")) {
            level = VpnStatus.LogLevel.VERBOSE;
        } else if (args[1].equals("F")) {
            level = VpnStatus.LogLevel.ERROR;
        } else {
            level = VpnStatus.LogLevel.INFO;
        }

        int ovpnlevel = Integer.parseInt(args[2]) & 0x0F;
        String msg = args[3];

        if (msg.startsWith("MANAGEMENT: CMD"))
            ovpnlevel = Math.max(4, ovpnlevel);

        VpnStatus.logMessageOpenVPN(level, ovpnlevel, msg);
    }

    private void handleHold() {
        if (mReleaseHold) {
            releaseHoldCmd();
        } else {
            mWaitingForRelease = true;
            VpnStatus.updateStatePause(lastPauseReason);

        }
    }

    private void releaseHoldCmd() {
        if ((System.currentTimeMillis() - mLastHoldRelease) < 5000) {
            try {
                Thread.sleep(3000);
            } catch (InterruptedException ignored) {
            }

        }
        mWaitingForRelease = false;
        mLastHoldRelease = System.currentTimeMillis();
        managmentCommand("hold release\n");
        managmentCommand("bytecount " + mBytecountInterval + "\n");
        managmentCommand("state on\n");
    }

    public void releaseHold() {
        mReleaseHold = true;
        if (mWaitingForRelease)
            releaseHoldCmd();

    }

    private void processProxyCMD(String argument) {
        String[] args = argument.split(",", 3);
        SocketAddress proxyaddr = ProxyDetection.detectProxy(mProfile);

        if (args.length >= 2) {
            String proto = args[1];
            if (proto.equals("UDP")) {
                proxyaddr = null;
            }
        }

        if (proxyaddr instanceof InetSocketAddress) {
            InetSocketAddress isa = (InetSocketAddress) proxyaddr;

            VpnStatus.logInfo(R.string.using_proxy, isa.getHostName(), isa.getPort());

            String proxycmd = String.format(Locale.ENGLISH, "proxy HTTP %s %d\n", isa.getHostName(), isa.getPort());
            managmentCommand(proxycmd);
        } else {
            managmentCommand("proxy NONE\n");
        }

    }

    private void processState(String argument) {
        String[] args = argument.split(",", 3);
        String currentstate = args[1];

        if (args[2].equals(",,"))
            VpnStatus.updateStateString(currentstate, "");
        else
            VpnStatus.updateStateString(currentstate, args[2]);
    }

    private void processByteCount(String argument) {
        //   >BYTECOUNT:{BYTES_IN},{BYTES_OUT}
        int comma = argument.indexOf(',');
        long in = Long.parseLong(argument.substring(0, comma));
        long out = Long.parseLong(argument.substring(comma + 1));
        VpnStatus.updateByteCount(in, out);
    }
    private void processNeedCommand(String argument) {
        int p1 = argument.indexOf('\'');
        int p2 = argument.indexOf('\'', p1 + 1);
        String needed = argument.substring(p1 + 1, p2);
        String extra = argument.split(":", 2)[1];
        String status = "ok";
        if (needed.equals("PROTECTFD")) {
            FileDescriptor fdtoprotect = mFDList.pollFirst();
            protectFileDescriptor(fdtoprotect);
        } else if (needed.equals("DNSSERVER")) {
            mOpenVPNService.addDNS(extra);
        } else if (needed.equals("DNSDOMAIN")) {
            mOpenVPNService.setDomain(extra);
        } else if (needed.equals("ROUTE")) {
            String[] routeparts = extra.split(" ");

            if (routeparts.length == 5) {
                if (BuildConfig.DEBUG) Assert.assertEquals("dev", routeparts[3]);
                mOpenVPNService.addRoute(routeparts[0], routeparts[1], routeparts[2], routeparts[4]);
            } else if (routeparts.length >= 3) {
                mOpenVPNService.addRoute(routeparts[0], routeparts[1], routeparts[2], null);
            } else {
                VpnStatus.logError("Unrecognized ROUTE cmd:" + Arrays.toString(routeparts) + " | " + argument);
            }

        } else if (needed.equals("ROUTE6")) {
            String[] routeparts = extra.split(" ");
            mOpenVPNService.addRoutev6(routeparts[0], routeparts[1]);
        } else if (needed.equals("IFCONFIG")) {
            String[] ifconfigparts = extra.split(" ");
            int mtu = Integer.parseInt(ifconfigparts[2]);
            mOpenVPNService.setLocalIP(ifconfigparts[0], ifconfigparts[1], mtu, ifconfigparts[3]);
        } else if (needed.equals("IFCONFIG6")) {
            mOpenVPNService.setLocalIPv6(extra);

        } else if (needed.equals("PERSIST_TUN_ACTION")) {
            // check if tun cfg stayed the same
            status = mOpenVPNService.getTunReopenStatus();
        } else if (needed.equals("OPENTUN")) {
            if (sendTunFD(needed, extra))
                return;
            else
                status = "cancel";
        } else {
            Log.e(TAG, "Unkown needok command " + argument);
            return;
        }
        String cmd = String.format("needok '%s' %s\n", needed, status);
        managmentCommand(cmd);
    }
    private boolean sendTunFD(String needed, String extra) {
        Exception exp;
        if (!extra.equals("tun")) {
            VpnStatus.logError(String.format("Device type %s requested, but only tun is possible with the Android API, sorry!", extra));
            return false;
        }
        ParcelFileDescriptor pfd = mOpenVPNService.openTun();
        if (pfd == null)
            return false;

        Method setInt;
        int fdint = pfd.getFd();
        try {
            setInt = FileDescriptor.class.getDeclaredMethod("setInt$", int.class);
            FileDescriptor fdtosend = new FileDescriptor();
            setInt.invoke(fdtosend, fdint);
            FileDescriptor[] fds = {fdtosend};
            mSocket.setFileDescriptorsForSend(fds);
            String cmd = String.format("needok '%s' %s\n", needed, "ok");
            managmentCommand(cmd);
            mSocket.setFileDescriptorsForSend(null);
            pfd.close();
            return true;
        } catch (NoSuchMethodException e) {
            exp = e;
        } catch (IllegalArgumentException e) {
            exp = e;
        } catch (IllegalAccessException e) {
            exp = e;
        } catch (InvocationTargetException e) {
            exp = e;
        } catch (IOException e) {
            exp = e;
        }
        VpnStatus.logException("Could not send fd over socket", exp);
        return false;
    }

    private void processPWCommand(String argument) {
        String needed;
        try {

            int p1 = argument.indexOf('\'');
            int p2 = argument.indexOf('\'', p1 + 1);
            needed = argument.substring(p1 + 1, p2);
            if (argument.startsWith("Verification Failed")) {
                proccessPWFailed(needed, argument.substring(p2 + 1));
                return;
            }
        } catch (StringIndexOutOfBoundsException sioob) {
            VpnStatus.logError("Could not parse management Password command: " + argument);
            return;
        }
        String pw = null;

        if (needed.equals("Private Key")) {
            pw = mProfile.getPasswordPrivateKey();
        } else if (needed.equals("Auth")) {
            String usercmd = String.format("username '%s' %s\n",
                    needed, VpnProfile.openVpnEscape(mProfile.mUsername));
            managmentCommand(usercmd);
            pw = mProfile.getPasswordAuth();
        }
        if (pw != null) {
            String cmd = String.format("password '%s' %s\n", needed, VpnProfile.openVpnEscape(pw));
            managmentCommand(cmd);
        } else {
            VpnStatus.logError(String.format("Openvpn requires Authentication type '%s' but no password/key information available", needed));
        }
    }

    private void proccessPWFailed(String needed, String args) {
        VpnStatus.updateStateString("AUTH_FAILED", needed + args,R.string.state_auth_failed, VpnStatus.ConnectionStatus.LEVEL_AUTH_FAILED);
    }
    private static boolean stopOpenVPN() {
        synchronized (active) {
            boolean sendCMD = false;
            for (OpenVpnManagementThread mt : active) {
                mt.managmentCommand("signal SIGINT\n");
                sendCMD = true;
                try {
                    if (mt.mSocket != null)
                        mt.mSocket.close();
                } catch (IOException e) {
                }
            }
            return sendCMD;
        }
    }

    @Override
    public void networkChange() {
        if (!mWaitingForRelease)
            managmentCommand("network-change\n");
    }

    public void signalusr1() {
        mReleaseHold = false;

        if (!mWaitingForRelease)
            managmentCommand("signal SIGUSR1\n");
        else
            VpnStatus.updateStatePause(lastPauseReason);
    }

    public void reconnect() {
        signalusr1();
        releaseHold();
    }
    private void processSignCommand(String b64data) {
        String signed_string = mProfile.getSignedData(b64data);
        if (signed_string == null) {
            managmentCommand("rsa-sig\n");
            managmentCommand("\nEND\n");
            stopOpenVPN();
            return;
        }
        managmentCommand("rsa-sig\n");
        managmentCommand(signed_string);
        managmentCommand("\nEND\n");
    }
    @Override
    public void pause(pauseReason reason) {
        lastPauseReason = reason;
        signalusr1();
    }

    @Override
    public void resume() {
        releaseHold();
        /* Reset the reason why we are disconnected */
        lastPauseReason = pauseReason.noNetwork;
    }
    @Override
    public boolean stopVPN() {
        return stopOpenVPN();
    }
}

The MainActivity_vpn Class:

public class MainActivity_vpn extends Activity {
protected OpenVPNService mService;
boolean mBound = false;
private ServiceConnection mConnection = new ServiceConnection() {
    @Override
    public void onServiceConnected(ComponentName className,
                                   IBinder service) {
        OpenVPNService.LocalBinder binder = (OpenVPNService.LocalBinder) service;
        mService = binder.getService();
        mBound = true;
    }
    @Override
    public void onServiceDisconnected(ComponentName arg0) {
        mService =null;
        mBound = false;
    }
};
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main_vpn);
    Intent intent = new Intent(getBaseContext(), OpenVPNService.class);
    intent.setAction(OpenVPNService.START_SERVICE);
    bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
    registerReceiver(broadcastReceiver, new IntentFilter("CONNECTION_CHANGE"));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    getMenuInflater().inflate(R.menu.settingsmenu, menu);
    return true;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    if (Constants.isVPNConnected){
        // disable connect button if VPN is connected
        menu.getItem(0).setEnabled(false);
        // enable disconnect button if VPN is connected
        menu.getItem(1).setEnabled(true);
    } else{
        // enable connect button if VPN is disconnected
        menu.getItem(0).setEnabled(true);
        // disable disconnect button if VPN is disconnected
        menu.getItem(1).setEnabled(false);
    }
    return super.onPrepareOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
        case R.id.action_startvpn:
            configureAndStartVpn() ;
            return true ;
        case R.id.action_stopvpn:
            stopVPN() ;
            return true ;
        case R.id.action_removeProfile:
            removeProfile();
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
private void removeProfile() {

    final ProfileManager pm = ProfileManager.getInstance(MainActivity_vpn.this) ;
    final VpnProfile profile = pm.getProfileByName(Constants.VPN_PROFILE_NAME) ;

    if (profile != null) {
                        stopVPN() ;
                        pm.removeProfile(getApplicationContext(),profile);
                        int duration = Toast.LENGTH_SHORT;
                        Toast toast = Toast.makeText(MainActivity_vpn.this,"The VPN Configuration is deleted", duration);
                        toast.show();
    } else {
                int duration = Toast.LENGTH_LONG;
        Toast toast = Toast.makeText(MainActivity_vpn.this,"There are no VPN Configurations to delete", duration);toast.show();
    }
}
private void stopVPN() {
    try{
        ProfileManager.setConntectedVpnProfileDisconnected(MainActivity_vpn.this);
        if(mService.getManagement()!=null)
            mService.getManagement().stopVPN();
    }
    catch (Exception ex){
    }
}
private void configureAndStartVpn() {
    try {
                EditText Et_Ovpn = (EditText) findViewById(R.id.et_ovpn);

                String retVal = Et_Ovpn.getText().toString();

                if (retVal != null && retVal.trim().length()>0) {

                    byte[] buffer = retVal.getBytes() ;

                    VpnProfile vp = saveProfile(buffer) ;

                    if (vp != null) {
                        startVPN(vp) ;
                    }
                }
                else {
                    int duration = Toast.LENGTH_LONG;
                    Toast toast = Toast.makeText(MainActivity_vpn.this,"Connecting using the last vpn configuration", duration);
                    toast.show();
                    startVPN();
                }
    } catch (Exception e) {
        e.printStackTrace() ;
    }
}
private VpnProfile saveProfile(byte [] data) {

    ConfigParser cp = new ConfigParser();
    try {
        InputStreamReader isr = new InputStreamReader(new ByteArrayInputStream(data));
        cp.parseConfig(isr);
        VpnProfile vp = cp.convertProfile();
        ProfileManager vpl = ProfileManager.getInstance(this);
        vp.mName = Constants.VPN_PROFILE_NAME ;
        vpl.addProfile(vp);
        vpl.saveProfile(this, vp);
        vpl.saveProfileList(this);
        return vp ;
    } catch(Exception e) {
        return null ;
    }
}
public void startVPN(VpnProfile vp) {
    Intent intent = new Intent(getApplicationContext(),LaunchVPN.class);
    intent.putExtra(LaunchVPN.EXTRA_KEY, vp.getUUID().toString());
    intent.setAction(Intent.ACTION_MAIN);
    startActivity(intent);
}
private void startVPN() {

    ProfileManager pm = ProfileManager.getInstance(this) ;
    VpnProfile profile = pm.getProfileByName(Constants.VPN_PROFILE_NAME) ;

    if (profile == null) {
        int duration = Toast.LENGTH_LONG;
        Toast toast = Toast.makeText(MainActivity_vpn.this,"There are no VPN Configurations.So paste the .OVPN and try", duration);
        toast.show();
        return ;
    }

    Intent intent = new Intent(this,LaunchVPN.class);
    intent.putExtra(LaunchVPN.EXTRA_KEY, profile.getUUID().toString());
    intent.setAction(Intent.ACTION_MAIN);
    startActivity(intent);
}
BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
        stopVPN();
        startVPN();
    }
};

@Override
protected void onDestroy() {
    super.onDestroy();
    unregisterReceiver(broadcastReceiver);
}

}


问:
why .NoSuchMethodError: org.springframework.core.convert.converter.ConverterRegistry.addConverter
My maven project uses spring, hibernate. I get "no such method error". I believe it is due to some conflict in version in dependencies but dont know what.
The build is successful. But during "NetBeans: Deploying on GlassFish Server 4.0" (i use the run button in Netbeans), i get below error which i have tried hard to eliminate without success. Any assistance is appreciated...

```<code>failed on GlassFish Server 4.0
 Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.NoSuchMethodError: org.springframework.core.convert.converter.ConverterRegistry.addConverter(Ljava/lang/Class;Ljava/lang/Class;Lorg/springframework/core/convert/converter/Converter;)V.
</code>```

Below i my pom.xml

```<code><?xml version="1.0" encoding="UTF-8"?>
<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>Spring3HibernateMaven</groupId>
    <artifactId>AttestationSpring3HibernateMaven</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <description></description>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.0</version>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>javax.persistence</groupId>
            <artifactId>persistence-api</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>
        <!-- === -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>4.2.7.Final</version>
        </dependency>
         <!-- === -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-annotations</artifactId>
            <version>3.5.6-Final</version>
            <exclusions>
                <exclusion>
                    <artifactId>hibernate-commons-annotations</artifactId>
                    <groupId>org.hibernate</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.2.7.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>5.0.1.Final</version>
        </dependency>

<!-- === -->
       <!--
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>3.3.2.GA</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-annotations</artifactId>
            <version>3.3.1.GA</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.2.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>4.2.0.Final</version>
            <type>jar</type>
        </dependency>

        -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.4.2</version>
        </dependency>
        <dependency>
            <groupId>taglibs</groupId>
            <artifactId>standard</artifactId>
            <version>1.1.2</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.1.2</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.10</version>
        </dependency>
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>20030825.184428</version>
        </dependency>
        <dependency>
            <groupId>commons-pool</groupId>
            <artifactId>commons-pool</artifactId>
            <version>20030825.183949</version>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.6.1</version>
            <type>jar</type>
        </dependency>
    </dependencies>
    <properties>
        <org.springframework.version>3.2.1.RELEASE
        </org.springframework.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <netbeans.hint.deploy.server>gfv4ee7</netbeans.hint.deploy.server>
    </properties>
    <name>AttestationSpring3HibernateMaven</name>
</project>
</code>```

Below is my spring-servlet.xml where datasource, sessionfactory configurations are made..

```<code><bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource"
    p:driverClassName="${jdbc.driverClassName}"
    p:url="${jdbc.databaseurl}" p:username="${jdbc.username}"
    p:password="${jdbc.password}" />

<bean id="sessionFactory"
    class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">

        <property name="dataSource" ref="dataSource"/>
    <property name="packagesToScan" value="org.attestation.entities" />
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
            <prop key="hibernate.show_sql">true</prop>
        </props>

    </property>
        <!--======

    <property name="dataSource" ref="dataSource" />
    <property name="configLocation">
        <value>classpath:hibernate.cfg.xml</value>
    </property>
    <property name="configurationClass">
        <value>org.hibernate.cfg.AnnotationConfiguration</value>
    </property>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">${jdbc.dialect}</prop>
            <prop key="hibernate.show_sql">true</prop>
        </props>
    </property>
            -->
</bean>

<tx:annotation-driven />

<bean id="transactionManager"
    class="org.springframework.orm.hibernate4.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
</bean>
</code>```

答:
Just had one of our junior developers here had a very similar error with a spring boot app. Turns out IntelliJ was messed up, we quit IntelliJ, deleted the ".idea" folder within the project, and re-opened. Things worked just fine after that.

It seems that there must have been some caching that IntelliJ was doing to either store libraries or resolve dependencies. And somehow that cache got corrupted.

I know that the original post mentioned NetBeans (not IntelliJ) but I figured leaving this answer here might help. I don't have enough reputation to comment.

Body:
My maven project uses spring, hibernate. I get "no such method error". I believe it is due to some conflict in version in dependencies but dont know what.
The build is successful. But during "NetBeans: Deploying on GlassFish Server 4.0" (i use the run button in Netbeans), i get below error which i have tried hard to eliminate without success. Any assistance is appreciated...

failed on GlassFish Server 4.0
 Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.NoSuchMethodError: org.springframework.core.convert.converter.ConverterRegistry.addConverter(Ljava/lang/Class;Ljava/lang/Class;Lorg/springframework/core/convert/converter/Converter;)V.

Below i my pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>Spring3HibernateMaven</groupId>
    <artifactId>AttestationSpring3HibernateMaven</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <description></description>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.0</version>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>javax.persistence</groupId>
            <artifactId>persistence-api</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${org.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>4.2.7.Final</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-annotations</artifactId>
            <version>3.5.6-Final</version>
            <exclusions>
                <exclusion>
                    <artifactId>hibernate-commons-annotations</artifactId>
                    <groupId>org.hibernate</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.2.7.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>5.0.1.Final</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.4.2</version>
        </dependency>
        <dependency>
            <groupId>taglibs</groupId>
            <artifactId>standard</artifactId>
            <version>1.1.2</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.1.2</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.10</version>
        </dependency>
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>20030825.184428</version>
        </dependency>
        <dependency>
            <groupId>commons-pool</groupId>
            <artifactId>commons-pool</artifactId>
            <version>20030825.183949</version>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.6.1</version>
            <type>jar</type>
        </dependency>
    </dependencies>
    <properties>
        <org.springframework.version>3.2.1.RELEASE
        </org.springframework.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <netbeans.hint.deploy.server>gfv4ee7</netbeans.hint.deploy.server>
    </properties>
    <name>AttestationSpring3HibernateMaven</name>
</project>

Below is my spring-servlet.xml where datasource, sessionfactory configurations are made..

<bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource"
    p:driverClassName="${jdbc.driverClassName}"
    p:url="${jdbc.databaseurl}" p:username="${jdbc.username}"
    p:password="${jdbc.password}" />

<bean id="sessionFactory"
    class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">

        <property name="dataSource" ref="dataSource"/>
    <property name="packagesToScan" value="org.attestation.entities" />
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
            <prop key="hibernate.show_sql">true</prop>
        </props>

    </property>

</bean>

<tx:annotation-driven />

<bean id="transactionManager"
    class="org.springframework.orm.hibernate4.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
</bean>