Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JNDI Context binding
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Manibharathi
Context binding
3 Answer(s)      2 years ago
Posted in : JNDI


What is meant by Context binding?


Advertisement
View Answers

September 13, 2012 at 1:04 PM


A binding context is an object that holds data that you can reference from your bindings. While applying bindings, Knockout automatically creates and manages a hierarchy of binding contexts. The root level of the hierarchy refers to the viewModel parameter you supplied to ko.applyBindings(viewModel). Then, each time you use a control flow binding such as with or foreach, that creates a child binding context that refers to the nested view model data.



September 13, 2012 at 1:10 PM


Thanks:-)

public class B { public static void main(String[] args) throws javax.naming.NoInitialContextException { maths mat=new A(); mat.add(); mat.sub(); String name; try { name = new B().getName(); System.out.println(name); } catch (NamingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void createName() throws NamingException { Context context = (Context) new InitialContext(); ((InitialContext) context).bind("java:comp/env", "MyApp"); } public String getName() throws NamingException { Context context = (Context) new InitialContext(); return (String) ((InitialContext) context).lookup("java:comp/env"); } }

if i run this program means it will show error give some solution....

error

javax.naming.NoInitialContextException: Failed to create InitialContext using factory specified in hashtable {} [Root exception is java.lang.NullPointerException] at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:238) at javax.naming.InitialContext.initializeDefaultInitCtx(InitialContext.java:322) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:352) at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:436) at javax.naming.InitialContext.lookup(InitialContext.java:450) at Model.B.getName(B.java:26) at Model.B.main(B.java:13) Caused by: java.lang.NullPointerException at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:230) ... 6 more



November 21, 2013 at 11:26 AM


Hi, the problem with jndi credentials. For Example look into the given example for weblogic jndi.

public static void main(String[] args) {

    // providing the weblogic jndi credentials
    Hashtable< String, String> hashTable=new Hashtable<String, String>();
    hashTable.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    hashTable.put(Context.PROVIDER_URL, "t3://localhost:7001/");
    hashTable.put(Context.SECURITY_PRINCIPAL, "weblogic");
    hashTable.put(Context.SECURITY_CREDENTIALS, "weblogic123");


try{
    Context context=new InitialContext(hashTable);

        Object object=context.lookup("JDBCDataSourceJNDI");
        System.out.println("DataSource="+object.getClass().getName());

        DataSource dataSource=(DataSource)object;
     Connection connection=dataSource.getConnection();
     System.out.println("connection ="+connection);
}
catch(NamingException nammingException ) {
    nammingException.printStackTrace();

}
catch(SQLException sqlException) {
    sqlException.printStackTrace();
}

}

Note Set the class path for: weblogic.jar and wlclient.jar and also configure the weblogic connection pool for weblogic by using creating the datasource .

In this above example "JDBCDataSourceJNDI" is a datasource name that is created by myself and also weblogic and weblogic123 are weblogic credentials.



Related Tutorials/Questions & Answers:
Context binding
Context binding  What is meant by Context binding?   A binding context is an object that holds data that you can reference from your... a hierarchy of binding contexts. The root level of the hierarchy refers to the viewModel
context
context  what is context in general in java ?   An association between a name and an object is called a binding, and a set of such bindings is called a context
Advertisements
DYNAMIC BINDING
DYNAMIC BINDING  WHAT IS DYNAMIC BINDING
Binding in Flex
Binding in Flex  Hi....... Explain how binding works in mxml components? Please give the answer with example. Thanks  Ans: Binding in MXML Please see the following code: <s:Button id="btn" label
Binding in flex
Binding in flex  Hi......... Please tell me the Difference between...: 1. When we define a data binding in MXML it will use at compile time and we define a data binding in action script it will use at run time. 2. you use
Servlet Context
Servlet Context  Defined Servlet Context
value and binding attribute
value and binding attribute  What is the difference between value and binding attribute of jsf tag
value and binding attribute
value and binding attribute  What is the difference between value and binding attribute in jsf
context attribute
context attribute  i have writteh the program lyk this ...still error 405 method not found is coming.please suggest me the solution. import... { res.setContentType("text/html"); PrintWriter out = res.getWriter(); out.println("context
XML data binding
XML data binding   hello, What is XML data binding?   hii, XML data binding refers to the process of representing the information in an XML document as an object in computer memory
Binding - Java Interview Questions
Binding   Hi Deepak , Interface makes runtime binding where abstract class is compile time binding.you can achieve multiple inheritance through Interface but abstract class not allow. Thank u in advance
What is Application Context?
What is Application Context?  Hello, What is Application Context? Thanks
Binding Error in Spring - Spring
Binding Error in Spring  Error: Neither BindingResult nor plain target object for bean name 'loginBean' available as request attribute I am trying to write a login page in Springs My jsp: User Id : ">
application context file problem
application context file problem  how to configure junit application context file with struts........? it is not finding sessionfactory method
Message Context in AXIS
Message Context in AXIS  Is there any method in Axis classes to het the size of IN and OUT Message Conetext
Binding and unbinding events
Binding and unbinding events       Binding and unbinding events As the name says "binding events " is  the association of an element
Overriding jaxb binding at client side?
Overriding jaxb binding at client side?  How can override jaxb binding at client side? I have a webservice client which creates xmlgregoriancalendar.... Overriding jaxb binding at client side
context menu overlapped in IE8
context menu overlapped in IE8  I developed a contex menu in XHTML while opening it is overlapped in border of IE8 browser. even i have tried change the zaxis in css. I am using like below
Error in context path
Error in context path   I Tried a Struts2 Login application having... = request.getContextPath(); System.out.println("Context Path " + contextPath... ... undeploy?path=/strutsDemo OK - Undeployed application at context path /strutsDemo
Application context problem code
Application context problem code   now i am posting my code here . i... FileSystemXmlApplicationContext context = null; protected SessionFactory sessionFactory=null...( WebApplicationContext.ROOT WEB APPLICATION CONTEXT ATTRIBUTE, applicationContext
Flex data binding example
Flex data binding example       In the example below, data binding in flex is demonstrated. Here data binding means binding or connecting the properties or attributes of flex
Why binding attribute is required in jsf frame work
Why binding attribute is required in jsf frame work  Why binding attribute is required in jsf frame work. And what use of binding attribute
binding data with textbox on dropdown click
binding data with textbox on dropdown click  Hello friends,Divyesh here. i have jsp page and i would like to bind data with text box on dropdown click. in dropdown employee id are load.and when we select perticular id than how
Add context path to URL for outputLink
Add context path to URL for outputLink  How to add context path to URL for outputLink
what is difference between one-way data binding and two-way data binding?
what is difference between one-way data binding and two-way data binding?  what is difference between one-way data binding and two-way data binding? Thanks
PHP Late Static Binding
PHP Late Static Binding: A new feature called late static binding is introduced in PHP 5.3.0 which can be used to refer the called class. The name late static binding is coined because of the static:: will no longer be resolved using
Servlet Context
Servlet Context In this section we will read about the SevletContext... by providing the value in web.xml file using the <context-param></context... specify the value within the <context-param> </context-param> tag
Spring Context - Writing Application Context
Spring Context - Writing Application Context  ... by defining the Application context definition file (applicationContext-hibernate.xml). This file is used by context loader servlet to initialize the Spring
Java Thread Context
Thread Context       The Thread Context is required by the current thread from the group... for the development of the thread pools Every Thread required a context
Advertisements
 

 

 

DMCA.com