起步软件技术论坛-X3

 找回密码
 立即注册
搜索
查看: 144|回复: 8

【结贴】[请求]有问题求助alang~~~~

[复制链接]
发表于 2008-6-13 14:36:01 | 显示全部楼层 |阅读模式
java 调用 libPassChk.dll的IsValidPassword方法, 验证密码时,出现错误: java.lang.UnsatisfiedLinkError: IsValidPassword
        at com.san.dragon.pm.service.CallDll.IsValidPassword(Native Method)
        at com.san.dragon.pm.service.LoginServiceImpl.isAUser(LoginServiceImpl.java:32)
        at com.san.dragon.pm.service.LoginServiceImpl$$FastClassByCGLIB$$280c58d6.invoke(<generated>)
        at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
        at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:698)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
        at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:643)
        at com.san.dragon.pm.service.LoginServiceImpl$$EnhancerByCGLIB$$ef2b733.isAUser(<generated>)
        at com.san.dragon.pm.junit.TestLogin.testGetUser(TestLogin.java:20)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

请求决解?
回复

使用道具 举报

发表于 2008-6-13 15:01:10 | 显示全部楼层
看看你下载的这个dll文件是不是输出这两个函数啊

1.png

2.17 KB, 下载次数: 92

回复 支持 反对

使用道具 举报

发表于 2008-6-13 15:02:44 | 显示全部楼层
另外,请贴出来你的java调用的完整的源文件
类似 http://bbs.justep.com/forum.php? ... ighlight=java%2Adll 6楼的代码
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-6-13 15:19:55 | 显示全部楼层
调用dll的源码:

package com.san.dragon.pm.service;

public class CallDll {
    static {
        System.loadLibrary("libPassChk");
    }
    public native boolean IsValidPassword(String APass, String AEncodedPass);
}


调用上面的类:

package com.san.dragon.pm.service;


import com.san.dragon.pm.dao.LoginDao;

public class LoginServiceImpl implements LoginService {

private LoginDao loginDao;


public LoginDao getLoginDao() {
return loginDao;
}

public void setLoginDao(LoginDao loginDao) {
this.loginDao = loginDao;
}

public boolean isAUser(String password,String userName) {
// TODO Auto-generated method stub
CallDll cdll = new CallDll();
String get_password ="";

        if (!userName.equals("")){
         get_password =  loginDao.getPassword(userName);
           
        }else {
         return false;
        }


    if (cdll.IsValidPassword(password,get_password)){
return true;
}else {
     return false;
}


}






}


测试类:


package com.san.dragon.pm.junit;

import test.com.san.model.Jobs;
import test.com.san.service.TestServiceImpl;
import junit.framework.TestCase;

import com.san.core.spring.config.AppBeanFactory;

import com.san.dragon.pm.service.LoginServiceImpl;

public class TestLogin extends TestCase {

public void testGetUser(){



LoginServiceImpl service=(LoginServiceImpl)AppBeanFactory.getBean("loginServiceImpl");
long beginTime=System.currentTimeMillis();
System.out.println(System.getProperty("java.library.path") ;
if (service.isAUser("SHENJIPENG","DISPLAYNAME")){
System.out.println("login ok");
}else {

System.out.println("can't login");
}

System.out.println((System.currentTimeMillis()-beginTime)/1000);
}

}
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-6-13 15:22:08 | 显示全部楼层
我这边没有能看DLL里面方法的工具~所以看不到,你把那个能看到那个方法的DLL上传一下吧。
回复 支持 反对

使用道具 举报

发表于 2008-6-13 15:22:45 | 显示全部楼层
调用dll的源码:

package com.san.dragon.pm.service;

public class CallDll {
    static {
        System.loadLibrary("libPassChk");
    }
    public native boolean IsValidPassword(String APass, String AEncodedPass);
}
必须跟我给了例子完全相同,包括包的名字
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-6-13 15:41:00 | 显示全部楼层
要这样子的啊~好的,我试一下
回复 支持 反对

使用道具 举报

发表于 2008-6-13 16:01:15 | 显示全部楼层
回复 支持 反对

使用道具 举报

发表于 2008-7-15 09:07:39 | 显示全部楼层
楼主,还有问题不,没问题就结帖了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2025-7-19 04:13 , Processed in 0.045127 second(s), 19 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表