Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Problem connecting to policy server using the connect API

Avatar

Former Community Member
I am getting following exception message while connecting to the policy server.



"The exception is Exception connecting to the Server -- An error occured while performing this operation(error code bin: 1, hex: 0x1)"



Here is the piece of code I am using:



Properties apsProperty = new Properties();



apsProperty.setProperty(EDCFactory.USERNAME_PROPERTY_NAME,"administrator");

apsProperty.setProperty(EDCFactory.PASSWORD_PROPERTY_NAME,"password");

apsProperty.setProperty(EDCFactory.MODE_PROPERTY_NAME,"ejb");



try

{

EDCFactory apsSession = EDCFactory.connect(apsProperty);

PolicyManager apsPolicyManager = apsSession.getPolicyManager();



PolicySearchFilter sf = new PolicySearchFilter();



Policy [] allPolicies = apsPolicyManager.getPolicies(sf,10);



BufferedWriter out = new BufferedWriter(new FileWriter("C:\\Policy.txt"));



TreeMap policyMap = new TreeMap();



for (int i = 0; i < allPolicies.length; i++)

{

Policy policy = (Policy) allPolicies[i];



String policyName = policy.getName();



out.write(policyName);



policyMap.put("1", policyName);

}



out.close();



arguments.setObject("outPolicyMap", policyMap);



}

catch (IOException ex)

{

System.out.println("The exception is " +ex.getMessage());

}

catch (Exception ex)

{

System.out.println("The exception is " +ex.getMessage());

}



Is there a way to get around the issue?
6 Replies

Avatar

Former Community Member
First question would be: have you activated the EJB interface in the config file? By default it is not activated.



Chris

Adobe Enterprise Developer Support

Avatar

Former Community Member
Yes the EJB interface is activated in the config file.

Avatar

Former Community Member
Hi Anirudh,



Can you post the entire stack trace?



Thanks,



-Bill

Avatar

Former Community Member
Hi Bill,



This is the only message I am getting from the server log. I am not getting any other stack trace.



Regards,

Anirudh

Avatar

Former Community Member
Here is the complete Stack Trace:<br /><br />The exception is Exception connecting to the Server -- An error occured while pe<br />rforming this operation(error code bin: 1, hex: 0x1)<br />com.adobe.edc.sdk.SDKException: Exception connecting to the Server -- An error o<br />ccured while performing this operation(error code bin: 1, hex: 0x1)<br /> at com.adobe.edc.sdk.impl.ExceptionHandler.throwException(ExceptionHandl<br />er.java:78)<br /> at com.adobe.edc.sdk.impl.ExceptionHandler.throwException(ExceptionHandl<br />er.java:88)<br /> at com.adobe.edc.sdk.EDCFactory.connect(EDCFactory.java:190)<br /> at ConnectTest.main(ConnectTest.java:24)<br />Caused by: com.adobe.edc.sdk.SDKException: Error authenticating against server -<br />- Authentication failed(error code bin: 513, hex: 0x201)<br /> at com.adobe.edc.sdk.impl.ExceptionHandler.throwException(ExceptionHandl<br />er.java:50)<br /> at com.adobe.edc.sdk.impl.ejb.EJBConnection.getConnection(EJBConnection.<br />java:557)<br /> at com.adobe.edc.sdk.impl.ejb.EJBClientFactoryImpl.<init>(EJBClientFacto<br />ryImpl.java:63)<br /> at com.adobe.edc.sdk.EDCFactory.connect(EDCFactory.java:183)<br /> ... 1 more<br />Caused by: com.adobe.edc.sdk.SDKException: Error looking up PolicyManagerEJB --<br />Cannot connect to server(error code bin: 1025, hex: 0x401)<br /> at com.adobe.edc.sdk.impl.ExceptionHandler.throwException(ExceptionHandl<br />er.java:50)<br /> at com.adobe.edc.sdk.impl.ejb.EJBConnection.getPolicyManagerHome(EJBConn<br />ection.java:532)<br /> at com.adobe.edc.sdk.impl.ejb.EJBConnection.getConnection(EJBConnection.<br />java:549)<br /> ... 3 more<br />Caused by: javax.naming.NoInitialContextException: Need to specify class name in<br /> environment or system property, or as an applet parameter, or in an application<br /> resource file: java.naming.factory.initial<br /> at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6<br />40)<br /> at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243<br />)<br /> at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.jav<br />a:280)<br /> at javax.naming.InitialContext.lookup(InitialContext.java:347)<br /> at com.adobe.edc.sdk.impl.ejb.EJBConnection.getPolicyManagerHome(EJBConn<br />ection.java:528)<br /> ... 4 more

Avatar

Former Community Member
Hi Anirudh



I am getting the exact same error as you have listed above - did you get this resolved?



If so, could you let me know what you did to resolve it?



I thought it may be related to some kind of LDAP configuration - we don't use an LDAP server for authentication at all (we only have external users & administrators) - and by default it seems that Policy Server & DSS expect an LDAP server to authenticate against, but I haven't managed to find a way to configure the system to not require some kind of directory authentication.



Many thanks,

Anil.