2015-02-11 9 views
1

我正在JDeveloper中開發Java應用程序,它用於與Oracle連接銷售雲網絡服務,所以爲此我做了以下步驟。在運行Web服務客戶端和代理時出現錯誤,SEVERE:java.io.FileNotFoundException:JDeveloper 12c中的./config/jps-config.xml

步驟1:創建的自定義應用

步驟2:然後,我已生成使用Web服務客戶端和代理從WSDL客戶端。

它生成的成功,我已添加到主類的憑證。這是我的主要課程。

public class PersonServiceSoapHttpPortClient { 


private static final AddressingVersion WS_ADDR_VER = AddressingVersion.W3C; 


public static void main(String[] args) throws Exception{ 
    PersonService_Service personService_Service = new PersonService_Service(); 
    PersonService personService = personService_Service.getPersonServiceSoapHttpPort(); 

    // Configure credential providers 
    Map<String, Object> requestContext = ((BindingProvider) personService).getRequestContext(); 


    try { 
     setPortCredentialProviderList(requestContext); 
    } catch (Exception ex) { 
     ex.printStackTrace(); 
    } 

    // Add your code to call the desired methods. 
    FindCriteria findCriteria=new FindCriteria(); 

    findCriteria.setFetchSize(1); 
    findCriteria.setFetchSize(10); 

    FindControl findControl=new FindControl(); 
    findControl.setRetrieveAllTranslations(true);  


    System.out.println("before invoking method"); 
    PersonResult personResult=personService.findPerson(findCriteria, findControl); 
    List<Person> persons=personResult.getValue(); 

    System.out.println("The Response size is ::"+persons.size()); 

} 


@Generated("Oracle JDeveloper") 
public static void setPortCredentialProviderList(Map<String, Object> requestContext) throws Exception { 
    // TODO - Provide the required credential values 

    String username = "abc"; 
    String password = "acdd"; 
    String clientKeyStore = ""; 
    String clientKeyStorePassword = ""; 
    String clientKeyAlias = ""; 
    String clientKeyPassword = ""; 
    String serverKeyStore = ""; 
    String serverKeyStorePassword = ""; 
    String serverKeyAlias = ""; 
    List<CredentialProvider> credList = new ArrayList<CredentialProvider>(); 

    credList.add(getUNTCredentialProvider(username, password)); 
    credList.add(getBSTCredentialProvider(clientKeyStore, clientKeyStorePassword, clientKeyAlias, clientKeyPassword, serverKeyStore, serverKeyStorePassword, serverKeyAlias, requestContext)); 

    credList.add(getSAMLTrustCredentialProvider()); 
    requestContext.put(WSSecurityContext.CREDENTIAL_PROVIDER_LIST, credList); 
} 


@Generated("Oracle JDeveloper") 
public static CredentialProvider getSAMLTrustCredentialProvider() { 
    return new SAMLTrustCredentialProvider(); 
} 


@Generated("Oracle JDeveloper") 
public static CredentialProvider getUNTCredentialProvider(String username, String password) { 
    return new ClientUNTCredentialProvider(username.getBytes(), password.getBytes()); 
} 


@Generated("Oracle JDeveloper") 
public static CredentialProvider getBSTCredentialProvider(String clientKeyStore, String clientKeyStorePwd, 
                  String clientKeyAlias, String clientKeyPwd, 
                  String serverKeyStore, String serverKeyStorePwd, 
                  String serverKeyAlias, 
                  Map<String, Object> requestContext) throws Exception { 
    List serverCertList = CertUtils.getCertificate(serverKeyStore, serverKeyStorePwd, serverKeyAlias, "JKS"); 
    List clientCertList = CertUtils.getCertificate(clientKeyStore, clientKeyStorePwd, clientKeyAlias, "JKS"); 
    final X509Certificate serverCert = 
     (serverCertList != null && serverCertList.size() > 0) ? (X509Certificate) serverCertList.get(0) : null; 
    final X509Certificate clientCert = 
     (clientCertList != null && clientCertList.size() > 0) ? (X509Certificate) clientCertList.get(0) : null; 

    requestContext.put(WSSecurityContext.TRUST_MANAGER, new TrustManager() { 
     public boolean certificateCallback(X509Certificate[] chain, int validateErr) { 
      boolean result = 
       (chain != null && chain.length > 0) && (chain[0].equals(serverCert) || chain[0].equals(clientCert)); 
      return result; 
     } 
    }); 
    return new ClientBSTCredentialProvider(clientKeyStore, clientKeyStorePwd, clientKeyAlias, clientKeyPwd, "JKS", 
              serverCert); 
} 
} 

當運行這個客戶存根時,我得到以下異常。

SEVERE: java.io.FileNotFoundException: ./config/jps-config.xml 
(No such file or directory) INFO: Policy subject is not registered. 
SEVERE: java.io.FileNotFoundException: ./config/jps-config.xml 
(No such file or directory) 
SEVERE: java.io.FileNotFoundException: ./config/jps-config.xml 
(No such file or directory) 
SEVERE: java.io.FileNotFoundException: ./config/jps-config.xml 
(No such file or directory) 
SEVERE: java.io.FileNotFoundException: ./config/jps-config.xml 
(No such file or directory) 
INFO: EffectivePolicySetFeature not on the binding, 
will look up policy set for; ResourcePattern 
    [absolutePortableExpression=///UNKNOWN|#MODULE| 
WS-Client({http://xmlns.oracle.com/apps/cdm/foundation 
/parties/personService/applicationModule/} 
PersonService#PersonServiceSoapHttpPort,wls)] 
SEVERE: java.io.FileNotFoundException: ./config/jps-config.xml 
(No such file or directory) 
    INFO: EffectivePolicySetFeature=oracle.j2ee.ws.common.wsm 
[email protected] 
INFO: WSM Security is not enabled for Policy Subject: 
ResourcePattern [absolutePortableExpression= 
    ///UNKNOWN|#MODULE|WS- 
    Client({http://xmlns.oracle.com/apps/cdm/foundation 
/parties/personService/applicationModule/}PersonService 
#PersonServiceSoapHttpPort,wls)] 
java.lang.SecurityException: keyStoreFilename is either null 
or empty string 
at weblogic.wsee.security.util.CertUtils.getCertificate 
(CertUtils.java:89) 
at com.oracle.xmlns.apps.cdm.foundation.parties.personservice 
.applicationmodule.PersonServiceSoapHttpPortClient 
.getBSTCredentialProvider(PersonServiceSoapHttpPortClient.java:129) 
at com.oracle.xmlns.apps.cdm.foundation.parties.personservice 
.applicationmodule.PersonServiceSoapHttpPortClient 
.setPortCredentialProviderList 
(PersonServiceSoapHttpPortClient.java:106) 
at com.oracle.xmlns.apps.cdm.foundation.parties.personservice 
.applicationmodule.PersonServiceSoapHttpPortClient.main 
(PersonServiceSoapHttpPortClient.java:52) 

回答

0

你跑哪個版本?我與JDeveloper的12.1.3版本有同樣的問題。嘗試從Oracle網站下載12.1.2。這爲我做了。

0

顯然,您的應用程序需要JPS庫和系統選取默認JPS配置文件,因爲未指定-Doracle.security.jps.config選項。因此,系統至少在該位置搜索不存在的./config/jps-config.xml文件。通常,該文件應位於$ DOMAIN_HOME/config/fmwconfig

確保您的JVM選項包含正確的JPS配置文件。

SEVERE: java.io.FileNotFoundException: ./config/jps-config.xml (No such file or directory) 

例:

-Doracle.security.jps.config=/dfaut6/otm/product/BIP1117/user_projects/domains/bifoundation_domain/config/fmwconfig/jps-config.xml 

的一些有用參考:http://docs.oracle.com/cd/E25178_01/core.1111/e10043/apjpscfg.htm

這應該與這種類型的錯誤,至少可以幫
相關問題