Subscribe OJMS Message from Java Client ??

Hi
I am using Oracle 9iAS (9.0.3) with OJMS as JMS Resource Provider. I could able to publish the messages and MDB's will be able to subscribes the messages.
How to subscribe the above message from External Java Client.
Can anybody will provide some sample code.
Thanks in Advance
Madhu

The problem here is how to register JMS destination (topic or queue) in JNDI and then to obtain the initial context where they can be looked up. Then the business is the same for an External Java Client as the code that runs in JSP.
To do it, you may see the code examples in
http://www.oracle.com/technology/sample_code/tech/java/jms/index.html
The second example, "JMS1.1 Domain Unification Sample" which is for 10g, does work for me. I did not try the first example, "JMS Sample Application", which is for oc4j 9.0.2 or higher.

Similar Messages

  • Error while running EJB from java client on JBOSS

    Hi
    As i am new to EJB i have created a helloworld application in ejb which is working fine when i try to call it from servlet but when i try to invoke the same ejb from java client (i.e from diff jvm) on jboss i got the following error:
    javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]]]
         at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1399)
         at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:579)
         at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
         at javax.naming.InitialContext.lookup(InitialContext.java:351)
         at com.gl.TestClient.main(TestClient.java:39)
    Caused by: javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]]
         at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:254)
         at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1370)
         ... 4 more
    Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]
         at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:228)
         ... 5 more
    Caused by: java.net.ConnectException: Connection refused
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
         at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
         at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
         at java.net.Socket.connect(Socket.java:519)
         at java.net.Socket.connect(Socket.java:469)
         at java.net.Socket.<init>(Socket.java:366)
         at java.net.Socket.<init>(Socket.java:266)
         at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:69)
         at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:62)
         at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:224)
         ... 5 more
    Following is my code:
    Home Interface:
    package com.gl;
    import javax.ejb.CreateException;
    public interface testHome extends EJBHome {
         String JNDI_NAME = "testBean";
         public     test create()
         throws java.rmi.RemoteException,CreateException;
    Remote Interface:
    package com.gl;
    import java.rmi.RemoteException;
    import javax.ejb.EJBObject;
    public interface test extends EJBObject {
         public String welcomeMessage() throws RemoteException;
    Bean:
    package com.gl;
    import java.rmi.RemoteException;
    import javax.ejb.EJBException;
    import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
    public class testbean implements SessionBean {
         public void ejbActivate() throws EJBException, RemoteException {
              // TODO Auto-generated method stub
         public void ejbPassivate() throws EJBException, RemoteException {
              // TODO Auto-generated method stub
         public void ejbRemove() throws EJBException, RemoteException {
              // TODO Auto-generated method stub
         public void setSessionContext(SessionContext arg0) throws EJBException,
                   RemoteException {
              // TODO Auto-generated method stub
         public void ejbCreate(){}
         public String welcomeMessage(){
              return "Welcome to the World of EJB";
    ejb-jar.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
    <enterprise-beans>
    <session>
    <ejb-name>testBean</ejb-name>
    <home>com.gl.testHome</home>
    <remote>com.gl.test</remote>
    <ejb-class>com.gl.testbean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    </enterprise-beans>
    </ejb-jar>
    jboss.xml:
    <?xml version='1.0' ?>
    <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">
    <jboss>
    <enterprise-beans>
    <entity>
    <ejb-name>testBean</ejb-name>
    <jndi-name>testBean</jndi-name>
    </entity>
    </enterprise-beans>
    </jboss>
    Client code:
    package com.gl;
    import java.util.Properties;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.rmi.PortableRemoteObject;
    public class TestClient {
         public static void main(String[] args) throws Exception{
                   try{
                   /*     Properties props=new Properties();
                        props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
                        props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
                        props.put(Context.PROVIDER_URL, "jnp://localhost:1099");
                   Properties props = new Properties();
    props.put(Context.INITIAL_CONTEXT_FACTORY,
    "org.jnp.interfaces.NamingContextFactory");
    props.put(Context.PROVIDER_URL, "localhost:1099");
                        System.out.println("Properties ok");
                        //env.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.HttpNamingContextFactory");
                        //env.put(Context.PROVIDER_URL,"http://localhost:8080");
                        //env.put(Context.SECURITY_PRINCIPAL, "");
                        //env.put(Context.SECURITY_CREDENTIALS, "");
                        Context ctx=new InitialContext(props);
                        System.out.println("context ok");
                        //testHome home = (testHome)ctx.lookup("testBean");
                        Object obj = ctx.lookup ("testBean");
                        System.out.println("ojb = " + obj);
                        testHome ejbHome = (testHome)PortableRemoteObject.narrow(obj,testHome.class);
                   test ejbObject = ejbHome.create();
                   String message = ejbObject.welcomeMessage();
                        System.out.println("home ok");
                        System.out.println("remote ok");
                        System.out.println(message);
                        catch(Exception e){e.printStackTrace();}
    I am able to successfully deployed my ejb on JBOSS but i m getting above error when i am trying to invoke ejb from java client.
    kindly suggest me something to solve this issue.
    Regards
    Gagan
    Edited by: Gagan2914 on Aug 26, 2008 3:28 AM

    Is it a remote lookup? Then maybe this will help:
    [http://wiki.jboss.org/wiki/JBoss42FAQ]
    - Roy

  • How to receive message from flex client

    From the sample 'testdrive-datapush', I know how to receive message from backend(java) to flex client.
    Now, I want to know how to receive message from flex client to backend.
    I tried to find it in http://livedocs.adobe.com/blazeds/1/javadoc/.
    but I failed.
    Do you guys know the solution?

    Alex mentioned a solution in another thread.
    http://livedocs.adobe.com/blazeds/1/blazeds_devguide/help.html?content=messaging_config_3. html#256378
    [quote]
    Using a JMSConsumer object instead of the JMS adapter
    You use a JMSConsumer to listen for JMS messages without relying on the JMS adapter. Customer code is responsible from receiving JMS messages, converting them to Flex messages and using BlazeDS APIs to pass the message to Flex clients.
    In the following code example, a bootstrap service is used to create a JMSConsumer object when the server starts. When a JMS message is received, it is printed (rather than converting it to a Flex message and handing it to BlazeDS). For different workflows, a RemoteObject could be used to create JMSConsumer objects.
    [/quote]
    Do you know where is the code example?

  • Trouble to invoke BPEL from Java Client following rmi example

    I still have troubles to invoke my BPEL process from Java Client by following tutorial sample of 102.InvokingProcesses/rmi .
    I created my Java class within NetBeans IDE. And the following line of code return null for url,
    java.net.URL url = ClassLoader.getSystemResource("context.properties");
    I think that I need to have SystemResource set up somewhere, how should I do that?

    if you using oc4j.. then please make a small change in oc4j_context.properties
    from
    java.naming.provider.url=[java.naming.provider.url]
    to
    java.naming.provider.url=ormi://hostname/orabpel
    And please make sure the context.properties file which gets copied to classes/context.properties has this above entry. For more details please refer to build.xml under rmi folder.
    Please do let me know if you face any issue.

  • Call OSB from java client

    Hi',
    I am trying to call OSB from java client,
    The OSB proxy Service type is "WSDL Web Service", I am able to get response from SOAP UI with below request, Please help me with Java code,
    I have been Googling a lot for this however didnt got enough.
    Thanks
    Yatan
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://core.xxx.com/schema/ServiceHeader/V1.0" xmlns:v11="http://core.xxx.com/schema/Customer/V1.0" xmlns:v12="http://core.xxx.com/schema/Customer/V1.0">
    <soapenv:Header>
    <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
    <wsse:UsernameToken wsu:Id="UsernameToken-2" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <wsse:Username>weblogic</wsse:Username>
    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">welcome1</wsse:Password>
    </wsse:UsernameToken>
    </wsse:Security>
    <v1:GMWSHeader>
    <v1:SourceId>String</v1:SourceId>
    <v1:TransactionId>String</v1:TransactionId>
    <v1:TransactionTimeStamp>1967-08-13</v1:TransactionTimeStamp>
    <v1:ServiceVersion>LATEST</v1:ServiceVersion>
    </v1:GMWSHeader>
    </soapenv:Header>
    <soapenv:Body>
    <v11:GetDetailsRequest>
    <v11:Condition>
    <v12:SellingSource>?</v12:SellingSource>
    <v12:FulfillingFCNNbr>?</v12:FulfillingFCNNbr>
    </v11:Condition>
    </v11:GetDetailsRequest>
    </soapenv:Body>
    </soapenv:Envelope>

    Thanks Guys, I tried the ways you mentioned I am getting below error, this error is coming in both weblogic clientgen and webservice proxy from jdeveloper,
    I understand that this error has something to do with my process however not sure why is it coming, I will really appreciate if you can provide me some pointers.
    error:
    Buildfile: C:\JDeveloper\OSBClient\TestOSBClient\build.xml
    javaFromWSDL:
    [clientgen]
    *********** jax-ws clientgen attribute settings ***************
    wsdlURI: http://localhost:8001/xx/som/contracts/CustomerContract?wsdl
    packageName : com.osb.client
    destDir : C:\OSB
    *********** jax-ws clientgen attribute settings end ***************
    [clientgen] Consider using <depends>/<produces> so that wsimport won't do unnecessary compilation
    [clientgen] parsing WSDL...
    [clientgen]
    [clientgen]
    [clientgen] [ERROR] A class/interface with the same name "com.osb.client.SOMMessage" is already in use. Use a class customization to resolve this conflict.
    [clientgen] line 89 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
    [clientgen]
    [clientgen] [ERROR] (Relevant to above error) another "SOMMessage" is generated from here.
    [clientgen] line 51 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
    [clientgen]
    [clientgen] [ERROR] A class/interface with the same name "com.osb.client.TaskCompletionMessage" is already in use. Use a class customization to resolve this conflict.
    [clientgen] line 82 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
    [clientgen]
    [clientgen] [ERROR] (Relevant to above error) another "TaskCompletionMessage" is generated from here.
    [clientgen] line 76 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
    [clientgen]
    [clientgen] [ERROR] Two declarations cause a collision in the ObjectFactory class.
    [clientgen] line 89 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
    [clientgen]
    [clientgen] [ERROR] (Related to above error) This is the other declaration.
    [clientgen] line 51 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
    [clientgen]
    [clientgen] [ERROR] Two declarations cause a collision in the ObjectFactory class.
    [clientgen] line 82 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
    [clientgen]
    [clientgen] [ERROR] (Related to above error) This is the other declaration.
    [clientgen] line 76 of http://localhost:8001/xx/som/contracts/CustomerContract?SCHEMA%2FSOMResources%2FXSD%2FSOMCommon
    [clientgen]
    BUILD FAILED
    weblogic.wsee.tools.WsBuildException: Error running JAX-WS clientgen: null
         at weblogic.wsee.tools.clientgen.jaxws.ClientGenImpl.execute(ClientGenImpl.java:175)
         at weblogic.wsee.tools.anttasks.ClientGenFacadeTask.execute(ClientGenFacadeTask.java:244)
         at weblogic.wsee.tools.anttasks.ClientGenTask.execute(ClientGenTask.java:365)
         at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatinxxethodAccessorImpl.invoke(DelegatinxxethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
         at org.apache.tools.ant.Task.perform(Task.java:348)
         at org.apache.tools.ant.Target.execute(Target.java:357)
         at org.apache.tools.ant.Target.performTasks(Target.java:385)
         at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
         at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
         at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
         at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
         at org.apache.tools.ant.Main.runBuild(Main.java:758)
         at org.apache.tools.ant.Main.startAnt(Main.java:217)
         at org.apache.tools.ant.Main.start(Main.java:179)
         at org.apache.tools.ant.Main.main(Main.java:268)
    Caused by: Error starting wsimport:
         at com.sun.tools.ws.ant.WsImport2.execute(WsImport2.java:757)
         at weblogic.wsee.tools.clientgen.jaxws.ClientGenImpl.execute(ClientGenImpl.java:169)
         ... 19 more
    Caused by: com.sun.tools.ws.wscompile.AbortException
         at com.sun.tools.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:136)
         at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2255)
         at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:194)
         at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:140)
         at com.sun.tools.ws.wscompile.WsimportTool.buildWsdlModel(WsimportTool.java:261)
         at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:203)
         at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:188)
         at com.sun.tools.ws.ant.WsImport2.execute(WsImport2.java:738)
         ... 20 more
    Total time: 3 seconds

  • Send short message from Java application on mobile phone to server; http

    Hello!
    My question is: can I send short message from Java application on mobile phone to server - with the use of SMS (WMA) or http connection?
    I found this topic http://forums.sun.com/thread.jspa?threadID=5405431 about: "how to send data from midlet to servlet using doPost method".
    There is also such topic http://forums.sun.com/thread.jspa?threadID=5408046&tstart=0 about: "CLDC and MIDP - sending SMS to server -> Wireless Messaging API (WMA)".
    Please, kindly help me.
    Code from the topic mentioned above, edited by me so that it can be read easily:
    //http://forums.sun.com/thread.jspa?threadID=5405431
    //CLDC and MIDP - Re: how to send data from midlet to servlet using doPost method
    I want to know how to pass the values .
    for examples : this is what i wrote for doGet
    String url = setting.getUrl().toString()"/testProServlet/servlet/UpdateCompanyProfile?userId="+loggedInUserId"&svComp="saveCompHex;
    userId and svComp has the data which is very long so i wanted to use doPost.
    Now i dont know how to do it.
    This is what i have done in doGet (midlet)
    public void saveCompanyProfile(String saveComp,int flag,String blankFieldNm)
         System.out.println("flag===" flag);
         if (flag==1)
              displayAlert("Company Profile Edit",blankFieldNm+" field cannot be blank.",AlertType.ERROR, edCmpRecForm, true);
         else
              String saveCompHex = helper.encodeHexString(saveComp);
              // String saveCompHex =saveComp;
              HttpConnection httpConn = null;
              serverSettings setting = new serverSettings();
              System.out.println("saveCompHex===" saveCompHex);
              String url = setting.getUrl().toString()"/testProServlet/servlet/UpdateCompanyProfile?userId="loggedInUserId"&svComp="saveCompHex;
              System.out.println("url of save company profile:: "+url);
              InputStream is = null;
              OutputStream os = null;
              try {
                   // Open an HTTP Connection object
                   httpConn = (HttpConnection) Connector.open(url);
                   System.out.println("urlMidlet1 save edited company data===::" url.length());
                   // Setup HTTP Request
                   httpConn.setRequestMethod(HttpConnection.POST);
                   httpConn.setRequestProperty("User-Agent","Profile/MIDP-1.0 Confirguration/CLDC-1.0");
                   System.out.println("urlMidlet2===" url);
                   int respCode = httpConn.getResponseCode();
                   System.out.println("respCode edit company profile=====" respCode);
                   if (respCode == httpConn.HTTP_OK)
                        StringBuffer sb = new StringBuffer();
                        os = httpConn.openOutputStream();
                        is = httpConn.openDataInputStream();
                        int chr;
                        while ((chr = is.read()) != -1)
                             sb.append((char) chr);
                        String sResultSvCompanyProfile= sb.toString();
                        System.out.println("+++++++++++++Company sResult+++++++++++++==="sResultSvCompanyProfile);
                        if (resultViewCompanyProfile.trim().equals(""))
                             System.out.println("++++++++++++++If++++++++++++++SaveCompanyProfile===");
                             displayAlert("Login Incorrect","Username and Password incorrect", AlertType.ERROR, mainForm, true);
                        else
                             System.out.println("++++++++++++++Else++++++++++++++SaveCompanyProfile===");
                             //companyProfile();
                             displayAlert1("Information","Company Profile edited successfully", AlertType.INFO, profileMenuScreen, true);
                   else
                        System.out.println("Error in opening HTTP Connection. Error#" respCode);
                        //the line below divided into two lines because it was too long
                        displayAlert("Connection Failed","Cannot connect to server, please contact the Administrator.",
                        AlertType.ERROR, mainForm, false);
              catch(IOException e)
                   e.getMessage();
              finally {
                   if(is!= null)
                        try
                             is.close();
                        catch (IOException e)
                             // TODO Auto-generated catch block
                             e.printStackTrace();
                             displayAlert("Connection Failed","Cannot connect to server, please contact the Administrator.",
                             AlertType.ERROR, mainForm, false);
                   if(os != null)
                        try
                             os.close();
                        catch (IOException e)
                             // TODO Auto-generated catch block
                             e.printStackTrace();
                             displayAlert("Connection Failed","Cannot connect to server, please contact the Administrator.",
                             AlertType.ERROR, mainForm, false);
                   if(httpConn != null)
                        try
                             httpConn.close();
                        catch (IOException e)
                             // TODO Auto-generated catch block
                             e.printStackTrace();
                             displayAlert("Connection Failed","Cannot connect to server, please contact the Administrator.",
                             AlertType.ERROR, mainForm, false);
              } //end finally
         } //end else (?)
    } //end savecompany

    hi,
    SMS API(WMA) is an optional package. It is not a MIDP1.0 or MIDP2.0 api's.
    There are phones which has WMA api with MIDP1.0 support .... Nokia 3650
    Seimens has some phone with their own api's to send sms.Check out seimens site for more info
    BTW, What do you mean buy sending SMS to Server????
    If you want to send message to server you can do it with Http.
    HTH
    phani

  • ESB Webservice call from Java client

    Hi,
    i need to call webservice from Java client which inturn will call ESB
    I tried creating proxy from the WSDL in jDeveloper and tried setting the following end points
    My concrete WSDL path :http://10.237.25.63:8889/esb/wsil/SubroCaseESBSystem/InputRouter?wsdl
    My EM -path:"http://10.237.25.63:8889/event/subrotest/SubroInputrouter"
    When i call the concreteWSDL im getting
    "HTTP transport error: javax.xml.soap.SOAPException: java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Bad response: 405 Method Not Allowed"
    If i call the EM pathim getting
    "javax.xml.rpc.soap.SOAPFaultException"
    Any guess as how i need to call my ESB from client.

    Hello Venkat,
    - I have created Java Proxy using Jdeveloper for ESB webservice and I usually use http://host:port/event/...?wsdl, and it creates stub which works without any modification. Let me know, may be I can try sending sample project
    - I would like to verify if you are having issue with Java client or ESB itself, are you able to execute that ESB process/service from EM test page or from any other BPEL process?
    Regards,
    Chintan

  • Sending ADT message from java

    Hello,
    I'm trying to send an ADT message from Java using the JMS API.
    However, when compiling the java program it complains on the
    following statement :
    adt_msg.setAdtPayload(empmsg) ;
    because it is expecting empmsg to implement the deprecated
    CustomDatum interface instead of the ORAData interface.
    I suspect the problem is linked with the version of the
    AQAPI.jar file I'm using. I tried already the file that comes
    with the Linux version and the one with the W2000 version but
    both give the same problem.
    Any suggestions ????
    tx,
    Roger.

    Hi,
    The AQ JMS api in 9.0.1 still expects CustomDatum payloads. When
    you generate the java class using Jpublisher, use the following
    flag:
    -compatible=customdatum
    In 9.0.2 and iASv2, the AQ JMS api will support the OraData
    interface as well. I think if you can get the 9.0.1.2 patch,
    that also might work
    Bhagat

  • Send message from java not client

    I have a java app running on my server and I'd like to send
    messages to subscribed clients. All the messaging examples I find
    have the messages originating from a flex producer. I want java to
    be the producer.

    I used this example to get it done.
    http://western-skies.blogspot.com/2006/07/flex-sending-messages-from-server-side.html

  • Accessing Coherence Extend* Proxy Deployoed on Weblogic Coherence Cluster from Java Client

    Hi,
    I am trying to access Extend Proxy through Thick Java Client
    Followed steps as per below links and deployed a GAR on 3 Server ( 2 Storage Enabled Coherence Cluster and 1 Coherence Storage Disabled Extend Proxy Enabled). I could see ExtendProxyService using JMX and can see Port running on the System.
    Ref :
    Setting Up Coherence*Extend - 12c (12.1.2)
    http://docs.oracle.com/middleware/1212/coherence/COHAG/deploy_options.htm#CHDJBJDI
    Issue :
    When I tried to Execute Java Client to Connect to Proxy Server it Connects to Port and then Disconnects with ConnectionException as below.
    Observer below Lines in Box is show he Connected Socket with Port 9099 which is Extend Proxy Port
    Error Message
    2013-11-08 14:55:55.114/1.202 Oracle Coherence GE 12.1.2.0.0 <D5> (thread=TcpClientRemoteService:TcpInitiator, member=n/a): Started: TcpInitiator{Name=TcpClientRemoteService:TcpInitiator, State=(SERVICE_STARTED), ThreadCount=0, Codec=Codec(Format=POF), Serializer=com.tangosol.io.DefaultSerializer, PingInterval=0, PingTimeout=30000, RequestTimeout=30000, ConnectTimeout=10000, SocketProvider=[email protected], RemoteAddresses=WrapperSocketAddressProvider{Providers=[[DTC37446E9C6CBD/127.0.0.0:9099]]}, SocketOptions{LingerTimeout=0, KeepAliveEnabled=true, TcpDelayEnabled=false}}
    2013-11-08 14:55:55.146/1.234 Oracle Coherence GE 12.1.2.0.0 <D5> (thread=main, member=n/a): Connecting Socket to 127.0.0.0:9099
    2013-11-08 14:55:55.146/1.234 Oracle Coherence GE 12.1.2.0.0 <Info> (thread=main, member=n/a): Connected Socket to 127.0.0.0:9099
    2013-11-08 14:55:55.161/1.249 Oracle Coherence GE 12.1.2.0.0 <Info> (thread=main, member=n/a): Error establishing a connection with 127.0.0.0:9099: com.tangosol.net.messaging.ConnectionException: TcpConnection(Id=null, Open=true, LocalAddress=0.0.0.0:54384, RemoteAddress=127.0.0.0:9099)
    2013-11-08 14:55:55.161/1.249 Oracle Coherence GE 12.1.2.0.0 <Error> (thread=main, member=n/a): Error while starting service "TcpClientRemoteService": com.tangosol.net.messaging.ConnectionException: could not establish a connection to one of the following addresses: [127.0.0.0:9099]; make sure the "remote-addresses" configuration element contains an address and port of a running TcpAcceptor
        at com.tangosol.coherence.component.util.daemon.queueProcessor.service.peer.initiator.TcpInitiator.openConnection(TcpInitiator.CDB:121)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.service.peer.Initiator.ensureConnection(Initiator.CDB:11)
        at com.tangosol.coherence.component.net.extend.remoteService.RemoteCacheService.openChannel(RemoteCacheService.CDB:7)
        at com.tangosol.coherence.component.net.extend.RemoteService.doStart(RemoteService.CDB:11)
        at com.tangosol.coherence.component.net.extend.RemoteService.start(RemoteService.CDB:5)
        at com.tangosol.coherence.component.util.SafeService.startService(SafeService.CDB:53)
        at com.tangosol.coherence.component.util.safeService.SafeCacheService.startService(SafeCacheService.CDB:5)
        at com.tangosol.coherence.component.util.SafeService.ensureRunningService(SafeService.CDB:27)
        at com.tangosol.coherence.component.util.SafeService.start(SafeService.CDB:14)
        at com.tangosol.net.ExtensibleConfigurableCacheFactory.startService(ExtensibleConfigurableCacheFactory.java:681)
        at com.tangosol.net.ExtensibleConfigurableCacheFactory.ensureService(ExtensibleConfigurableCacheFactory.java:599)
        at com.tangosol.coherence.config.scheme.AbstractCachingScheme.realizeCache(AbstractCachingScheme.java:50)
        at com.tangosol.coherence.config.scheme.AbstractBundlingScheme.realizeCache(AbstractBundlingScheme.java:31)
        at com.tangosol.net.ExtensibleConfigurableCacheFactory.ensureCache(ExtensibleConfigurableCacheFactory.java:254)
        at com.tangosol.net.CacheFactory.getCache(CacheFactory.java:205)
        at com.tangosol.net.CacheFactory.getCache(CacheFactory.java:182)

    If this proxy design (not starting up due to a invalid entry in "authroized-hosts") is on-purpose from Coherence Engineers - then it should be re-visited.
    I think the PROXY Server should just log a message stating about the invalid DNS entry for the Authorized-host and continue with the startup...Failing to start completely doesn;t make sense since one cannot rely completely on DNS to
    say everything should be correct before a server start.
    Ofcourse you can overcome by writing your own Custom Filter - but the issue pop's out as with any custom filter(s) is maintaining them along the road (with all minor/major coherence upgrades).
    Also - this "Authorized-Hosts" concept should be carefully analyzed particularly for the following issues...
    (1) if the client IP is changed in the DNS server - will the proxy-server allow the new Client connection without any issues? when will the PROXY server flush its CLIENT DNS entries or what is the TTL time-limit for a CLIENT cached through Authorized-hosts by the PROXY-SERVER?
    (2) Suppose, we have a CLIENT in the "Authroized-Hosts" making a valid connection to the PROXY and putting some cache into the SERVER CACHE through the PROXY....now if the IP-address (DNS being the same) of the CLIENT is changed - can the CLIENT can GET the CACHE it just PUT into the SERVER without any ERRORS?
    (3) How often we need to re-start PROXIES? Do we need to re-start them often for the DNS issues (if any) mentioned above?
    Looks like the Limited documentation & examples for Coherence*Extend - particularly for .NET & C++ clients & *Extend Proxies is a point of concern.
    vk

  • OJMS and Standalone Java Client

    Hi ,
    any one had luck in accessing the ojms queue from a standalone java application.I am using oc4j standalone 9.0.0.3 container.I was able to do it from a jsp page .
    But when i tried the same from standalone java client , its giving me javax.naming.NameNotFoundException: "No object bound for java:comp/resource/TestRP/QueueConnectionFactories/RPTable". The same lookup succeeds inside the jsp.Is there any additional configuration to be there for the standalone java client ?
    thanks in advance ..
    prem

    Perhaps too obvious a point, but your standalone java client is running in a process different from that of oc4j. How do your java client process connect to oc4j?
    Note that a jsp is running inside oc4j.

  • Unable to capture messages from java.util.logging

    I have a class called (Caller.java) which invokes a method called foo from another java class(Util.java) using reflection API.Now this method foo logs messages using Java's logger.My requirement is to call foo for 3 times from Caller and capture/redirect the log messages into 3 log files.
    But only the first log file is capturing the log messages(from logger) and other two are not ?
    Plz suggest if I am doing somethin wrong here ?
    Caller.java
    package project2;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.PrintStream;
    import java.lang.reflect.Method;
    public class Caller {
        public Caller() {
        public static void main(String[] args) throws Exception {
            Caller caller = new Caller();
            for (int i = 0 ;i<3 ;i++ )  {
                caller.createLogStream(i);
                System.setOut(caller.getPs());
                System.setErr(caller.getPs());
                /*****************Invoking Util.java*****************************/
                Class clas = Class.forName("project2.Util");
                Method m = clas.getMethod("foo",null);
                Object obj =clas.newInstance();
                m.invoke(obj,null);
        public void createLogStream(int i) throws FileNotFoundException {
            ps = new PrintStream(new File(System.getenv("HOME")+File.separator+"MyLog"+i+".log"));
        public void closeLogStream(){
            ps.close();
            ps = null;
        private PrintStream ps = null;
        public PrintStream getPs() {
            return ps;
    } Util.java
    package project2;
    import java.util.logging.Logger;
    public class Util {
        Logger logger = null;
        public Util() {
            logger = Logger.getLogger(this.getClass().getName());
        public void foo(){
            System.out.println("Hello out stream");
            System.err.println("Hello error stream");
            logger.info("This is an information");
            logger.warning("This is a warning message");
            logger.severe("This is fatal!! ");
    }First Log file MyLog0.log:
    Hello out stream
    Hello error stream
    Feb 16, 2009 7:55:55 PM project2.Util foo
    INFO: This is an information
    Feb 16, 2009 7:55:55 PM project2.Util foo
    WARNING: This is a warning message
    Feb 16, 2009 7:55:55 PM project2.Util foo
    SEVERE: This is fatal!!
    Feb 16, 2009 7:55:55 PM project2.Util foo
    INFO: This is an information
    Feb 16, 2009 7:55:55 PM project2.Util foo
    WARNING: This is a warning message
    Feb 16, 2009 7:55:55 PM project2.Util foo
    SEVERE: This is fatal!!
    Feb 16, 2009 7:55:55 PM project2.Util foo
    INFO: This is an information
    Feb 16, 2009 7:55:55 PM project2.Util foo
    WARNING: This is a warning message
    Feb 16, 2009 7:55:55 PM project2.Util foo
    SEVERE: This is fatal!! Other 2 log files have only this much
    Hello out stream
    Hello error stream

    A stale Connection Factory or Connection Handle may be used in SOA 11g
    Regards,
    Anuj

  • How do you use .wsse policy file from Java Client?

    I'd like to call a WSSE enabled web service from my Java client but setup my encryption/signing requirements with a .wsse policy file.
    I know how to call a web service by programmatically setting up the security headers as described in:
    http://e-docs.bea.com/workshop/docs81/doc/en/core/index.html
    But how can I do the same thing by simply using a .wsse file?

    import java.awt.*;
    import java.applet.Applet;
    import java.awt.event.*;
    import java.net.*;
    public class links extends java.applet.Applet {
       Panel panel = new Panel();
       public links(){
          super();
          add(panel);
          Link link = new Link(this,"Answers for programmers;- ","http://forum.java.sun.com");
          panel.add(link);
       public void init(){
          setVisible(true);
       public class Link extends Label implements MouseListener {
          Applet applet;
          Color fcolor = Color.blue;
          Color lcolor = Color.pink;
          String text;
          String word;
       public Link(Applet ap, String s, String s1){
          super(s);
             this.applet = ap;
             this.text = s;
             this.word = s1;
             addMouseListener(this);
          setForeground(fcolor);
       public void paint(Graphics g){
       super.paint(g);
          if (getForeground() == lcolor){
             Dimension d = getSize();
             g.fillRect(1,d.height-5,d.width,1);
       public void update(Graphics g){paint(g);}
       public void mouseClicked(MouseEvent e){
          try{
             URL url = new URL(word);
             applet.getAppletContext().showDocument(url,"_self");
          catch(MalformedURLException er){ }
       public void mouseEntered(MouseEvent e){
          setForeground(lcolor);
          setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
          repaint();
       public void mouseExited(MouseEvent e){
          setForeground(fcolor);
          setCursor(Cursor.getDefaultCursor());
          repaint();
    public void mousePressed(MouseEvent e){}
    public void mouseReleased(MouseEvent e){}
       public static void main (String[] args){
          new links(); 
    }

  • How to upload file from java client to php

    hi
    i am trying to upload/send a file from client using swing/applet
    and receiving it with php code.
    here is the php code which uploads the post file from the client
    $uploaddir = "/home/raghavendra/Documents/";
    $file = basename( $_FILES["uploadedfile"]["name"]);
    echo "file:\n".$file;
    $uploadfile = $uploaddir. $file;
    if (move_uploaded_file($_FILES["uploadedfile"]["tmp_name"],$uploadfile)) {
    echo "File is valid, and was successfully uploaded.\n";
    else {
    echo "File upload failure Possible file upload attack!\n";
    and corresponding different java code which post the
    1)
    public void postmethodTest(String filefrom){
    try{
    String hostname = "localhost";
    int port = 80;
    InetAddress addr = InetAddress.getByName(hostname);
    Socket socket = new Socket(addr, port);
    // Send header
    String path ="/php_prgs/var/www/nsboxng/htdocs/tryupdate.php";
    File theFile = new File(filefrom);
    System.out.println ("size: " + (int) theFile.length());
    DataInputStream fis = new DataInputStream(new BufferedInputStream(new FileInputStream(theFile)));
    byte[] theData = new byte[(int) theFile.length( )];
    fis.readFully(theData);
    fis.close();
    DataOutputStream raw = new DataOutputStream(socket.getOutputStream());
    Writer wr = new OutputStreamWriter(raw);
    String command =
    "POST "+path+" HTTP/1.0\r\n"
    + "Content-type: multipart/form-data, boundary=mango\r\n"
    + "Content-length: " + ((int) theFile.length()) + "\r\n"
    + "\r\n"
    + "--mango\r\n"
    + "content-disposition: name=\"MAX_FILE_SIZE\"\r\n"
    + "\r\n"
    + "\r\n--mango\r\n"
    + "content-disposition: attachment; name=\"datafile\"" ;
    String filename="test.doc\"\r\n"
    + "Content-Type: text/doc\r\n"
    + "Content-Transfer-Encoding: binary\r\n"
    + "\r\n";
    wr.write(command);
    wr.flush();
    raw.write(theData);
    raw.flush( );
    wr.write("\r\n--mango--\r\n");
    wr.flush( );
    BufferedReader rd = new BufferedReader(new
    InputStreamReader(socket.getInputStream()));
    String line;
    while ((line = rd.readLine()) != null) {
    System.out.println("out"+line);
    wr.close();
    raw.close();
    socket.close();
    } catch (Exception e) {System.out.println(e.toString());}
    2)
    public void postMethod(String strURL, String filefrom){
    try {
    String fname = filefrom.substring(filefrom.lastIndexOf("/")+1, filefrom.length());
    File input=new File(filefrom);
    // Prepare HTTP post
    PostMethod post = new PostMethod(strURL);
    // Request content will be retrieved directly
    // from the input stream
    // Per default, the request content needs to be buffered
    // in order to determine its length.
    // Request body buffering can be avoided when
    // content length is explicitly specified
    post.setRequestEntity(new InputStreamRequestEntity(new FileInputStream(input), input.length()));
    // Specify content type and encoding
    // If content encoding is not explicitly specified
    // ISO-8859-1 is assumed
    //post.setRequestHeader("Content-type", "text/xml; charset=ISO-8859-1");
    post.setRequestHeader("Content-Type","multipart/form-data");
    post.setRequestHeader("Content-Disposition", "form-data; name="+fname);
    // Get HTTP client
    HttpClient httpclient = new HttpClient();
    // Execute request
    try {
    int result=httpclient.executeMethod(post);
    // Display status code
    System.out.println("Response status code: " +result);
    // Display response
    System.out.println("Response body: ");
    // System.out.println(post.getResponseBodyAsString());
    BufferedReader console = new BufferedReader(new InputStreamReader(post.getResponseBodyAsStream()));
    String name = null;
    String line = null;
    try {
    while ((line = console.readLine()) != null) {
    System.out.println("output"+line);
    //name = console.readLine();
    catch (IOException e) { name = "<" + e + ">"; }
    // System.out.println("Hello " + name);
    } finally {
    // Release current connection to the connection pool
    // once you are done
    post.releaseConnection();
    catch(IOException e){
    but am getting else condition response from php code
    but if i post with html code it is working fine.
    can anybody help me please where i have to change the code
    please suggest me. am in a big trouble and i have to complete this as soon as possible

    One thread is enough.
    http://forum.java.sun.com/thread.jspa?threadID=5198449
    You could have bumped it instead. Also, you still just posted a junk of unformatted stuff. Furthermore, for HttpClient support ask at an HttpClient mailing list of rorum.

  • Would like to know how to read SOAP Messages from SOAP Client

    Hello,
    I am new to Webservices. Here is what I want to do.
    I need to develop a Web Service provider application.
    Here are the tools I am using to develop this application.
    a) WSAD 5.1.2
    b) Axis 1.0 built within WebSphere.
    I do have a WSDL file and I generated the code by using WSAD ==>WebService ==> Generate Java bean skeleton option. I want to know, how I can read the SOAP request message from the generated code and to add new SOAP header element.
    Any help you can provide would be greatly appreciated.

    Depending on the version of WebSphere you are using, there should be a menu option to create a dynamic web project. This will set up the basic structure of the application for you. Also, right-click on the newly created web application and there should be a context menu something like Web Services -> Deploy Web Service. This will do some more under-the-covers work for you.
    The webservices.xml deployment descriptor is only created when you generate your Java interfaces and helper classes. For example, if you are starting with a WSDL, you would right-click on the document, select Web Services -> Generate Java Bean Skeleton, and then follow the couple of dialog boxes afterwards. The webservices.xml document will then be created under the WEB-INF directory.
    I�d be wary of introducing any external web service software into a WebSphere environment. On my last project we ran into a few tricky SOAP API conflicts so we decided to stick with pure IBM implementations wherever possible. That said, this is some sample code that I've recycled from the Monson-Haefel book I've mentioned before:
    package sandbox;
    import javax.xml.namespace.QName;
    import javax.xml.rpc.handler.MessageContext;
    import javax.xml.rpc.handler.soap.SOAPMessageContext;
    import javax.xml.soap.*;
    public class MessageHandlerID extends javax.xml.rpc.handler.GenericHandler{
      QName [] headerNames = null;
      public QName [] getHeaders(){
        if(headerNames == null){
          QName myHeader = new QName("http://speck.net.au/message-id", "message-id");
          headerNames = new QName[] { myHeader };
        return headerNames;
      public boolean handleRequest(MessageContext context){
        String messageID = new java.rmi.dgc.VMID().toString();
        try{
          SOAPMessageContext soapCntxt = (SOAPMessageContext)context;
          SOAPMessage message = soapCntxt.getMessage();
          SOAPHeader header = message.getSOAPPart().getEnvelope().getHeader();
          Name blockName = SOAPFactory.newInstance().createName("message-id","mi","http://speck.net.au/message-id");
          SOAPHeaderElement headerBlock = header.addHeaderElement(blockName);
          headerBlock.setActor("http://speck.net.au/message-id/logger");
          headerBlock.addTextNode( messageID );
          return true;
        } catch(javax.xml.soap.SOAPException se){
              throw new javax.xml.rpc.JAXRPCException(se);
    }It doesn't do much but might give you some ideas.
    You may have already come across this, but I found the following RedBook invaluable:
    Wahli, U., Garcia, G. O., Cocasse, S. and Muetschard, M. (2004). WebSphere Version 5.1 Application Developer 5.1.1 Web Services Handbook. IBM.

Maybe you are looking for