Error Creating Initialcontext
Contents |
here for a quick overview of the failed to create initialcontext using factory specified in hashtable junit site Help Center Detailed answers to any questions you might have Meta javax.naming.noinitialcontextexception websphere application server Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up I have got this error : Failed to create InitialContext using factory specified in hashtable up vote 0 down vote favorite I just want to add a servlet in web.xml, like this :
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is http://stackoverflow.com/questions/17440016/i-have-got-this-error-failed-to-create-initialcontext-using-factory-specified a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up InitialContext factory error up vote 0 down vote favorite I am studying Managing database connections with JDBC published by IBM. It is some old stuff (2001). They are using JNDI. When I http://stackoverflow.com/questions/17218852/initialcontext-factory-error tried to implement their code: try { Hashtable env = new Hashtable(); env.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory"); // Create the initial context Context ctx = new InitialContext(env); // Here we create the actual DataSource and then set the relevant // parameters. TdsDataSource ds = new TdsDataSource(); ds.setServerName(serverName); ds.setPortNumber(portNumber); ds.setDatabaseName(databaseName); ds.setUser(login); ds.setPassword(password); ds.setDescription("JDBC DataSource Connection"); // Now we bind the DataSource object to the name we selected earlier. ctx.bind(filePath, ds); ctx.close(); // Generic Exception handler, in practice, this would be replaced by an // appropriate Exception handling hierarchy. } catch (Exception ex) { System.err.println("ERROR: " + ex.getMessage()); } But I found out that there is no "com.sun.jndi.fscontext.RefFSContextFactory" file system service provider. Then I changed the code as follows (from Initialize Data Source Properties). OracleDataSource ods = new OracleDataSource(); ods.setDriverType("oci"); ods.setServerName("dlsun999"); ods.setNetworkProtocol("tcp"); ods.setDatabaseName("816"); ods.setPortNumber(1521); ods.setUser("scott"); ods.setPassword("tiger"); Context ctx = new InitialContext(); ctx.bind("jdbc/sampledb", ods); When I tried to execute this code, I am getting the following error: ERROR: Need to spe
and SafetyAsset NetworkAsset Operations https://wso2.org/jira/si/jira.issueviews:issue-html/CARBON-13988/CARBON-13988.html and MaintenanceCommerceOverviewSubscription Billing and Revenue ManagementMaster Data Management for CommerceOmnichannel CommerceFinanceOverviewAccounting and Financial CloseCollaborative Finance OperationsEnterprise Risk and ComplianceFinancial Planning and AnalysisTreasury failed to and Financial Risk ManagementHuman ResourcesOverviewCore Human Resources and PayrollHuman Capital AnalyticsTalent ManagementTime and Attendance ManagementManufacturingOverviewManufacturing NetworkManufacturing OperationsResponsive ManufacturingMarketingOverviewMarket with Speed and AgilityUnique Customer ExperiencesReal-Time Customer InsightsR&D/EngineeringOverviewDesign NetworkDesign OrchestrationProject and failed to create Portfolio ManagementSalesOverviewCollaborative Quote to CashSales Force AutomationSales Performance ManagementSelling Through Contact CentersServiceOverviewEfficient Field Service ManagementOmnichannel Customer ServiceTransparent Service Process and OperationsSourcing and ProcurementOverviewContingent Workforce ManagementDirect ProcurementSelf-Service ProcurementServices ProcurementStrategic Sourcing and Supplier ManagementSupply ChainOverviewDemand ManagementDemand NetworkLogistics NetworkManufacturing Planning and SchedulingResponse NetworkResponse and Supply ManagementSales, Inventory, and Operations PlanningTransportation ManagementWarehouse ManagementSustainabilityOverviewEnvironment, Health, and SafetyProduct Safety and Stewardship NetworkBrowse by IndustryAerospace and DefenseAutomotiveBankingChemicalsConsumer ProductsDefense and SecurityEngineering, Construction, and OperationsHealthcareHigh TechHigher Education and ResearchIndustrial Machinery and ComponentsInsuranceLife SciencesMediaMill ProductsMiningOil and GasProfessional ServicesPublic SectorRetailSports and EntertainmentTelecommunicationsTravel and Transpor
07/Nov/12 Updated: 13/Nov/13 Resolved: 18/Jun/13 Status: Resolved Project: WSO2 Carbon Component/s: None Affects Version/s: 4.0.0 Fix Version/s: 4.2.0 Type: Bug Priority: Highest Reporter: Charitha Kankanamge Assignee: Pradeep Fernando Resolution: Not a bug Votes: 0 Labels: None Remaining Estimate: Not Specified Time Spent: Not Specified Original Estimate: Not Specified Environment: Redhat 6, jdk1.6.0_29 Severity: Blocker Estimated Complexity: Moderate Test cases added: Yes Description The following intermittent issue has been observed in fresh AS-5.0.1 pack [2012-11-05 16:54:02,829] ERROR {org.wso2.carbon.ndatasource.core.DataSourceRepository} - Error in registering data source: WSO2_CARBON_DB - Error creating JNDI initial context: Failed to create InitialContext using factory specified in hash table. org.wso2.carbon.ndatasource.common.DataSourceException: Error creating JNDI initial context: Failed to create InitialContext using factory specified in hash table. at org.wso2.carbon.ndatasource.core.DataSourceRepository.registerJNDI(DataSourceRepository.java:254) at org.wso2.carbon.ndatasource.core.DataSourceRepository.registerDataSource(DataSourceRepository.java:360) at org.wso2.carbon.ndatasource.core.DataSourceRepository.addDataSource(DataSourceRepository.java:474) at org.wso2.carbon.ndatasource.core.DataSourceManager.initSystemDataSource(DataSourceManager.java:182) at org.wso2.carbon.ndatasource.core.DataSourceManager.initSystemDataSources(DataSourceManager.java:154) at org.wso2.carbon.ndatasource.core.internal.DataSourceServiceComponent.initSystemDataSources(DataSourceServiceComponent.java:166) at org.wso2.carbon.ndatasource.core.internal.DataSourceServiceComponent.setSecretCallbackHandlerService(DataSourceServiceComponent.java:152) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.eclipse.equinox.internal.ds.model.ComponentReference.bind(ComponentReference.java:367) at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.bindReference(ServiceComponentProp.java:430) at org.eclipse.equinox.internal.ds.model.ServiceCompon