@Override public int getCountOfImeisRecorded(String userAdmin) throws MSMApplicationException { IMEIManager imeiManager = null; int qtde = 0; try { InitialContext initialContext = new InitialContext(); imeiManager = (IMEIManager) initialContext.lookup("ndg-core/IMEIManagerBean/remote"); } catch (NamingException e) { e.printStackTrace(); } ArrayList<Object> queryResult = listAllUsers(userAdmin, null).getQueryResult(); ArrayList<UserVO> listUsers = new ArrayList<UserVO>(); for (Iterator iterator = queryResult.iterator(); iterator.hasNext(); ) { UserVO object = (UserVO) iterator.next(); listUsers.add(object); } for (UserVO userVO : listUsers) { qtde += imeiManager.findImeiByUser(userVO.getUsername(), null, true).getQueryResult().size(); } return qtde; }
public Map<String, String> getAttributes(User user) throws DataSourceException, ConfigException { try { String s = "(&(objectClass=" + source.getUsersObjectClassValue() + ")(" + source.getUsersIdKey() + "=" + user.getUid() + "))"; List<SearchResult> r = this.search(s, SecurityEntityType.USER); if (!r.isEmpty()) { Attributes attrs = r.get(0).getAttributes(); Map<String, String> items = new HashMap<String, String>(); NamingEnumeration<? extends Attribute> lst = attrs.getAll(); while (lst.hasMoreElements()) { Attribute attr = lst.nextElement(); if (attr.get() != null) { items.put(attr.getID(), attr.get().toString()); } } return items; } else { return null; } } catch (javax.naming.AuthenticationException e) { throw new ConfigException(e, "LDAP connection failed, please check your settings"); } catch (NamingException e) { throw new DataSourceException(e, "LDAP Exception : " + e.getMessage()); } }
static { Context initContext = null; try { initContext = new InitialContext(); Context envContext = (Context) initContext.lookup("java:/comp/env"); datasource = (DataSource) envContext.lookup("jdbc/QAHUB"); } catch (NamingException e) { e.printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } // Connection conn = ds.getConnection(); // // // inStream=ConnectionSource.class.getClass().getResourceAsStream("/dbcpConfig.properties"); // pro=new Properties(); // // try { // pro.load(inStream); // datasource=BasicDataSourceFactory.createDataSource(pro); // } catch (Exception e) { // e.printStackTrace(); // throw new RuntimeException("DataSource Initialization Exception"); // } }
public BranchTO[] getAllBranchByCountry(String countryId) { PreparedStatement pstmt = null; Connection con = null; ResultSet rs = null; BranchTO branchTO = null; ArrayList<BranchTO> branchList = new ArrayList<BranchTO>(); try { con = DAOFactory.getInstance().getConnection(Connection.TRANSACTION_READ_UNCOMMITTED); pstmt = con.prepareStatement(SQLConstants.LIST_BRANCH_BY_COUNTRY_SQL); pstmt.setInt(1, Integer.parseInt(countryId)); rs = pstmt.executeQuery(); while (rs.next()) { branchTO = new BranchTO(); branchTO.setId(rs.getString("id")); branchTO.setCode(Utility.trim(rs.getString("code"))); branchTO.setName(Utility.trim(rs.getString("name"))); branchTO.setStatus(Utility.trim(rs.getString("status"))); branchList.add(branchTO); } return (BranchTO[]) branchList.toArray(new BranchTO[0]); } catch (SQLException e) { throw new DataException(e.getMessage()); } catch (NamingException e) { throw new DataException(e.getMessage()); } finally { Utility.closeAll(null, pstmt, con); } }
private void cleanUp(InitialContext initialContext) { try { initialContext.close(); } catch (NamingException e) { LOG.unableToCloseInitialContext(e.toString()); } }
protected Map<String, ArrayList<String>> convertAttributes( NamingEnumeration<? extends Attribute> attributesEnumeration) { Map<String, ArrayList<String>> userInfo = new HashMap<String, ArrayList<String>>(); try { while (attributesEnumeration.hasMore()) { Attribute attr = attributesEnumeration.next(); String id = attr.getID(); ArrayList<String> values = userInfo.get(id); if (values == null) { values = new ArrayList<String>(); userInfo.put(id, values); } // --- loop on all attribute's values NamingEnumeration<?> valueEnum = attr.getAll(); while (valueEnum.hasMore()) { Object value = valueEnum.next(); // Only retrieve String attribute if (value instanceof String) { values.add((String) value); } } } } catch (NamingException e) { e.printStackTrace(); } return userInfo; }
public static void main(String[] args) { Properties props = new Properties(); props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.FSContextFactory"); props.put(Context.PROVIDER_URL, "file:///"); try { Context ctx = new InitialContext(props); System.out.println("Contexto obetido com sucesso"); if (args[1].equals("-t")) { buscaTodosArquivo(ctx, 1, args[0]); } if (args[1].equals("-p")) { buscaArquivo(ctx, 1, args[0]); } } catch (NamingException e) { e.printStackTrace(); } if (!achou) { System.out.println("não encontrou"); } System.out.println("Finalizou"); }
public PoolManager() { try { ds = (DataSource) context.lookup("java:comp/env/jdbc/androidsds"); } catch (NamingException e) { e.printStackTrace(); } }
public boolean doSetup() { boolean okay = false; try { jndiContext = new InitialContext(); } catch (NamingException e) { log.error("Could not create JNDI API " + "context: " + e.toString()); } /* * Look up connection factory and queue. If either does not exist, exit. */ try { queueConnectionFactory = (QueueConnectionFactory) jndiContext.lookup("QueueConnectionFactory"); if (queueConnectionFactory == null) log.error("null factory"); queue = (Queue) jndiContext.lookup("manny"); if (queue == null) log.error("null factory"); log.debug("finished config"); okay = true; } catch (NamingException e) { log.error("JNDI API lookup failed: " + e.toString()); } return okay; }
@Override public void contextInitialized(ServletContextEvent event) { try { Context ctx = new InitialContext(); dataSource = (DataSource) ctx.lookup("java:comp/env/jdbc/dataDS"); } catch (NamingException e) { e.printStackTrace(); } try (Connection conn = dataSource.getConnection()) { String ddl = "CREATE TABLE IF NOT EXISTS TREEITEMS ( ID VARCHAR(30) PRIMARY KEY, PARENT VARCHAR(30)," + "URL VARCHAR(255), NAME VARCHAR(255), OWNER VARCHAR(10), UPDATED TIMESTAMP, PRIORITY INT);" + "CREATE TABLE IF NOT EXISTS PRODUCTS ( ID VARCHAR(30) PRIMARY KEY, SOURCE VARCHAR(30)," + "DESCR VARCHAR(255), PRICE INT, OLDPRICE INT);"; // TODO add ord column creation to "create table" statament // here we modify existing table ddl += "ALTER TABLE TREEITEMS ADD COLUMN IF NOT EXISTS ORD INTEGER;"; try (PreparedStatement ps = conn.prepareStatement(ddl)) { ps.execute(); } } catch (SQLException e) { System.out.println(e.getMessage()); e.printStackTrace(); } // if (dataSource != null){ // System.out.println("Datasource resource injected!"); // } else { // System.out.println("Datasource is null"); // } scheduler = Executors.newSingleThreadScheduledExecutor(); // scheduler.scheduleAtFixedRate(new UpdateCounts(), 0, 4, TimeUnit.SECONDS); scheduler.scheduleAtFixedRate(new PriceDownloader(), 0, 30, TimeUnit.SECONDS); }
@Override public void setUp() throws SetupException { InitialContext initContext = null; try { initContext = new InitialContext(); String openid = (String) initContext.lookup("java:global/zanata/security/auth-policy-names/openid"); if (openid != null) { dbAuthType = "OPENID"; } else { dbAuthType = "OTHER"; } } catch (NameNotFoundException e) { dbAuthType = "OTHER"; } catch (NamingException e) { throw new SetupException(e); } finally { if (initContext != null) { try { initContext.close(); } catch (NamingException e) { e.printStackTrace(); } } } }
/** * This postparses a name, after it has been returned from the jndi operation. It assumes that it * has got a jndi <i>CompositeName</i> that needs to be converted to a legal ldap dn (i.e. an ldap * <i>CompoundName</i>). If this is *not* the case, there will be trouble... * * @param name the post jndi operation name. * @return the re-formatted version used by the application, as a DN object. */ public Name postParse(String name) { /* EMERGENCY HACK * (JNDI apparently does not handle terminating spaces correctly - it * retains the escape characters, but trims the actual space, resulting * in an illegal ldap dn) */ if (name.charAt(name.length() - 1) == '\\') { name = NameUtility.checkEndSpaces(name); } try { Name cn = new CompositeName(name); if (cn.size() == 0) // if the name is empty ... return new DN(); // ... just return an empty DN return new DN( cn.get( cn.size() - 1)); // get the last element of the composite name, which will be the ldap // compound name, and init the DN with that. } catch (NamingException e) // should never happen :-) (ROTFL) { log.log( Level.WARNING, "unexpected error: bad name back from jndi ftn in CBOps.postParse(" + name + ")?\n" + e.toString()); e.printStackTrace(); // System.exit(-1); return new DN(name); // bad server response? return (possibly) corrupt name anyway... } }
public static void initialize() { try { mic = new MockInitialContext(); } catch (NamingException e) { e.printStackTrace(); } }
protected DirContext open() throws NamingException { try { Hashtable<String, String> env = new Hashtable<String, String>(); env.put(Context.INITIAL_CONTEXT_FACTORY, getLDAPPropertyValue(INITIAL_CONTEXT_FACTORY)); if (isLoginPropertySet(CONNECTION_USERNAME)) { env.put(Context.SECURITY_PRINCIPAL, getLDAPPropertyValue(CONNECTION_USERNAME)); } else { throw new NamingException("Empty username is not allowed"); } if (isLoginPropertySet(CONNECTION_PASSWORD)) { env.put(Context.SECURITY_CREDENTIALS, getLDAPPropertyValue(CONNECTION_PASSWORD)); } else { throw new NamingException("Empty password is not allowed"); } env.put(Context.SECURITY_PROTOCOL, getLDAPPropertyValue(CONNECTION_PROTOCOL)); env.put(Context.PROVIDER_URL, getLDAPPropertyValue(CONNECTION_URL)); env.put(Context.SECURITY_AUTHENTICATION, getLDAPPropertyValue(AUTHENTICATION)); context = new InitialDirContext(env); } catch (NamingException e) { ActiveMQServerLogger.LOGGER.error(e.toString()); throw e; } return context; }
/** * 获取名称为dataSourceName的 DataSource. * * @param dataSourceName * @return * @throws SQLException */ public DataSource getDataSource(String dataSourceName) throws SQLException { // 是否是已经获取的DataSource对象。 DataSource ods = dataSourceMap.get(dataSourceName); if (ods != null) { return ods; } DataSource ds = null; // 1.从上下文根据JNDI获取DataSource Context initCtx = null; try { initCtx = new InitialContext(); // 创建上下文实例 // get DataSource by different Servlet Container Type. // Tomcat5 需要做特殊的处理 Context envCtx = (Context) initCtx.lookup("java:comp/env"); ds = (DataSource) envCtx.lookup(dataSourceName); dataSourceMap.put(dataSourceName, ds); // 缓存起来 return ds; } catch (NamingException ex) { log.fatal("cant get the new InitialContext()"); log.debug("debug", ex); /// ex.pri ntStackTrace(); throw new SQLException(ex.getMessage()); } catch (Exception ex) { log.fatal("cant get the new InitialContext()"); log.debug("debug", ex); /// ex.pri ntStackTrace(); throw new SQLException(ex.getMessage()); } }
public void crearPeriodo() { FacesMessage fMsg = new FacesMessage(FacesMessage.SEVERITY_WARN, "Aviso:", ""); if (this.zona == null || this.zona.getIdZona() == 0) { fMsg.setDetail("Seleccione una zona !!"); } else if (this.grupo == null || this.grupo.getIdGrupo() == 0) { fMsg.setDetail("Seleccione un grupo !!"); } else if (this.periodo.equals("1")) { fMsg.setDetail("No se puede crear un período actual, debe ser uno siguiente !!"); } else if (this.detalles.isEmpty()) { try { Date fechaInicial = Utilerias.addDays(fechaTope, 1); this.dao = new DAOImpuestosDetalle(); this.detalles = this.dao.crearPeriodo( this.zona.getIdZona(), this.grupo.getIdGrupo(), this.periodo, new java.sql.Date(fechaInicial.getTime())); this.detalle = null; fMsg.setSeverity(FacesMessage.SEVERITY_INFO); fMsg.setDetail("La operación se realizó con éxito !!"); } catch (SQLException ex) { fMsg.setSeverity(FacesMessage.SEVERITY_ERROR); fMsg.setDetail(ex.getErrorCode() + " " + ex.getMessage()); } catch (NamingException ex) { fMsg.setSeverity(FacesMessage.SEVERITY_ERROR); fMsg.setDetail(ex.getMessage()); } } else { fMsg.setDetail("Ya existe un período siguiente, modifique o elimine y velva a crear !!"); } FacesContext.getCurrentInstance().addMessage(null, fMsg); }
/** Set the standard request controls */ private void setRequestControls(byte[] cookie) throws TranslatorException { List<Control> ctrl = new ArrayList<Control>(); SortKey[] keys = searchDetails.getSortKeys(); try { if (keys != null) { ctrl.add(new SortControl(keys, Control.NONCRITICAL)); } if (this.executionFactory.usePagination()) { ctrl.add( new PagedResultsControl( this.executionContext.getBatchSize(), cookie, Control.CRITICAL)); } if (!ctrl.isEmpty()) { this.ldapCtx.setRequestControls(ctrl.toArray(new Control[ctrl.size()])); LogManager.logTrace( LogConstants.CTX_CONNECTOR, "Sort/pagination controls were created successfully."); //$NON-NLS-1$ } } catch (NamingException ne) { final String msg = LDAPPlugin.Util.getString("LDAPSyncQueryExecution.setControlsError") + //$NON-NLS-1$ " : " + ne.getExplanation(); // $NON-NLS-1$ throw new TranslatorException(ne, msg); } catch (IOException e) { throw new TranslatorException(e); } }
public void cargarDetalles(int idZona, int idGrupo) { boolean ok = false; FacesMessage fMsg = new FacesMessage(FacesMessage.SEVERITY_WARN, "Aviso:", ""); if (this.periodo == null) { this.periodo = "1"; } try { if (idZona == 0 || idGrupo == 0) { this.detalles = new ArrayList<ImpuestoDetalle>(); } else { this.dao = new DAOImpuestosDetalle(); this.detalles = this.dao.obtenerDetalles(idZona, idGrupo, this.periodo); } ok = true; } catch (SQLException ex) { fMsg.setSeverity(FacesMessage.SEVERITY_ERROR); fMsg.setDetail(ex.getErrorCode() + " " + ex.getMessage()); } catch (NamingException ex) { fMsg.setSeverity(FacesMessage.SEVERITY_ERROR); fMsg.setDetail(ex.getMessage()); } if (!ok) { FacesContext.getCurrentInstance().addMessage(null, fMsg); } }
public void update(String username, String password) { try { connect(); System.out.println("Updating..."); ModificationItem[] mods = new ModificationItem[1]; Attribute attr = new BasicAttribute("userPassword", password); // Support add, replace and remove an attribute. mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, attr); ds.modifyAttributes("uid=" + username + "," + LDAP_BASE, mods); System.out.println("Updated."); } catch (Exception e) { // TODO: handle exception } finally { try { close(); } catch (NamingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
public void grabar() { FacesMessage fMsg = new FacesMessage(FacesMessage.SEVERITY_WARN, "Aviso:", ""); if (this.zona == null || this.zona.getIdZona() == 0) { fMsg.setDetail("Seleccione una zona !!"); } else if (this.grupo == null || this.grupo.getIdGrupo() == 0) { fMsg.setDetail("Seleccione un grupo !!"); } else if (this.detalle == null || this.detalle.getImpuesto().getIdImpuesto() == 0) { fMsg.setDetail("Seleccione un impuesto de la lista !!"); } else { try { this.dao = new DAOImpuestosDetalle(); this.detalles = this.dao.grabar(zona.getIdZona(), grupo.getIdGrupo(), this.detalle, this.periodo); fMsg.setSeverity(FacesMessage.SEVERITY_INFO); fMsg.setDetail("La operación se realizó con éxito !!"); } catch (SQLException ex) { fMsg.setSeverity(FacesMessage.SEVERITY_ERROR); fMsg.setDetail(ex.getErrorCode() + " " + ex.getMessage()); } catch (NamingException ex) { fMsg.setSeverity(FacesMessage.SEVERITY_ERROR); fMsg.setDetail(ex.getMessage()); } } FacesContext.getCurrentInstance().addMessage(null, fMsg); }
public boolean updateBranch(BranchTO branchTO) { PreparedStatement pstmt = null; Connection con = null; int result; try { con = DAOFactory.getInstance().getConnection(Connection.TRANSACTION_READ_UNCOMMITTED); pstmt = con.prepareStatement(SQLConstants.UPDATE_BRANCH_SQL); pstmt.setString(1, Utility.trim(branchTO.getName())); pstmt.setString(2, Utility.trim(branchTO.getCountry().getId())); pstmt.setString(3, Utility.trim(branchTO.getStatus())); pstmt.setInt(4, 1); pstmt.setString(5, Utility.trim(branchTO.getId())); result = pstmt.executeUpdate(); if (result > 0) { return true; } else { return false; } } catch (SQLException e) { throw new DataException(e.getMessage()); } catch (NamingException e) { throw new DataException(e.getMessage()); } finally { Utility.closeAll(null, pstmt, con); } }
public void eliminarPeriodo() { FacesMessage fMsg = new FacesMessage(FacesMessage.SEVERITY_WARN, "Aviso:", ""); if (this.zona == null || this.zona.getIdZona() == 0) { fMsg.setDetail("Seleccione una zona !!"); } else if (this.grupo == null || this.grupo.getIdGrupo() == 0) { fMsg.setDetail("Seleccione un grupo !!"); } else if (this.periodo.equals("1")) { fMsg.setDetail("No se puede eliminar el período actual !!"); } else { try { this.dao = new DAOImpuestosDetalle(); this.dao.eliminarPeriodo(this.zona.getIdZona(), this.grupo.getIdGrupo()); this.detalles = new ArrayList<ImpuestoDetalle>(); this.detalle = null; fMsg.setSeverity(FacesMessage.SEVERITY_INFO); fMsg.setDetail("La operación se realizó con éxito !!"); } catch (SQLException ex) { fMsg.setSeverity(FacesMessage.SEVERITY_ERROR); fMsg.setDetail(ex.getErrorCode() + " " + ex.getMessage()); } catch (NamingException ex) { fMsg.setSeverity(FacesMessage.SEVERITY_ERROR); fMsg.setDetail(ex.getMessage()); } } FacesContext.getCurrentInstance().addMessage(null, fMsg); }
private DataView<LdapUser> newGroupMembersListView(LdapGroup group) { List<LdapUser> users; try { users = group.getMembers(); } catch (NamingException e) { logger.warn(e.getMessage(), e); users = new ArrayList<>(0); } DataView<LdapUser> members = new DataView<LdapUser>("membersList", new LdapGroupUsersProvider(users)) { @Override protected void populateItem(Item<LdapUser> item) { LdapUser user = item.getModelObject(); WebMarkupContainer container = new WebMarkupContainer("member"); ExternalLink mail = new ExternalLink( "mail", Model.of("mailto:" + user.getMail()), new PropertyModel(user, "mail")); Label userName = new Label("username", new PropertyModel(user, "userName")); final String fullName = user.getFullName(); Label fullNameLabel = new Label("fullname", Model.of(fullName)); fullNameLabel.setVisible(fullName != null); container.add(mail); container.add(userName); container.add(fullNameLabel); item.add(container); } }; members.setOutputMarkupId(true); return members; }
public boolean agregar() { boolean ok = false; FacesMessage fMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Aviso:", "agregar: mbUpc"); // RequestContext context = RequestContext.getCurrentInstance(); try { if (this.upc.getUpc().equals("")) { fMsg.setSeverity(FacesMessage.SEVERITY_WARN); fMsg.setDetail("Se requiere un UPC !"); } else { this.dao = new DAOUpcs(); this.dao.agregar(this.upc); this.cargaListaUpcs(); ok = true; } } catch (NamingException ex) { fMsg.setDetail(ex.getMessage()); } catch (SQLException ex) { fMsg.setDetail(ex.getErrorCode() + " " + ex.getMessage()); } if (!ok) { FacesContext.getCurrentInstance().addMessage(null, fMsg); } // context.addCallbackParam("okUpc", ok); return ok; }
/** Creates new NamespacePermission */ public PermissionName(String name) throws IllegalArgumentException { try { this.name = new CompoundName(name, nameSyntax); } catch (NamingException e) { throw new IllegalArgumentException(e.toString(true)); } }
public boolean eliminar() { boolean ok = false; RequestContext context = RequestContext.getCurrentInstance(); FacesMessage fMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Aviso:", "eliminar: mbUpc"); try { if (this.listaUpcs.size() > 2 && this.upc.isActual()) { fMsg.setSeverity(FacesMessage.SEVERITY_WARN); fMsg.setDetail("No se puede eliminar, cambie primero de actual"); } else { this.dao = new DAOUpcs(); this.dao.Eliminar(this.upc.getUpc()); this.cargaListaUpcs(); ok = true; } } catch (NamingException ex) { fMsg.setDetail(ex.getMessage()); } catch (SQLException ex) { fMsg.setDetail(ex.getErrorCode() + " " + ex.getMessage()); } if (!ok) { FacesContext.getCurrentInstance().addMessage(null, fMsg); } context.addCallbackParam("okUpc", ok); return ok; }
/** * Creates the initial JNDI context to work with. * * @return context {@link InitialContext} * @throws ProcessingException */ public InitialContext createInitialContext() throws ProcessingException { Hashtable<String, String> props = new Hashtable<String, String>(); if (m_initialContextFactory != null) { props.put(Context.INITIAL_CONTEXT_FACTORY, m_initialContextFactory); } if (m_providerUrl != null) { props.put(Context.PROVIDER_URL, m_providerUrl); } if (m_userName != null && m_userName.length() > 0) { props.put(Context.SECURITY_PRINCIPAL, m_userName); } if (m_password != null) { props.put(Context.SECURITY_CREDENTIALS, m_password); } InitialContext ctx; try { if (props.size() > 0) { ctx = new InitialContext(props); } else { ctx = new InitialContext(); } } catch (NamingException e) { throw new ProcessingException(e.getMessage(), e.getCause()); } return ctx; }
private Object getResults(Attribute attr, Object obj) { try { String name = attr.getID().toString(); String Value = attr.get().toString(); Class class1 = obj.getClass(); String methodName = "set" + name.substring(0, 1).toUpperCase() + name.substring(1, name.length()); String[] methodnameIgnot = {"-"}; for (String ignore : methodnameIgnot) { methodName = methodName.replaceAll(ignore, ""); } Method method = class1.getMethod(methodName, String.class); String value = (String) method.invoke(obj, Value); } catch (NamingException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } return obj; }
public void initEJB() { try { InputStream inputStream = this.getClass() .getClassLoader() .getResourceAsStream("hu/neuron/java/sales/services/Settings.properties"); Properties properties = new Properties(); try { properties.load(inputStream); } catch (IOException e) { e.printStackTrace(); } Hashtable<String, String> env = new Hashtable<String, String>(); env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); env.put(Context.SECURITY_PRINCIPAL, properties.getProperty("SECURITY_PRINCIPAL")); env.put(Context.SECURITY_CREDENTIALS, properties.getProperty("SECURITY_CREDENTIALS")); env.put(Context.PROVIDER_URL, properties.getProperty("PROVIDER_URL")); Context ctx; ctx = new InitialContext(env); System.out.println("ctx = " + ctx); offerService = (OfferServiceRemote) ctx.lookup("OfferService#hu.neuron.java.sales.service.OfferServiceRemote"); } catch (NamingException e) { e.printStackTrace(); } }
private ServerConnection() { try { ic = new InitialContext(); } catch (NamingException e) { e.printStackTrace(); } }