public RMIConnection createConnection() { RMIServerManager serverManager = null; Context initialNamingContext = null; try { initialNamingContext = new InitialContext(); } catch (NamingException exception) { System.out.println("Naming Exception " + exception.toString()); } ; // Set the client security manager try { System.setSecurityManager(new RMISecurityManager()); } catch (Exception exception) { System.out.println("Security violation " + exception.toString()); } // Get the remote factory object from the Registry try { serverManager = (RMIServerManager) initialNamingContext.lookup("SERVER-MANAGER"); } catch (Exception exception) { throw new TestProblemException(exception.toString()); } RMIConnection rmiConnection = null; try { rmiConnection = new RMIConnection(serverManager.createRemoteSessionController()); } catch (RemoteException exception) { System.out.println("Error in invocation " + exception.toString()); } return rmiConnection; }
public void run() { try { ExpressionBuilder builder = new ExpressionBuilder(); Expression exp = builder.anyOf("policies").get("policyNumber").equal(200); for (int i = 0; i < 1; i++) { PolicyHolder holder = (PolicyHolder) this.clientSession.readObject( org.eclipse.persistence.testing.models.insurance.PolicyHolder.class, exp); if ((holder == null) || (holder.getFirstName() == "") || (holder.getPolicies() == null) || (holder.getAddress() == null) || (holder.getAddress().getCity() == null)) { throw new TestWarningException("Client/Server dead lock test fails as null is returned."); } } } catch (Exception exception) { this.server.errorOccured = true; exception.printStackTrace(System.out); } }