运行 Web 服务客户端和代理时出错,严重:JDeveloper 12c 中的 java.io.FileNotFoundException: ./config/jps-config.xml

Posted

技术标签:

【中文标题】运行 Web 服务客户端和代理时出错,严重:JDeveloper 12c 中的 java.io.FileNotFoundException: ./config/jps-config.xml【英文标题】:getting error while running the web service client and proxy, SEVERE: java.io.FileNotFoundException: ./config/jps-config.xml in JDeveloper 12c 【发布时间】:2015-04-11 11:38:49 【问题描述】:

我正在 JDeveloper 中开发 Java 应用程序。该应用程序用于连接 Oracle 销售云 Web 服务,为此我执行了以下步骤。

第 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
 .EffectivePolicySetFeature@76f6c7e1
 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)

【问题讨论】:

【参考方案1】:

鉴于未指定 -Doracle.security.jps.config 选项,显然您的应用需要 JPS 库并且系统选择了默认的 JPS 配置文件。结果,系统正在搜索不存在的 ./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

【讨论】:

【参考方案2】:

您正在运行哪个版本?我在 JDeveloper 12.1.3 版中遇到了同样的问题。尝试从 Oracle 网站下载 12.1.2。这对我有用。

【讨论】:

以上是关于运行 Web 服务客户端和代理时出错,严重:JDeveloper 12c 中的 java.io.FileNotFoundException: ./config/jps-config.xml的主要内容,如果未能解决你的问题,请参考以下文章

出错代码502,是指啥,怎样解决?

远程服务器错误 请稍后重试 是啥原因?

严重:异常启动过滤器 CORS

在报告服务 2008 上调用 Render 方法时出错

代理

代理