Problem with JMS from session bean

 

My guess is that in your effort to work around the
clustering/ejb/jndi problems, you have a producer
sending on one topic, and a consumer listening on
another topic. You can check to see if they are the
same destination using the (uncompiled) code snippets
below at both the producer and consumer ends.
import weblogic.jms.common.DestinationImpl;
Topic topic;
DestinationImpl destination = (DestinationImpl) topic;
System.out.println("name = " + destination.getServerName() + "/" +
destination.getName());
System.out.println("back-end id = " + destination.getBackEndId());
System.out.println("destination id = " + destination.getDestinationId());
_sjz.
"Malcolm Robbins" <[email protected]> wrote in message
news:[email protected]...
>
This was also posted to the EJB newsgroup and was asked to post the secondissue
here. Please focus on the second issue, but the first providesbackground.
>
>
I have discovered two significant problems in WLS6.0 with JNDi and JMSthat do
not occur in the Sun Reference implementation (1.3 Beta).
Attached is some code you can try to see the problem.
I have developed a JmsClient that simply looks up a session bean andpasses it
a string to publish. The session bean is meant to publish to a JMS topic.
However I have discovered two problems:
1) In teh ejbCreate() method I look up the topic connection factory andtopic
in JNDI. These are referenced as "java:comp/env/jms/JmsConnectionFactory"and
"java:comp/env/jms/JmsTopic" respectively. Here's a fragment of theejb-jar
descriptor
<resource-ref>
<description>The (probably durable) Topic Connection Factory to connectto</description>
<res-ref-name>jms/JmsConnectionFactory</res-ref-name>
<res-type>javax.jms.TopicConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-env-ref>
<description>The Jms Source Topic to publish to</description>
<resource-env-ref-name>jms/JmsTopic</resource-env-ref-name>
<resource-env-ref-type>javax.jms.Topic</resource-env-ref-type>
</resource-env-ref>
As you can see they are resource references and resoruce environmentreferences
respectively. The weblogic-ejb-jar maps these to the real JNDI names"TopicConnectionFactory"
amd "SchemaTopic" respectively as shown below by the fragment:
<weblogic-ejb-jar>
...etc...
<reference-descriptor>
<resource-description>
<res-ref-name>jms/JmsConnectionFactory</res-ref-name>
<jndi-name>TopicConnectionFactory</jndi-name>
</resource-description>
<resource-env-description>
<res-env-ref-name>jms/JmsTopic</res-env-ref-name>
<jndi-name>SchemaTopic</jndi-name>
</resource-env-description>
</reference-descriptor>
Now here's the first problem. When this is deployed the resourceenvironment
"logical" name (JNDI linkref) for the topic is not defined. The code willhappily
find the connection factory (presuming you've set these administeredobjects at
the console).
2) The second problem now arises. In the code I have ahcked it so thatwhen
the JNDI lookup fails it tries looking up the real topic in JNDI(SchemaTopic)
directly.
This works and teh bean now appears to work, albeit with a directlyhardcoded
JNDI reference in it. However, if you hook up a standard JMS consumer tothat
topic it will not consuem the message that is published!!! While thestats clock
up at the console the message appears to go into a black hole. I canprovdie
a stadnard consumer if you need one.
I have the code working fine as-is in teh Sun Reference implementation soI presume
these are bugs with WL6.0.
Can anyone advise workarounds and/or fix the problem?

Similar Messages

  • Probleme with transaction in session beans

    Hello.
    i create an session bean which call enties beans.
    When i execute un example first time, its correct.
    when i execute for second time, the methode don't stop.
    i think it is problem of transaction.
    thank you

    Hi,
    It is impossible to answer your with the given information. When ever you are asking a question please put the relavent informatin like code and deployment descriptors. So please do post the required information.
    Ashok

  • URGENT ! JDEV 10.1.2 Problem with data control generated from session bean

    I got a problem with data control generated from session bean which return a collection of data transfer object.
    The dto's seem to be correct. The session bean load correctly the data into and the object's are plenty of data. Using the console to display the dto content is ok.
    When generating a data control from this session bean and associate the dto included in the collection only the first object level and one-to-one dto object are correctly setted in the data control. Object that represent collection into the dto (one-to-many foreign key) are setted as collection with an iterator but the structure of the object is not setted. I don't know how to associate this second level of collection with the dto bean class to obtain the attributes definition.
    I created a case with hr schema like the hrApp demo application in the tutorial with departments and employees table. I got the same problem.
    Is it a bug ?
    It exists a workaround to force the data control to understand the collection data structure ?
    Help is welcome ! this is urgent !!!

    we found the problem by assigning the child dto bean class to the node representing the iterator in the xml file corresponding to the master dto.

  • Problem with connecting from Netweaver Session Bean to SAP R/3

    Hi,
    i just want a connection to RFC in SAP R/3 and with help of sap ("Proxy generation" etc) and wizard in NWDS i get the rfc. Now i want to connect and use it (like in handbook) but: Every time i create and use jcoclient.connect() system gets an error like:
    "Class File Editor
    Source not found
    The jar file jrfc.jar has no source attachment."
    I have add all files that are used to "Used DCs" or bind library into projekt as "Third party library", but the error is still there.
    Any idea? Do i have to make something else? Some failure made?
    thx
    Here is text for connection:
    Created on 26.06.2008
    To change the template for this generated file go to
    Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    package com.XXXXXXXXXXXXXXXXX;
    import com.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX;
    import com.sap.aii.proxy.framework.core.ApplicationFaultException;
    import com.sap.aii.proxy.framework.core.SystemFaultException;
    import com.sap.mw.jco.JCO;
    @author XXXXX
    To change the template for this generated type comment go to
    Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    public class MyMainClass extends Object
         public static void main(String[] args)
              throws ApplicationFaultException, SystemFaultException
              JCO.Client jcoclient =
                   JCO.createClient(
                        "XXX", //Client
                        "XXX", //User
                        "XXX", //Password
                        "XXX", //Language
                        "XXX", //Server
                        "XXX", //System
                        "XXX"); //Group
              jcoclient.connect();
              jcoclient.disconnect();
    Edited by: Torsten on Aug 27, 2008 10:43 AM
    Where can we download SAP NW7.0 (2004s) as Java Trial for testing? We only find ABAP Trial... Link? thx

    So we tested some things that are described in the SDN or by SAP with Connectors.
    We tested JCO version 2.0.12, 2.1.18 and 3.0 in J2EE Projects in netweaver and in Eclipse (Standalone).
    For version 2.0.12 there is a failure that this version is not compatible with the other things in netweaver.
    This version is for standalone and integrated sytems.
    For version 2.1.18 is only described as standalone and so failure happened in netweaver that other classes are coruppted or missed. The internal test in "content administrator" (Ping and Test) do not work and had the same error.
    For version 3.0 (that displace the other two versions) there is many to do in  settings and coding that we do not have tested yet because project is not that small to write it for JCO 3.0 only for testing. When we only displaced files in netweaver the server do not start any more.
    So:
    Is there a way to call R/3 from session bean and 1. create an JCO client or 2. add a client to the "standard" pool of netweaver to use it?
    Any ideas? help? links?
    Project have to be complete in september...
    Our combi is SAP Netweaver 2004 SP21 on Windows XP SP2 / Server 2003 Standard SP1 with JVM 1.4.2_16... need of any more info?
    thx

  • How to send message to MessageDrivenBean from Session bean in JDeveloper

    HI I am trying to write a sample program using JDeveloper.
    I am trying to do these steps
    1) client class which gets Session bean and calls its method.
    2) write Stateless Session bean with a method which gets MDB and sends message.
    3) write Message Driven Bean ( which prints message recieved from Session bean )
    Set up
    =======
    jms.xml
    {JDevHome}\jdev\system9.0.5.2.1618\oc4j-config\jms.xml : changed jms.xml file and included
         <topic name="Demo Topic" location="jms/theTopic">
              <description>A dummy topic</description>
         </topic>
         <topic-connection-factory name="Demo Topic Connection Factory" location="jms/theTopicConnectionFactory">
              <description>A dummy topic connection factory</description>
         </topic-connection-factory>
    orion-ejb-jar.xml:
    edited MDB entry to
    <message-driven-deployment name="MessageLogger"
    destination-location="jms/theTopic" connection-factory-location="jms/theTopicConnectionFactory">
    </message-driven-deployment>
    Implementation
    ===============
    In client class:
    I am getting session bean like
    Properties props = System.getProperties();
    props.put( javax.naming.Context.INITIAL_CONTEXT_FACTORY , "com.evermind.server.rmi.RMIInitialContextFactory");
    props.put( javax.naming.Context.SECURITY_PRINCIPAL , "admin" );
    props.put( javax.naming.Context.SECURITY_CREDENTIALS,"welcome");
    props.put( javax.naming.Context.PROVIDER_URL ,"ormi://localhost:23891/current-workspace-app");
    Context ctx = new InitialContext(props);
    MySessionHome home = (MySessionHome)
              javax.rmi.PortableRemoteObject.narrow(obj, MySessionHome.class);
    This part works fine, and I am calling method on session bean created out of home.
    In Session bean:
    I want to get TopicConnectionFactory and tried these two ways:
    a)
    getting the context by setting new environemnt values like
    Properties props = System.getProperties();
    props.put( javax.naming.Context.INITIAL_CONTEXT_FACTORY , "com.evermind.server.jms.EvermindConnectionFactory");
    props.put( javax.naming.Context.SECURITY_PRINCIPAL , "admin" );
    props.put( javax.naming.Context.SECURITY_CREDENTIALS,"welcome");
    props.put( javax.naming.Context.PROVIDER_URL ,"ormi://localhost:9227/current-workspace-app");
    Context ctx = new InitialContext( props);
    When I try this,it is complaining that it cannot instantiate EvermindConnectionFactory.
    I am not sure which factory class we have to use here.i tried all the Factory class in that package.but didn't worked.
    next I used,
    b)
    tried to use default context in session bean to get MDB factory
    String TOPIC_NAME="jms/theTopic";
    String TOPIC_CONNECTION_FACTORY="jms/theTopicConnectionFactory";
    TopicConnectionFactory connectionFactory = (TopicConnectionFactory)new InitialContext().lookup("java:comp/env/" + TOPIC_CONNECTION_FACTORY);
    this gives
    04/06/13 23:46:09 javax.naming.NameNotFoundException: jms/theTopicConnectionFactory not found in MySession
    04/06/13 23:46:09      at com.oracle.naming.J2EEContext.getSubContext(J2EEContext.java:93)
    this may be because JMS server runs on different port than other EJBs and have different namespaces.
    Can any body give info,how we can make use of Message Driven bean from a Session Bean or from a JSP page or from a simple class inside JDeveloper.
    Thanks in advance.
    gopal

    Hi,
    There are some hints in this forum for how to do this.
    I put together and make it working.
    This example creates an MD Bean and have a simple message and a client class send messages to that bean.
    Steps
    =====
    1)
    a)in {JDev Home}\jdev\system9.0.5.2.1618\oc4j-config\jms.xml
         <topic name="Demo Topic" location="jms/demoTopic">
              <description>A dummy topic</description>
         </topic>
         <topic-connection-factory name="Demo Topic Connection Factory" location="jms/theTopicConnectionFactory">
              <description>A dummy topic connection factory</description>
         </topic-connection-factory>
    b) in current project in orion-ejb-jar.xml
    go to orion-ejb-jar properties and add these values there to MDB node
    destination-location=jms/demoTopic
    connection-factory-location=jms/theTopicConnectionFactory
    2) create a dummy session bean and a dummy client for that session bean
    This sets default configuration for the client application we write
    doing so we do not need to set properties to get Initial context.It makes use of
    {JDev Home}\jdev\system9.0.5.2.1618\oc4j-config\.client\jndi.properties
    We can directly get Contexxt ctx = new InitialContext();
    3) Create MDB and put this sample code in method
    onMessage()
    TextMessage tm = (TextMessage) msg;
    try {
    String text = tm.getText();
    System.err.println("Received new message : " + text);
    catch(JMSException e) {
    e.printStackTrace();
    4) go to properties for the MDB and set Destination to Topic
    5) write Client code
    Context ctx =new InitialContext();
    // 1: Lookup ConnectionFactory via JNDI
    TopicConnectionFactory factory =     
    (TopicConnectionFactory) ctx.lookup("jms/theTopicConnectionFactory");
    // 2: Use ConnectionFactory to create JMS connection
    TopicConnection connection = factory.createTopicConnection();
    // 3: Use Connection to create session
    TopicSession session = connection.createTopicSession( false, Session.AUTO_ACKNOWLEDGE);
    // 4: Lookup Desintation (topic) via JNDI
    Topic topic = (Topic) ctx.lookup("jms/demoTopic");
    // 5: Create a Message Producer
    TopicPublisher publisher = session.createPublisher(topic);
    // 6: Create a text message, and publish it
    TextMessage msg = session.createTextMessage();
    msg.setText("This is a test message from My Test Client!!! .");
    publisher.publish(msg);
    6) Run the server and run the client

  • How to integrate USSD Aggregator with JMS from Brand mobiliser

    Please help me to come out of this problem (How to integrate USSD Aggregator with JMS from Brand mobiliser)

    Dear jeevan,
    Step 1: Login into Brand mobiliser
    Step 2: Under Work space Administration configure JMS channel manager.
    Step 3: Use work space outbound channel as JMS.
    Step 4: write JMS api to process inbound and outbound queues.

  • General Design With Database and Session Bean Question

    I have an application I am developing where users connect to individual databases located on a server. When they login an admin table is accessed which shows what databases they have permissions to. I am then storing the connection to the database in a backing bean. Hoping to use this connection throughout the session. Is this a good practice to have a users connection left open over the session? I can't create a database pool for each individual database and each user for that database.
    If I can store that database connection in a session bean. How do I access that connection from another bean. Or from another java class? I am using Glassfish for my application server with JSF1.2. I have looked at resource injection but have not had any luck with sharing the session bean information.
    Sorry if this is a trivial question. I have been a Java developer for years. But just starting developing webapps using JSF.
    Thanks

    JuCobb2 wrote:
    I am then storing the connection to the database in a backing bean. Hoping to use this connection throughout the session. Is this a good practice to have a users connection left open over the session? No it is not. Why should you do so? Always keep the lifetime of connection, statement and resultset as short as possible.

  • How to call a AM method with parameters from Managed Bean?

    Hi Everyone,
    I have a situation where I need to call AM method (setDefaultSubInv) from Managed bean, under Value change Listner method. Here is what I am doing, I have added AM method on to the page bindings, then in bean calling this
    Class[] paramTypes = { };
    Object[] params = { } ;
    invokeEL("#{bindings.setDefaultSubInv.execute}", paramTypes, params);
    This works and able to call this method if there are no parameters. Say I have to pass a parameter to AM method setDefaultSubInv(String a), i tried calling this from the bean but throws an error
    String aVal = "test";
    Class[] paramTypes = {String.class };
    Object[] params = {aVal } ;
    invokeEL("#{bindings.setDefaultSubInv.execute}", paramTypes, params);
    I am not sure this is the right way to call the method with parameters. Can anyone tell how to call a AM method with parameters from Manage bean
    Thanks,
    San.

    Simply do the following
    1- Make your Method in Client Interface.
    2- Add it to Page Def.
    3- Customize your Script Like the below one to Achieve your goal.
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("GetUserRoles");
    operationBinding.getParamsMap().put("username", "oracle");
    operationBinding.getParamsMap().put("role", "F1211");
    operationBinding.getParamsMap().put("Connection", "JDBC");
    Object result = operationBinding.execute();
    if (!operationBinding.getErrors().isEmpty()) {
    return null;
    return null;
    i hope it help you
    thanks

  • How to call a EJB method from Session bean method

    Hi all,
    I'm new to J2EE programming. I have a simple doubt .
    I have already created a lookup method for EJB bean in Session bean .
    My question is how to call a method of an ENTITY bean (say insertRow) from SESSION bean method(Say invoke_insertRow) .
    Please provide me an example code .
    Thanks in advance.

    InitialContext ctx = new InitialContext();
         GeneralEditor editor = (GeneralEditor) ctx
                        .lookup("GeneralEditorBean/remote");
              GeneralService service = (GeneralService) ctx
                        .lookup("GeneralServiceBean/remote");
              LanMu lm = new LanMu();
              lm.setName("shdfkhsad");
              editor.add(lm);

  • Windows 8.1 Problem with games from windows store.

    I've got a problem with games from windows store. The installation is going well without any problems, however when I try to open it it's loading and then it turns off. The same problem happens when I try to use Games for Windows. I've use a sfc scan and
    it shows some errors but unfortunately it cannot fix them. Should I share the CBS log or find the solution somewhere else? I hope you help, best regards.

    Hi,
    According to my experience, the problem like store game app open failed probably caused by hardware driver. such as Audio and Graphic driver. So, first of all, please try to reinstall these two driver to fix this problem for test.
    In addition, for SFC scan failed problem, it can be caused by many reasons, I would suggest you use another command to fix your system for test.
    Dism /Online /Cleanup-Image /ScanHealth
    Also you can test SFC command in Windows 8.1 safe mode.
    Thirdly, if problem persists, please check Event Viewer, generally speaking, it would record the app open failed events.
    Roger Lu
    TechNet Community Support

  • I have problem with buying from iTunes Store

    I have problem with buying from iTunes ??!!
    I've put all of my info cards
    What can i do ?!

    Are you trying to spam the forum with 6 the same posts?
    Please give more details of your problem and answer the question below:
    Is the app available in your country?
    Are you using the App Store for your country?

  • Problem with mapping the Entity beans onto database tables

    Hi,
    I got a problem with mapping the Entity beans onto database tables. Here are what I did:
    First Step:
    asant capture-schema
    Second Step:
    capture-schema -driver com.pointbase.jdbc.jdbcUniversalDriver -dburl jdbc:pointbase:server://localhost/sun-appserv-samples -username pbPublic -password pbpublic -table APPLICANT -table APPLICANTSKILL -table CUSTOMER -table LOCATION -table job -table JOBSKILL -table SKILL -out build/agency.dbschema
    The first step was fine. But, in the second step, I got the error message as follow:
    using dburl:jdbc:pointbase:server://localhost/sun-appserv-samples
    using username:pbPublic
    using password:pbpublic
    using driver:com.pointbase.jdbc.jdbcUniversalDriver
    using schemaname:null
    using output file:build/agency.dbschema
    JDO71100: Failed to find a class. Verify that the class is available on your CLASSPATH
    java.lang.ClassNotFoundException: com.pointbase.jdbc.jdbcUniversalDriver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:141)
    at com.sun.forte4j.modules.dbmodel.jdbcimpl.ConnectionProvider.<init>(Co
    nnectionProvider.java:38)
    at com.sun.jdo.api.persistence.mapping.ejb.CaptureSchema.main(CaptureSch
    ema.java:130)
    at com.sun.jdo.spi.persistence.support.ejb.util.CaptureSchemaWrapper.mai
    n(CaptureSchemaWrapper.java:29)
    Thanks for your help!

    You need to add the pbclient.jar or some similar name like that, in the CalssPath.

  • Hi. I have a problem with downloading from app store while last three days. An error did mot allow me to that. It's number is 1009.

    I have a problem with downloading from app store while last three days. An error does not allow me to take any app. The error number is 1009.

    Thats the ugliest code I've seen in a while and may be hampering your abilities to debug it. No offense - you have to start somewhere - think of it as somewhat constructive criticism.
    However, I cannot find any place where this is happening. Its happening on line 193.
    Also, this only happens when you try to move certain pieces to certain squaresThat might be a clue. Try printing out the indexes before line 193 and see what happens. Maybe use a debugger to step through your code.

  • Can I connect with Database using Session Bean

    Hi,
    I am new to EJB. I have small doubt.
    can I connect with Database using Session Bean.
    Regards,
    Murali.

    Double post of http://forum.java.sun.com/thread.jspa?threadID=687239&tstart=0

  • I have a Iphone 4S and i update a new version 6.1, and i have a problem with wifi from i update this version. What is this problem? thanks Andres

    I have a Iphone 4S and i update a new version 6.1, and i have a problem with wifi from i update this version. What is this problem? thanks Andres

    Move or Copy the ENTIRE iTunes folder from the old computer or the backup of the old computer to the new computer.

Maybe you are looking for

  • How can I find my stolen MacBook pro

    There is another form to track a MacBook Pro besides find my iPhone

  • If I stay on iPhoto too long, my screen goes black.

    Hi all, Recently, I was editing a photo in iPhoto when suddenly the screen went black.  The computer hadn't switched off because the backlight keyboard was still lit.  After many restarts, I finally realised that if I were to open iPhoto and leave th

  • DR430KU parts

    Hi! Where can I find parts for a DR430KU DVD Video Recording unit, I'm having problems with the optical pickup unit and I need to know where can I buy parts or get service for the machine.

  • How do I know both processors are running?

    From the topic heading....it sounds pretty simple. I generally use the Activity Monitor that displays a floating CPU window. Usually, it has two bars showing the load on both processors. I recently have issues with the 'G5 deep sleep'...and after the

  • Avoiding battery overheating when using MBP in the sun

    Are there any ways to keep a MBP battery cool when using it outside in the sun? Or should I just not worry about it? Today I was sat on my balcony enjoying the Mediterranean sun using my 2014 MBP when Coconut Battery popped up with a notification war