JNDI setup

Hi,
How can I setup the jndi tree in oc4j?
I'd like to store properties like the "SysAdminEmailAddress" in the JNDI.
These properties should be accessible from all applications.
In pre J2EE days we used a properties file loaded into the System.properties at startup.
But now we think JNDI is the way to store it.
In which config file can I store my properties?
Thanks
Guenther

Dear OC4J Team,
can you please give me a response.
Many thanks
Guenther

Similar Messages

  • JNDI Setup in Embedded Tomcat 5.0.19

    Hi All,
    I have embedded Tomcat 5.0.19 in my application, which is a simple web based database application in servlets. In Embedded Tomcat we don't have server.xml.
    Reference:
    http://www.vsj.co.uk/articles/display.asp?id=319
    I am trying to create JNDI Context to connect to my database.
    My configuration file is like this:
    <naming>
    <context >
    <resource name="jdbc/myDS" type="javax.sql.DataSource" >
    <parameter>
    <name>factory</name>
    <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>
    <parameter>
    <name>driverClassName</name>
    <value>net.sourceforge.jtds.jdbc.Driver</value>
    </parameter>
    <parameter>
    <name>url</name>
    <value>jdbc:jtds:sqlserver://SQLServer:1433;databaseName=myDB;</value>
    </parameter>
    <parameter>
    <name>username</name>
    <value>sa</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>sa</value>
    </parameter>
    </resource>
    </context>
    </naming>
    I have put this config file in the root directory and called thru the following method.
    XmlConfigurator.loadConfiguration(getClass().getResourceAsStream("/myConfig.xml"));
    Ref:
    http://directory.apache.org/subprojects/naming/using.html
    I have written a class which starts the embedded tomcat and calls the above method.
    The following is the output of tomcat:
    Apr 15, 2005 3:19:00 PM org.apache.catalina.startup.Embedded start
    INFO: Starting tomcat server
    Apr 15, 2005 3:19:01 PM org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/5.0.19
    Apr 15, 2005 3:19:01 PM org.apache.catalina.core.StandardHost start
    INFO: XML validation disabled
    Apr 15, 2005 3:19:01 PM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=tru
    e
    Apr 15, 2005 3:19:01 PM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNul
    l=true
    Apr 15, 2005 3:19:02 PM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='view.ApplicationResources', returnNull=true
    Apr 15, 2005 3:19:02 PM org.apache.coyote.http11.Http11Protocol init
    INFO: Initializing Coyote HTTP/1.1 on port 9889
    Apr 15, 2005 3:19:02 PM org.apache.coyote.http11.Http11Protocol start
    INFO: Starting Coyote HTTP/1.1 on port 9889
    I have written another class which does the context lookup function and creates the Connection Object like this:
    public Connection getConnection()
         Context ctx=new InitialContext();
    Context jdbcCtx = (Context)ctx.lookup("jdbc");
    DataSource datasource=(DataSource)jdbcCtx.lookup("myDS");
    return datasource.getConnection();
    but every time my web application calls this function to create a new connection it throws:
    javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
    at org.apache.naming.NamingContext.lookup(NamingContext.java:815)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:198)
    at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
    at javax.naming.InitialContext.lookup(InitialContext.java:347)
    at view.DatabaseConnection.getConnection(DatabaseConnection.java:109)
    at view.Admin_LoginValidation.doPost(Admin_LoginValidation.java:42)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:284)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:204)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
    alve.java:257)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:151)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:567)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(Standard
    ContextValve.java:245)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
    alve.java:199)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:151)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:567)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
    ava:184)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:151)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
    ava:164)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:149)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:567)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
    ve.java:156)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:151)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:567)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:20
    6)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
    :833)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
    ssConnection(Http11Protocol.java:732)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
    :619)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
    ool.java:688)
    at java.lang.Thread.run(Thread.java:534)
    java.lang.NullPointerException
    when I tried Context lookup in the same class which starts Tomcat, there is no problem: it gets the Name jdbc/myDB. How to make the Context Global.
    Please help me out to solve this problem.
    Thanks in Advance,
    Pretty

    in the reource tag u have somet hing called global attribute which will be ur global jndi name with which u can access the resource
    Context ...>
    <ResourceLink name="The name of the linked global resource in the global JNDI context.
    global="The name of the resource link to be created, relative to the java:comp/env context.
    type="The fully qualified Java class name expected by the web application when it performs a lookup for this resource link.
    r"
    i think tat will work
    regards
    shanu
    </Context>

  • Dynamic configuration of connection JNDI name in adapter service

    I have a requirement to connect to multiple E-Business Suite instances and databases based on data in the message. I've created some adapter services, and it seems that the way each adapter service decides which instance to connect with is in the WSDL of that service:
    <service name="RaiseEvent">
    <port name="RaiseEvent_pt" binding="tns:RaiseEvent_binding">
    <jca:address location="eis/Apps/VIS03_LNAX30B"/>
    </port>
    </service>
    That snippet is from an Oracle Apps Adapter service, but there's similar code in the WSDL for database adapter services as well. The "eis/Apps/VIS03_LNAX30B" value is the name of the connection factory set up in my OC4J instance administration, specifying the database/EBS instance to use. Manually changing that value at design-time and redeploy works to connect to a different instance.
    Is there any way to make that "jca:address location" attribute be a value that I pass into the adapter service, instead of hardcoding it into the WSDL?
    Thanks,
    Skip

    I have tried to assign values to the OutBoundDBHeaderType to try invoke another JNDI, but does not seem to work.
    The setup that I used was
    Have 2 databases A and B.
    Have the same procedure setup in both the databases.
    Have 2 JNDIs setup to point to the databases A and B named as eis/DB/A and eis/DB/B.
    Initially created a DB Adapter pointing to JNDI - A.
    Created a variable of the OutboundDBHeaderType message type.
    Tried to assign the dataSourceName as eis/DB/B in the BPEL process.
    This doe not seem to change the JNDI, the calls continue going to A.

  • Multiserver JNDI linking

    When I JNDI link a bean deployed on a remote WL server (WL6.0sp1) to my local WL
    instance using a LinkRef, it seems I am unable to access the linked bean unless
    my local WL server VM gets local access to the BeanEOImpl_WLStub of the remote
    bean. The LinkRef for my PingBean is defined as follows:
    <<<<
    LinkRef pingLink = new LinkRef("t3://remotehost:7001/Ping");
    Hashtable props = new Hashtable();
    props.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    props.put(Context.PROVIDER_URL, "t3://localhost:7001/");
    Context context = new InitialContext(props);
    context.rebind("Ping", pingLink);
    >>>>
    When accessing the PingBean through my local WL server, I get:
    <<<<
    javax.naming.LinkException: . Root exception is javax.naming.CommunicationException.
    Root exception is java.rmi.UnmarshalException: failed to unmarshal class java.lang.Object;
    nested exception is: java.lang.ClassNotFoundException: PingBeanEOImpl_WLStub:
    This error could indicate that a component was deployed on a cluster member
    but not other members of that cluster. Make sure that any component deployed on
    a server that is part of a cluster is also deployed on all other members of that
    cluster
    >>>>
    If I provide the PingBeanEOImpl_WLStub class in the localhost WL classpath, the
    LinkRef works just fine. Is there any way I can force the local server to dynamically
    load the stub from the remote server? Or any other way to define a JNDI Reference
    that do not require static deployment of stubs on the local server?
    Will stubs copied to the classpath of the local server in any way conflict with
    or hinder hot-deployment of LinkRef'ed beans on the remote server?
    Also, the local JNDI management console applet is unable to show the JNDI tree
    correctly if it contains LinkRefs unless the entire bean is provided locally.
    Btw, I am only able to make the LinkRef lookup work using JAAS authentication.
    Is this a known limitation or is there any particular considerations for resolving
    LinkRefs with InitialContext authenication?
    Finally, how can I define a LinkRef referencing a cluster where the cluster members
    do not run on the same port? I have found two ways to refer a cluster:
    1) t3://cluster:port/, where cluster set in DNS to point to all cluster members.
    2) t3://c1,c2,c3:port/
    Both methods, however, requires the cluster members to run on the same port.
    Thanks,
    Oystein

    hello
    i have the same senariao as james.
    csn anybody suggest a soln.
    thanks in advance
    Prashant
    James Kojo <[email protected]> wrote:
    >
    I'm working on a project in which we are using JMS and EJBs. The JMS
    server and the EJB server are most likely to be separate weblogic
    servers, and the EJB server may or may not be clustered.
    What is the typical JNDI setup for this? Should I have 2 separate JNDI
    servers: 1 on the JMS server which advertises it's JMS services, and
    likewise 1 on the EJB server, or do I run a single JNDI server that both
    utilize?
    If I use a single JDNI server, how do I deal with with the JNDI server
    going down? Will that mean I can't use either of the services?
    Thanks,
    James

  • Using jndi.properties with weblogic 6.1

    Apologies if this is a basic question - I am new to Weblogic.
    I have successfully got a test EJB working with Weblogic 6.1 using a properties object to set up my JNDI InitialContext.
    In the weblogic examples I've downloaded it says you can also use a jndi.properties file to do this. I have set up a jndi.properties file, which is in the classpath for my class calling the EJB. But when I do my jndi .lookup("ejbname") I get the error:
    javax.naming.CommunicationException: Can't find SerialContextProvider
    The weblogic documentation at:
    http://e-docs.bea.com/wls/docs61///rmi_iiop/API_rmi_iiop.html
    refers to using jndi.properties and says to look at:
    http://edocs.bea.com/wls/docs61/jndi/jndi.html
    But at this page there is no mention of the jndi.properties method.
    I'd be grateful for any suggestions - in particular whether it is possible to use this method of configuring the JNDI setup.
    I'm running wlserver6.1 on a Windows 2000 PC, using JDK 1.3.1
    My jndi.properties file looks as follows:
    java.naming.property.names=java.naming.factory.initial,java.naming.provider.url
    java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
    java.naming.provider.url=t3://localhost:7001

    It is not WebLogic-specific. See
    http://java.sun.com/j2se/1.3/docs/api/javax/naming/InitialContext.html
    Alison Tunley <[email protected]> wrote:
    Apologies if this is a basic question - I am new to Weblogic.
    I have successfully got a test EJB working with Weblogic 6.1 using a properties object to set up my JNDI InitialContext.
    In the weblogic examples I've downloaded it says you can also use a jndi.properties file to do this. I have set up a jndi.properties file, which is in the classpath for my class calling the EJB. But when I do my jndi .lookup("ejbname") I get the error:
    javax.naming.CommunicationException: Can't find SerialContextProvider
    The weblogic documentation at:
    http://e-docs.bea.com/wls/docs61///rmi_iiop/API_rmi_iiop.html
    refers to using jndi.properties and says to look at:
    http://edocs.bea.com/wls/docs61/jndi/jndi.html
    But at this page there is no mention of the jndi.properties method.
    I'd be grateful for any suggestions - in particular whether it is possible to use this method of configuring the JNDI setup.
    I'm running wlserver6.1 on a Windows 2000 PC, using JDK 1.3.1
    My jndi.properties file looks as follows:
    java.naming.property.names=java.naming.factory.initial,java.naming.provider.url
    java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
    java.naming.provider.url=t3://localhost:7001--
    Dimitri

  • Message Driven Bean and transaction handling

    We are using container managed transactions with MDB's running on OC4J version 10.1.2. We have two database serveres, both running Oracle 10g.
    The MDB consume messages from the AQ-database through JMS (connected to a JDBC datasource registered as "jdbc/OracleAQDS").
    The MDB onMessage() code update the second database, using a JDBC datasource registered as "jdbc/OracleDBDS".
    We need atomic behaviour - if the MDB enforce a roll-back we want the updates aginst the second database to be rolled-back as well.
    (1) Should we use XA-datasources since AQ and DB runs on two different servers or do the OC4J container "magically" provide two-phase-commit for us?
    (2) If the MDB does a roll-back we would like to add an error record to a database table. Can we configure a third datasource and prevent if from beeing part of the container managed MDB roll-back?
    (3) When the MDB force a roll-back, is there some way for us to override the retry-delay in our Java code? If we catch certain errors during processing in onMessage we know that it is not necessary to retry for at least one hour (while less severe errors should be retried in just seconds).

    {color:#008000}Hi Friends,
    Thought of updating the answers for my questions in case somebody else would find it helpful.
    {color}
    {color:#999999}{color:#00ccff}I'm trying to make message driven bean and use the OnListener method.
    But since I'm doing this for the first time I have very limited knowledge.
    The following are my doubts :
    1. Should I have a main function while using the MDB?{color}
    {color:#008000} There is no need for any main function.{color}
    {color:#00ccff}2. Is it mandatory to have JNDI setup done?
    {color} {color}{color:#008000} There is no need for any JNDI setup done. But you need to configure the details on the
    Websphere by creating valid entries inside Resources namely -
    Queue Connection Factory, Queues and Listener Ports under the server.
    Thanks,
    Arun Prithviraj{color}

  • Query MS Access Database

    OK - I have a customer that wants to write out to an MS Access Database from Livecycle.  I know this is BAD but they have their reasons - i.e. they have a sever shortage of skills for anything more complex.
    Firstly - I created a Java program to test the JDBC ODBC connection - this worked fine - ran queries and updated OK (code is attached)
    Howver I have tried connecting to Access from within Livecycle in two different ways - both are failing
    Firstly - using the JNDI setup for JDBC ODBC e.g.
    <datasources>
      <local-tx-datasource>
        <jndi-name>MSAccess_DS</jndi-name>
        <!-- format of URL is "jdbc:odbc:DSNNAME" -->
        <connection-url>jdbc:odbc:DBFormData</connection-url>
        <driver-class>sun.jdbc.odbc.JdbcOdbcDriver</driver-class>
        <user-name></user-name>
        <password></password>
      </local-tx-datasource>
    </datasources>
    Calling this within a Livecycle process does not return an error to the process, but the log generates an error:
    2009-08-29 23:01:30,768 WARN  [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
    org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: General error)
    I also tried creating a Java Component and importing it - by creating a very basic jar and importing it to livecycle (based on the same code I used in my Java testing)
    It also gave me the general error - and I can see it is happening on the line:
            Connection con = DriverManager.getConnection(dbURL, "","");
    Any ideas on what is going wrong, or a workaround?  (Assuming that I have to use Access)
    Thanks
    Tim

    OK I solved this.  This was only happening on the Win2K3 server - not on my local dev instance
    On the server I set the JBoss service to run under the local admin account (in the Services Panel) - after a service restart the jdbc odbc connection worked fine.  It must have been some permissions with the system account

  • PI 7.0 JMS Rcv Adapter: Object not found in lookup of XIJMSService

    Hi all,
    When sending messages to an JMS queue, JNDI setup, in the Message Monitoring we get  the error:
    "MP: Exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: Object not found in lookup of XIJMSService.: com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of XIJMSService."
    The Error points to the Module Processor. Indeed the 2 default Modules are used:
    - SAP XI JMS Adapter/ConvertMessageToBinary
    - SAP XI JMS Adapter/SendBinarytoXIJMSService
    This second Module contains 'XIJMSService', and according the documentation (http://help.sap.com/saphelp_nw04/Helpdata/EN/4d/a3bc97ff55c742af7faed661635baf/content.htm)
    , it uses a parameter named 'modulePoolAdminLookupName' with the default value: /XIJMSService.
    This is how far we get. Even when we assign a different value to the parameter 'modulePoolAdminLookupName' , the error in the Message Monitoring stays the same.
    Has anyone experience with this issue, or any ideas to investigate or solve this?
    Thanx in advance, Walter.

    Hi all,
    Issue is solved. Apparently the Java-version on our XI-server (1.4.2) could not handle the Vendor's JMS-driver we installed (ActiveMQ 4.1.2.jar) so we tried using the ActiveMQ 4.1.0.jar as the JMS-driver. Now it is OK and message are put on the destination queue.
    Walter.

  • Message Driven Bean and Distributed transaction

    Hi ALL
    I am developing an asynchronous application using MDB. My application flow is as follows:
    1. From MDB onMessage i am calling a method MethodA that
    a. calls a simple pojo1 where I am getting a Connection on XA enable datasource1 and executing Stored Procedure1 of DatabaseSchema1.
    b. In that pojo without committing m closing the connection and coming back in MethodA.
    c. Again from MethodA m calling a different pojo2 where I am getting a new Connection on XA enable datasource2 and executing Stored Procedure2 of
    DatabaseSchema1. In this pojo also without committing m closing the connection and coming back in MethodA.
    d. Again from MethodA m calling pojo1 where I am getting a new Connection on XA enable datasource1 and executing a different function of Stored Procedure1 of DatabaseSchema1.
    Public class MDB{
    Public void onMessage(��.)
    Try{
    Method1();
    Catch(Exception x)
    mdbcontext.setRollbackOnly();
    Private void MethodA()
    Call pojo1;
    Call pojo2
    Pojo1
    Public void CallSP1()
    Get connection from Datasource1 (shema1,user1, pwd1);
    Call sp1();
    //return without commit;
    Pojo2
    Public void CallSP2()
    Get connection from Datasource2 (shema1,user2, pwd2);
    Call sp2();
    //return without commit;
    SP1:
    Insert table1
    Savepoint 1
    Insert into Table1
    Rollback to 1
    Insert a row
    End SP1 (without commit)
    SP2:
    Insert table2
    Savepoint 2
    Update table2
    Rollback to 2
    Insert table2
    End SP2 (without commit)
    In ejb-jar.xml
    Transaction type is Container
    Transaction attribute is Required for all
    Now problem is:
    Case 1: success case when no exception is there at Java layer
    SP1 works fine I mean there is only 2 inserts in Table 1
    But In SP2 there are 3 inserts
    Case 2: if an exception comes at Java layer
    SP1 is fine
    Rollback is not happening in SP2
    In ejb-jar.xml transaction attributes is Required for all methods and transaction type is Container.
    Backend is Oracle 10g and init.xa has already been run on that.
    Will be very obliged if can have a single hint of the problem.
    Both datasource are XA enable
    Backend is Oracle 10g
    Application server is WAS 6.0
    Queue is WAS MQ 6.0
    Thanks

    {color:#008000}Hi Friends,
    Thought of updating the answers for my questions in case somebody else would find it helpful.
    {color}
    {color:#999999}{color:#00ccff}I'm trying to make message driven bean and use the OnListener method.
    But since I'm doing this for the first time I have very limited knowledge.
    The following are my doubts :
    1. Should I have a main function while using the MDB?{color}
    {color:#008000} There is no need for any main function.{color}
    {color:#00ccff}2. Is it mandatory to have JNDI setup done?
    {color} {color}{color:#008000} There is no need for any JNDI setup done. But you need to configure the details on the
    Websphere by creating valid entries inside Resources namely -
    Queue Connection Factory, Queues and Listener Ports under the server.
    Thanks,
    Arun Prithviraj{color}

  • Urgent: HTTP Status 500-org.apache.jasper.JasperException in running websit

    Hi
    I am running a website. The server provided to me is tomcat and is in Linux and database is MYSQL.
    I am getting the below stated error. In my PC the code is running truly but when i upload it to website the following error occured.I have tried with all tomcat jar file and mysql-jdbc connector jar files by putting them in WEB_INF folder.
    I really need this solution in urgent. If any one could help me in solving the problem it would be really Great.
    Thank You.
    type Exception report
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    java.lang.NullPointerException
         org.apache.jsp.jsp.NewRegistration_jsp._jspService(org.apache.jsp.jsp.NewRegistration_jsp:100)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.

    java.lang.NullPointerException
    org.apache.jsp.jsp.NewRegistration_jsp._jspService(org.apache.jsp.jsp.NewRegistration_jsp:100)
    What is your jsp doing at this point?
    Can you debug it?
    Put a few System.out.println() statements through so you can see at which line it breaks.
    At a guess, seeing as you have mentioned databases, it will probably be related to some database configuration you have done on your local system but not on the server. JNDI setup? Permissions?

  • JMS: simple program (urgent please)

    I am quite new with the JMS. I am trying to have a simple program running in order to start from it towards the application I want to build.
    I tried to run the sample program below:
    package chat;
    import javax.jms.*;
    import javax.naming.*;
    import java.io.*;
    import java.io.InputStreamReader;
    import java.util.Properties;
    public class Chat implements javax.jms.MessageListener {
    private TopicSession pubSession;
    private TopicSession subSession;
    private TopicPublisher publisher;
    private TopicConnection connection;
    /* Constructor. Establish JMS publisher and subscriber */
    public Chat() throws Exception {
    // Obtain a JNDI connection
    Properties env = new Properties();
    // ... specify the JNDI properties specific to the vendor
    InitialContext jndi = new InitialContext(env);
    // Look up a JMS connection factory
    TopicConnectionFactory conFactory =
    (TopicConnectionFactory) jndi.lookup("TopicConnectionFactory");
    // Create a JMS connection
    TopicConnection connection =
    conFactory.createTopicConnection();
    // Create two JMS session objects
    TopicSession pubSession =
    connection.createTopicSession(false,
    Session.AUTO_ACKNOWLEDGE);
    TopicSession subSession =
    connection.createTopicSession(false,
    Session.AUTO_ACKNOWLEDGE);
    // Look up a JMS topic
    Topic chatTopic = (Topic) jndi.lookup("anytopic");
    // Create a JMS publisher and subscriber
    TopicPublisher publisher =
    pubSession.createPublisher(chatTopic);
    TopicSubscriber subscriber =
    subSession.createSubscriber(chatTopic);
    // Set a JMS message listener
    subscriber.setMessageListener(this);
    // Intialize the Chat application
    set(connection, pubSession, subSession, publisher);
    // Start the JMS connection; allows messages to be delivered
    connection.start();
    /* Initialize the instance variables */
    public void set(TopicConnection con, TopicSession pubSess,
    TopicSession subSess, TopicPublisher pub) {
    this.connection = con;
    this.pubSession = pubSess;
    this.subSession = subSess;
    this.publisher = pub;
    /* Receive message from topic subscriber */
    public void onMessage(Message message) {
    try {
    TextMessage textMessage = (TextMessage) message;
    String text = textMessage.getText();
    System.out.println(text);
    } catch (JMSException jmse) {
    jmse.printStackTrace();
    /* Create and send message using topic publisher */
    protected void writeMessage(String text) throws JMSException {
    TextMessage message = pubSession.createTextMessage();
    publisher.publish(message);
    /* Close the JMS connection */
    public void close() throws JMSException {
    connection.close();
    /* Run the Chat client */
    public static void main(String[] args) {
    try {
    Chat chat = new Chat();
    // Read from command line
    BufferedReader commandLine = new
    java.io.BufferedReader(new
    InputStreamReader(System.in));
    // Loop until the word "exit" is typed
    while (true) {
    String s = commandLine.readLine();
    if (s.equalsIgnoreCase("exit")) {
    chat.close(); // close down connection
    System.exit(0); // exit program
    } else {
    chat.writeMessage(s);
    } catch (Exception e) {
    e.printStackTrace();
    But at the line
    �TopicConnectionFactory conFactory =
    (TopicConnectionFactory) jndi.lookup("TopicConnectionFactory");�
    I got this exception:
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
         at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
         at javax.naming.InitialContext.lookup(InitialContext.java:347)
         at chat.Chat.<init>(Chat.java:24)
         at chat.Chat.main(Chat.java:94)
    I realize that the problem is in the jndi setup. But, the problem is that I do not know where to go now and what should I do. I do not know how can I get the jndi.properties file and where and how to put it.
    Please, kindly advise from your experience. I would appreciate clear steps to have this program running properly. Otherwise, if you do have a sample program that is already running, please provide it to me.

    Thank you for your prompt reply.
    I tried another example.
    package test;
    javax.jms.*;
    import javax.naming.*;
    public class SimpleTopicPublisher { /** * Main method. * * @param args the topic used by the example and, * optionally, the number of messages to send */
    public static void main(String[] args) {
    String topicName = null;
    Context jndiContext = null;
    TopicConnectionFactory topicConnectionFactory = null;
    TopicConnection topicConnection = null;
    TopicSession topicSession = null;
    Topic topic = null;
    TopicPublisher topicPublisher = null;
    TextMessage message = null;
    final int NUM_MSGS;
    // if ((args.length < 1) || (args.length > 2)) {
    // System.out.println("Usage: java " + "SimpleTopicPublisher " + "[]");
    // System.exit(1);
    topicName = new String("MyTopic");
    System.out.println("Topic name is " + topicName);
    if (args.length == 2) {
    NUM_MSGS = (new Integer(args[1])).intValue();
    } else {
    NUM_MSGS = 1;
    /* * Create a JNDI API InitialContext object if none exists * yet. */
    try {
    jndiContext = new InitialContext
    } catch (NamingException e) {
    System.out.println("Could not create JNDI API " + "context: " +
    e.toString());
    e.printStackTrace();
    System.exit(1);
    /* * Look up connection factory and topic. If either does * not exist, exit. */
    try {
    topicConnectionFactory = (TopicConnectionFactory) jndiContext.
    lookup("TopicConnectionFactory");
    topic = (Topic) jndiContext.lookup(topicName);
    } catch (NamingException e) {
    System.out.println("JNDI API lookup failed: " + e.toString());
    e.printStackTrace();
    System.exit(1);
    /* * Create connection. * Create session from connection; false means session is * not transacted. * Create publisher and text message. * Send messages, varying text slightly. * Finally, close connection. */
    try {
    topicConnection = topicConnectionFactory.createTopicConnection();
    topicSession = topicConnection.createTopicSession(false,
    Session.AUTO_ACKNOWLEDGE);
    topicPublisher = topicSession.createPublisher(topic);
    message = topicSession.createTextMessage();
    for (int i = 0; i < NUM_MSGS; i++) {
    message
    .setText("This is message " + (i + 1));
    System.out.println("Publishing message: " + message.getText());
    topicPublisher.publish(message);
    } catch (JMSException e) {
    System.out.println("Exception occurred: " + e.toString());
    } finally {
    if (topicConnection != null) {
    try {
    topicConnection.close();
    } catch (JMSException e) {}
    It is mentioned in SUN JMS tutorial that "When you use the J2EE SDK 1.3.1, your JMS provider is the SDK. " So I am using that and I did the follwoing:
    --start the J2EE server as follows:
    j2ee -verbose
    Then I created the adminstrated object:
    j2eeadmin -addJmsDestination MyTopic topic
    But still getting this error:
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    So now where is the error?
    Thank you in advance

  • How to invoke javafx from java code

    hi all,
    i'm trying to invoke my .fx class from java class, but getting exception.
    Exception thrown in JavaFX pretty printing: java.io.FileNotFoundException: \tmp\___FX_SCRIPT___.fxdump from StringInputBuffer (The system cannot find the path specified)
    Exception thrown in JavaFX pretty printing: java.io.FileNotFoundException: \tmp\___FX_SCRIPT___.fxdump from StringInputBuffer (The system cannot find the path specified)
    javax.script.ScriptException: compilation failed
    at com.sun.tools.javafx.script.JavaFXScriptEngineImpl.parse(JavaFXScriptEngineImpl.java:255)
    at com.sun.tools.javafx.script.JavaFXScriptEngineImpl.eval(JavaFXScriptEngineImpl.java:145)
    at com.sun.tools.javafx.script.JavaFXScriptEngineImpl.eval(JavaFXScriptEngineImpl.java:136)
    at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247)
    at myclockproject.Main2.main(Main2.java:34)
    I read in article http://java.sun.com/developer/technicalArticles/scripting/javafx/javafx_and_java/ about including javafxc.jar in classpath .. could some one tell me what classpath he meant, i have included it in my environment variable and also project libraries .. still getting error :(

    coolsayan.2009 wrote:
    thanx.is communication api required?but is the communication api available for windows?its available for linux and sparc??Are you referring to the COMM API that is referenced in the first link when you google - the one entitled "How to Send SMS using Java Program (full code sample included)"? If so, Here: [http://java.sun.com/products/javacomm/|http://java.sun.com/products/javacomm/]
    what to do in serverside?is any change required in web.xml or any jndi setup in serverside if i call the java class from a jsp page?I don't know, are you planning on making your class available through JNDI?

  • Weblogic 8.1: Remote/Foreign Server JMS - Destination not found error

    Hi
    This is our current setup: Weblogic Server 8.1 with JMS module running on the same instance as the application. We would like to move JMS out into its own box. I am currently setting up my development environment to test the new setup. These are the steps I followed:
    * Setup the server instance running the application on one box (Box1). Removed the existing JMS Connection Factory and Destination JNDI setup
    * Setup a server instance on another box (Box2) without the application. Created the necessary JMS Connection Factories and Destinations. Started the server instance on Box2
    * Added a Foreign Server configuration on Box1. Created the connection factory and destinations under this foreign server pointing to Box2
    * The Foreign JNDI names are being bound correctly (I verified the JNDI tree on Box1). Restarted the server instance of Box1
    Message-Driven Beans deployed on Box1 are unable to retrieve messages from Box2. The exception thrown is given below. Any help in troubleshooting and resolving this issue is appreciated.
    <Warning> <EJB> <myserver> <main> <<WLS Kernel>> <> <BEA-010061> <The Message-Driven EJB: MyBean is unable to connect to the JMS destination: jms/my.application.firstQueue. The Error was:
    weblogic.jms.common.JMSException: Destination not found
    weblogic.jms.common.JMSException: Destination not found
    at weblogic.jms.dispatcher.InvocableManager.invocableFind(InvocableManager.java:136)
    at weblogic.jms.backend.BESession.createConsumer(BESession.java:153)
    at weblogic.jms.backend.BESession.invoke(BESession.java:1457)
    at weblogic.jms.dispatcher.Request.wrappedFiniteStateMachine(Request.java:643)
    at weblogic.jms.dispatcher.DispatcherImpl.dispatchSync(DispatcherImpl.java:179)
    at weblogic.jms.frontend.FEConsumer.<init>(FEConsumer.java:232)
    at weblogic.jms.frontend.FESession$3.run(FESession.java:1058)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
    at weblogic.jms.frontend.FESession.consumerCreate(FESession.java:1054)
    at weblogic.jms.frontend.FESession.invoke(FESession.java:2552)
    at weblogic.jms.dispatcher.Request.wrappedFiniteStateMachine(Request.java:643)
    at weblogic.jms.dispatcher.DispatcherImpl.dispatchSync(DispatcherImpl.java:179)
    at weblogic.jms.client.JMSSession.consumerCreate(JMSSession.java:1860)
    at weblogic.jms.client.JMSSession.createConsumer(JMSSession.java:1691)
    at weblogic.jms.client.JMSSession.createReceiver(JMSSession.java:1530)
    at weblogic.ejb20.internal.JMSConnectionPoller.setUpQueueSessions(JMSConnectionPoller.java:1720)
    at weblogic.ejb20.internal.JMSConnectionPoller.createJMSConnection(JMSConnectionPoller.java:2019)
    at weblogic.ejb20.internal.JMSConnectionPoller.connectToJMS(JMSConnectionPoller.java:1180)
    at weblogic.ejb20.internal.JMSConnectionPoller.startJMSConnectionPolling(JMSConnectionPoller.java:846)
    at weblogic.ejb20.deployer.MessageDrivenBeanPoolInfoImpl.start(MessageDrivenBeanPoolInfoImpl.java:234)
    at weblogic.ejb20.deployer.EJBDeployer.deployMessageDrivenBeans(EJBDeployer.java:1660)
    at weblogic.ejb20.deployer.EJBDeployer.startMessageDrivenBeans(EJBDeployer.java:1555)
    at weblogic.t3.srvr.T3Srvr.startMDBs(T3Srvr.java:948)
    at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:1024)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:361)
    at weblogic.Server.main(Server.java:32)
    Edited by: user8773992 on Sep 2, 2009 11:31 AM

    1 - Ensure that the MDB is configured to reference the remote connection factory AND remote destination.
    2 - If using the foreign JMS server facility, ensure that it defines the URL of the remote cluster/server, a connection factory mapping, and a destination mapping. Also ensure that the MDB connection factory and destination descriptor fields reference the local JNDI names for the mappings.
    3 - If not using the foreign JMS server facility, ensure that the MDB descriptor has the URL of the remote cluster, and a destination JNDI name that's in the remote cluster. (The connection factory JNDI name is not needed in this case, as the MDB will automatically look for a default connection factory that MDB's use.)
    I think the MDB chapter of the EJB programmer's guide will likely be helpful here. The latest documentation for the latest release may be more up-to-date than 8.1 -- the concepts are the same with the newer releases.
    Tom

  • AccessControl Exception when invoking remote ejb from portlet class

    Hi,
    From Portlet class, I am invoking Remote EJB which is deployed in weblogic application server.
    After EJB call it not requst Dispathcer not allowed to include the request ..
    Exception as follows ..
    java.security.AccessControlException: access denied (java.security.SecurityPermission getHttpRequestBase)
    X      at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
    X      at java.security.AccessController.checkPermission(AccessController.java:427)
    X      at org.apache.catalina.connector.HttpRequestFacade.getHttpRequestBase(HttpRequestFacade.java:257)
    X      at org.apache.catalina.core.ApplicationDispatcher.getRequestBase(ApplicationDispatcher.java:1115)
    X      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:759)
    X      at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:628)
    X      at org.apache.catalina.core.ApplicationDispatcher.access$100(ApplicationDispatcher.java:123)
    X      at org.apache.catalina.core.ApplicationDispatcher$PrivilegedInclude.run(ApplicationDispatcher.java:154)
    X      at java.security.AccessController.doPrivileged(Native Method)
    X      at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:528)
    X      at com.sun.portal.portlet.impl.RequestDispatcherImpl.include(RequestDispatcherImpl.java:95)
    X      at com.gm.gc.sample.SamplePortlet.doView(Unknown Source)
    X      at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:235)
    X      at javax.portlet.GenericPortlet.render(GenericPortlet.java:163)
    X      at com.sun.portal.portletappengine.PortletAppEngineServlet.service(PortletAppEngineServlet.java:271)
    X      at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
    X      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:772)
    X      at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:628)
    X      at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:539)
    X      at com.sun.portal.container.portlet.impl.PortletContainer.invokePAE(PortletContainer.java:409)
    X      at com.sun.portal.container.portlet.impl.PortletContainer.getMarkup(PortletContainer.java:180)
    X      at com.sun.portal.providers.window.WindowProvider.getPortletContent(WindowProvider.java:386)
    X      at com.sun.portal.providers.window.WindowProvider.getContentInternal(WindowProvider.java:239)
    X      at com.sun.portal.providers.window.WindowProvider.getContent(WindowProvider.java:204)
    X      at com.sun.portal.desktop.context.ReusableProviderCaller.run(ReusableProviderCaller.java:160)
    Source Code
    ===========
    SamplePortlet Class
    protected void doView(RenderRequest request, RenderResponse response)
                   throws PortletException, IOException {
              PortletRequestDispatcher prDispatcher = null;
              String helloString=null;
              SamplePortletHandler spHandler=null;
              response.setContentType(request.getResponseContentType());
              try {
                   spHandler=new SamplePortletHandler();               
                   prDispatcher = pContext.getRequestDispatcher("/jsp/SampleView.jsp");                         
                   helloString=spHandler.getHelloString();
                   prDispatcher.include(request, response);
              } catch (Exception e) {
                   e.printStackTrace();
                   request.setAttribute("ERROR_MSG", e.getMessage());
                   prDispatcher = pContext.getRequestDispatcher("/jsp/Error.jsp");
                   prDispatcher.include(request, response);
    Handler Class
    is there any solution?
    Thanks in Advance ...

    Hi,
    I didn't configure the JNDI stuff in WLS per se. I created a simple session bean and the meta data in the jar of this determined the JNDI setup.
    Once this is deployed on either WLS it can then be seen in Weblogic Console by clicking on View JNDI Tree. The full JNDI name is present and correct on both WLS to which it is deployed.
    Does that answer your questions or are you asking how I configured the SOA Suite composite? In which case I selected the EJB in the Partner Link swimlane. Viewed the properties and added
    java.naming.provider.url
    t3://myremotehost:7001

  • Java.lang.RuntimeException: Caller doesn't have enough permission to call this method

    Hi,
    I am trying to abort a composite instance from SOA BPM Worklist.
    I was able to do the same using weblogic 10.3.6 and SOA 11.1.1.6
    Now, I am using weblogic 10.3.6 (same server) and SOA 11.1.1.7 . I have done the complete FacadeFinderBean and SOATestBean JNDI setup on my servers.
    I am getting the below error now.
    Caused by:  An error occurred while aborting or purging composite instance.
    Caused by: java.rmi.RemoteException: EJB Exception: ; nested exception is:
      java.lang.RuntimeException: Caller doesn't have enough permission to call this method.
      at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:237)
      at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:223)
      at oracle.soa.management.internal.ejb.impl.FacadeFinderBean_4vacyo_FacadeFinderBeanImpl_1036_WLStub.getCompositeInstances(Unknown Source)
      at oracle.soa.management.internal.ejb.EJBLocatorImpl.getCompositeInstances(EJBLocatorImpl.java:401)
    Caused by: java.lang.RuntimeException: Caller doesn't have enough permission to call this method.
      at oracle.soa.management.internal.ejb.impl.BaseSOABeanImpl.checkSecurityRole(BaseSOABeanImpl.java:55)
      at oracle.soa.management.internal.ejb.impl.FacadeFinderBeanImpl.getCompositeInstances(FacadeFinderBeanImpl.java:913)
      at oracle.soa.management.internal.ejb.impl.FacadeFinderBeanImpl.getCompositeInstances(FacadeFinderBeanImpl.java:905)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
    Please provide your valuable inputs to solve the issue.
    Thanks and Regards,
    Vijay

    Hi,
    I was able to solve the issue by a workaround >>>
    Set the facade.security.check system property to false in setDomainEnv.sh on SOA domain under java_options
    -Dfacade.security.check=false
    Regards,
    Vijay

Maybe you are looking for

  • Problem using the DVI to Video adapter

    I am using a MacBook Pro. I am using the DVI to Video cable to connect my MBP to the TV. It was working fine and I was watching movies and videos. Suddenly I am having problem and its not working. I hooked up the DVI to Video adaptor on the PC side .

  • Switch on problem Macbook pro

    Hi I have problem with my macbook pro. Afew days back did this: https://www.youtube.com/watch?v=DAs88OhFOMU It take some time but always switch on but nowday nothing only sometimes for afew sec works then switch off like here: https://www.youtube.com

  • Windows 7 and Elements 5.0

    I am running Elements 5.0 using Windows XP. I do a lot of photography and I have somewhere on the sunny side of 15000 digital photographs on my computer with most of them backed up in various ways.  Many of them have been worked over with 5.0 and are

  • Unable to Hard Reset Lumia 800 - Phone Won't Turn ...

    My phone won't get past the Nokia image when starting up. I have tried a soft and hard reset without luck. For a hard reset, instruction say that I should start with the phone off but whenever I turn it off, it starts back up again! Maybe this is wha

  • How to monitor user logs,security logs,trace file,and performance monitori

    Hi guys, pls tel me how to monitor user logs,security logs,trace file,and performance monitoring. thanks regards kamal