Eclipse RCP 응용 프로그램 구축, 실행 실패
-
20-09-2019 - |
문제
애플리케이션을 성공적으로 빌드 한 후 시작은 Meta-INF 디렉토리에있는 구성 파일에 의존하고 빌드 후이 디렉토리가 JAR 파일에 적용되므로 구성 파일에 액세스 할 수 없기 때문에 시작이 실패합니다. 항아리를 수동으로 풀고 항아리를 삭제하고 xxx로 디렉토리를 바꾸는 후 프로그램은 문제없이 실행됩니다. SSO 로그인 (Kerberos)에는 구성 파일이 필요합니다. 코드는 다음과 같습니다.
Bundle bundle = Platform.getBundle(Application.PLUGIN_ID);
String path;
try {
path = new URL(bundle.getLocation().substring(18)).getPath();
} catch (MalformedURLException e1) {
System.out.println(e1);
path="";
}
System.setProperty("java.security.auth.login.config",path+"META-INF/jaas-win.config");
Path 변수에는 "플러그인/mydomain.pluginame-xxxx.jar/"와 같은 것이 포함되어 있지만 시스템에 JAR이 압축되지 않은 것으로 보입니다.
그게 내가 앱 빌딩을 잘못하고 있는가? 감사
해결책
코드를 변경 한 후 :
ClassLoader cl = Thread.currentThread().getContextClassLoader();
URL authconf = null;
authconf= cl.getResource("META-INF/jaas-win.config");
if (authconf == null) {
loginContext = null;
return;
}
String p;
try {
p = URLDecoder.decode(authconf.toExternalForm(), "UTF-8");
System.setProperty("java.security.auth.login.config", p);
} catch (UnsupportedEncodingException e1) {
loginContext = null;
return;
}
지금은 작동합니다.
제휴하지 않습니다 StackOverflow