Accessing Session  From MDB

Is it possible to access a session object from a MDB?

Yes....it should be possible. There shouldn't be any reason why your MDB couldn't instantiate an InitialContext and perform the appropriate lookup. Granted, all of this will have to happen in the MDB's onMessage() method.
Regards,
J.

Similar Messages

  • Accessing AQ from MDB in JBoss

    Hi All,
    I am trying to read the messages from AQ. I am able to read the messages through a JMS client but not able to get any breakthrough with MDB...kindly help.
    I wrote a simple MDB....
    package com.ameripath.billinginterface.mdb;
    import java.util.Enumeration;
    import java.util.Hashtable;
    import javax.jms.Message;
    import javax.jms.MessageListener;
    import javax.jms.TextMessage;
    import javax.ejb.ActivationConfigProperty;
    import javax.ejb.MessageDriven;
    @MessageDriven(activationConfig =
              @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Topic"),
              @ActivationConfigProperty(propertyName="destination", propertyValue="topic/OAQRequestTopic")
    public class AQMDB implements MessageListener {
         public void onMessage(Message message) {
              String reqMsg = null;
    System.out.println("!!!!!!!!!!!!!1Inside onMessage~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
    updated Jboss-service.xml with...
    <mbean code="jmx.service.oracle.aq.OAQDestination"
    name="jmx.service.oracle.aq:service=OAQRequestTopic">
    <attribute name="JndiName">topic/OAQRequestTopic</attribute>
    <attribute name="JMSStyle">topic</attribute>
    <attribute name="IsXA">false</attribute>
    <attribute name="URL">jdbc:oracle:thin:@192.168.200.73:1521:INTORCL</attribute>
    <attribute name="Username">oas_intgrtn</attribute>
    <attribute name="Password">oas_intgrtn</attribute>
    <attribute name="PayloadFactory"></attribute>
    <attribute name="Schema">oas_intgrtn</attribute>
    <attribute name="Destination">MULTI_QUEUE</attribute>
    <depends>jboss:service=Naming</depends>
    </mbean>
    updated jms-ds.xml with....
    <!-- The OAQ JMS provider loader -->
    <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
    name="jboss.mq:service=JMSProviderLoader,name=OAQJMSProvider">
    <attribute name="ProviderName">OAQJMSProvider</attribute>
    <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
    <!-- <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JBossMQProvider</attribute> -->
    <attribute name="QueueFactoryRef">OAQQueueConnectionFactory</attribute>
    <attribute name="TopicFactoryRef">OAQTopicConnectionFactory</attribute>
    </mbean>
    also updated standardjboss.xml with ...
    <invoker-proxy-binding>
    <name>oaq-message-driven-bean</name>
    <invoker-mbean>default</invoker-mbean>
    <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
    <proxy-factory-config>
    <JMSProviderAdapterJNDI>OAQJMSProvider</JMSProviderAdapterJNDI>
    <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
    <MaximumSize>5</MaximumSize>
    <MaxMessages>5</MaxMessages>
    <MDBConfig>
    <ReconnectIntervalSec>10</ReconnectIntervalSec>
    <DLQConfig>
    <DestinationQueue>queue/DLQ</DestinationQueue>
    <MaxTimesRedelivered>10</MaxTimesRedelivered>
    <TimeToLive>0</TimeToLive>
    </DLQConfig>
    </MDBConfig>
    </proxy-factory-config>
    </invoker-proxy-binding>
    <!-- for AQ -->
    <container-configuration>
    <container-name>OAQ Message Driven Bean</container-name>
    <call-logging>false</call-logging>
    <invoker-proxy-binding-name>oaq-message-driven-bean</invoker-proxy-binding-name>
    <container-interceptors>
    <interceptor>org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor</interceptor>
    <interceptor>org.jboss.ejb.plugins.LogInterceptor</interceptor>
    <interceptor>org.jboss.ejb.plugins.RunAsSecurityInterceptor</interceptor>
    <!-- CMT -->
    <interceptor transaction="Container">org.jboss.ejb.plugins.TxInterceptorCMT</interceptor>
    <interceptor transaction="Container" metricsEnabled="true">org.jboss.ejb.plugins.MetricsInterceptor</interceptor>
    <interceptor transaction="Container">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
    <!-- BMT -->
    <interceptor transaction="Bean">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
    <interceptor transaction="Bean">org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT</interceptor>
    <interceptor transaction="Bean" metricsEnabled="true">org.jboss.ejb.plugins.MetricsInterceptor</interceptor>
    <interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor</interceptor>
    </container-interceptors>
    <instance-pool>org.jboss.ejb.plugins.MessageDrivenInstancePool</instance-pool>
    <instance-cache></instance-cache>
    <persistence-manager></persistence-manager>
    <container-pool-conf>
    <MaximumSize>100</MaximumSize>
    </container-pool-conf>
    </container-configuration>
    <!-- for AQ -->
    I am getting this error on deployment of this MDB....
    18:35:07,236 INFO [Ejb3AnnotationHandler] found EJB3: ejbName=AQMDB, class=com.
    ameripath.billinginterface.mdb.AQMDB, type=MESSAGE_DRIVEN
    18:35:07,548 INFO [Ejb3Deployment] EJB3 deployment time took: 500
    18:35:07,627 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:service=E
    JB3,jar=bi_pocapp.ejb3,name=AQMDB with dependencies:
    18:35:08,189 WARN [ServiceController] Problem starting service jboss.j2ee:servi
    ce=EJB3,jar=bi_pocapp.ejb3,name=AQMDB
    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    Kindly suggest a fix
    thanks in anticipation

    Hi,
    I´m facing exactly the same problem and weren´t able to solve it. Anyone was able to acomplish this?
    Regards,
    Vinicius

  • Accessing MSAccess DB mdb from java program deployed on Unix

    Could someone provide the solution for connecting MSAccess DB which is on a Windows Server
    from a java web application deployed on weblogic in Unix platform.
    Basically i would like to know how we can get access to the mdb file on windows.
    jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=c:/employee.mdb;DriverID=22;READONLY=true"
    Im using sun.jdbc.odbc.JdbcOdbcDriver.

    spectator wrote:
    Thanks for the reply ..
    This url given works perfectly for a java appln in windows as the .mdb path (c:/employee.mdb or from a shared drive \\shared\employee.mdb) is understood by the appln
    But my java application in Unix wants to call AccessDB in Windows.
    I wanted know how we can connect from java appln in Unix to an Access DB which is in Windows like any other database ie through a hostname port etc. or any other wayBasically you can't.
    You can start by reading the following.
    [http://forums.sun.com/thread.jspa?threadID=211735&start=2&forumID=48]
    There is an update to that post in that now there is a java only commercial (you must pay for it) driver that one can use for MS Access. So that option exists now.

  • Looking for resource: accessing session info from JPS portlets

    Hi! The Portal Developer's Guide 10g Release 10.1.4, section 7.2.5 shows how to access session information from PDK portlets. I'm looking for information (tutorials, books) on how to do this from JPS portlets in the Oracle Portal environment.
    Thx!

    If u are using JSPProvider, then for getting the Session variable, peruse the below points:
    JSPProvider p=(JSPProvider)pageContext.getAttribute("JSPProvider");
    Session ses=p.getSession();

  • Trying to call stateless session bean from MDB

    Folks,
    Am working on RAD and WAS 8.
    I have an MDB. And a stateless session bean (AOBean under EJB project).
    While the listener listens to the messages from queue, it also tries to persist to db. I want to achieve this via a method of AOBean (through instantiating session bean or by injection).
    I have been sucessful by invoking a method from AOBean class -  that method just returns a string (without any objects being passed)
    Problem:
    I am getting IllegalStateException when I try to invoke a method of AOBean class, that has an object as a parameter
    For eg:
    MDB
    @EJB(name="ejb/TransactionMgrAOBean", mappedName="ejb/TransactionMgrAOBean")
    ITransactionMgrAO tranAO;
        public void onMessage(Message message) {
         TextMessage textMessage = (TextMessage) message;
         boolean status = false;
      try {
       TransactionVO tranVO =  getTransactionVO();//Here building the object to be passed to session bean
       String status1  = tranAO.getVersion(tranVO);
      }catch(Exception e){
    AOBean
    @Stateless
    @Remote({ ITransactionMgrAO.class })
    @WebService
    public class TransactionMgrAOBean {
    public String getVersion(TransactionVO tranVO) throws Exception{
      try{
    //business logic 
      } catch(Exception e){
      throw e;
      return true;
    TransactionVO implements Serializable has also inner static classes that are not Serializable.
    EXCEPTION: At runtime we are getting exception saying that the inner classes are not serialized.
    REASON why we are invoking session bean from MDB? We found that if we invoke any service from AOBean the transaction management was successful. We are using sessionContext.setRollBackonly when an exception occurs. Tranasactions are not rolled back when any db exception occurs if we invoke business logic methods from Model layer of another NON-EJB package.
    Hope I have provided enough information!

    My concret problem is that I want to call an ejb session contained in an ejb project from a session bean in a different web project. When I include the code in my web session bean I get the error adjunted:
    - Code:
    @EJB
    private UserRemote userSessionBean;
    - Error:
    Exception Details: javax.naming.NameNotFoundException
    pac.UserRemote#pac.UserRemote not found
    Possible Source of Error:
    Class Name: com.sun.enterprise.naming.TransientContext
    File Name: TransientContext.java
    Method Name: doLookup
    Line Number: 216
    Any suggestion?

  • Access denied error while running opening remote power-shell session from one azure machine to another

    We are trying to open a remote power-shell session from one azure machine to another azure machine and that is failing with the following error. Any ideas?
    Observations: -
    If the worker role is running under network service or local system, then it fails.
    We emulated the same behavior from a stand-alone exe and that also failed when the exe was run under network service or local system.
    If we run the same stand-alone exe from a user account, then it works.
    Unhandled Exception: System.Management.Automation.Remoting.PSRemotingTransportException: Connecting to remote server sampleapprm.cloudapp.net failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting
    Help topic.
       at System.Management.Automation.Runspaces.AsyncResult.EndInvoke()
       at System.Management.Automation.Runspaces.Internal.RunspacePoolInternal.EndOp
    en(IAsyncResult asyncResult)
       at System.Management.Automation.Runspaces.Internal.RemoteRunspacePoolInternal
    .Open()
       at System.Management.Automation.RemoteRunspace.Open()
       at ConsoleApplication2.Program.Main(String[] args)

    Hi,
    This error only show access is denied, and it is hard for me to deal with this issue, may be Windows Powershell forum or Windows Azure VM are good forums for you, could you give more details information to us for a better help if this issue
    was related with windows Azure.
    Best Regards
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • (oracle 10.2) Access to v$session from pl/sql code

    Hello,
    I wonder if anybody can help me with the following problem as I have read some previous posts on similar topics but could not come to a solution so far.
    The problem is simple: I need to select some columns form v$session from within a PL/SQL body in oracle 10.2.
    Now, the "Application Developer's Guide - Fundamentals" reads:
    "The owner of the procedure or package must be explicitly granted
    the necessary object privileges for all objects referenced within the
    body of the code."
    However, if I connect sys as sysdba and run "grant select on v$session to <proc owner>" I will get "ORA-02030: can only select from fixed tables/views".
    Any hint about this?
    Thank you in advance.

    There is nothing wrong with your instance, v$session is a public synonym for the "real" view v_$session. You cannot grant on a synonym, only on the underlying real object.
    HTH
    John

  • How do I access session data through an EJB?

    Hi
    How do I access session data through an EJB?
    I am currantly developing a Web service (using ejb's, JBoss.net and Apache Axis). A client making a call to this Web service, is expecting a bussiness-object in return. My problem is that this bussiness-object i stored in a users session data. How do I retrieve this bussiness-object from the users session.
    I have read that this does not work with httpsessions, is this true? If this is true, is it possible to store the bussiness object in a JavaBean e.g:
    <jsp:useBean id="userContextWebImpl" scope="session" class="com.ac.march.client.UserContextWebImpl">
    <%
    String key = "test";
    String value = "This is the value";
    userContextWebImpl.setValue( key, value1 );
    %>
    </jsp:useBean>
    and then retrieve this information through the EJB? Or is it possible to do this by using Statfull JavaBeans? Or can this be done through a nother solution?
    Please help!

    I have created a JavaBean with scope="application" to store some data. The data is stored when a user prefomes a spesific task.
    A different person then makes a call to a Web-Service on the server. The Web-Service then asks an EJB to retrieve the data stored in the JavaBean (servlet cotext). In other words: How do I retrieve this data from the EJB?
    I have tried with this code, but with no luck.
    (ApplicationContextWebImpl is the JavaBean)
    public static String getBookingResult( String key )
         String myResult = null;
         String myKey = key;
         ApplicationContextWebImpl applicationContextWebImpl = null;
         try
              applicationContextWebImpl = new ApplicationContextWebImpl();
              myResult = (String)applicationContextWebImpl.getValue( key );
         catch ( java.rmi.RemoteException e )
         return myResult;
    }

  • Trying to access Lion server remote using multi-user access, but from a legacy Leopard system

    Just purchased a mini server running Lion, and got screen sharing working fine from my legacy system (32-bit so Leopard only). However, I would like to run in multi-user mode, so someone can use the Lion system and another person can access their own account, from the older Leopard system, at the same time. Using multi-user rather than screen sharing. But Leopard does not have the option on the Finder/Share Screen command, the pop-up window to select screen sharing or new virtual session. So, is there a way still to run a new virtual session from a remote client running Leopard?  Since the multi-user capability resides on the Lion server, it should be possible, but how, without the pop-up menu?
    Message was edited by: Kurt-Syracuse

    Hey. I suggest you check out http://discussions.apple.com/message.jspa?messageID=9839785#9839785, where there are a couple solutions posted in regard to the error code -36 when connecting to a samba share. Good luck!
    Jeremy A.
    Tekserve Intern

  • Use transacted session in MDB

              Hi,
              If I use transacted session in MDB with container managed transaction, dose the
              weblogic ignore the transacted setting or start in it's own transaction. I looked
              the JMS Tutorial from Sun, the J2EE server just ignore the transacted setting,
              treated it as non-transacted session.
              Thanks
              

              Thanks, Greg. I created another XAQCF in MQ JMSADMIN, but still did not help. The
              strange part is when this exception happens, in the Event Viewer there is a Message:
              An internal Websphere MQ Error has occurred'. In the Trace Log of MQ, the Major
              Error Code reported is arcE_XAER_PROTO.
              Has anyone encountered this error? The same code works fine when enlist an XAQCF
              defined in Weblogic and PUT into a Weblogic JMS Queue instead within the same
              XA Transaction. I am attaching the stack trace to this message, just in case,
              someone has useful pointers to help me. May be this is MQ Specific though I made
              sure I have the latest FixPack for MQ installed.
              Thanks,
              Sridhar
              "Greg Brail" <[email protected]> wrote:
              >Yeah. This comes up from time to time. MQ is upset because it wants to
              >be
              >enlisted in the JTA transaction, but JTA is not enlisting it because
              >it
              >thinks it's already enlisted. It thinks it's already enlisted because
              >the
              >same MQ connection factory was used for the MDB input queue, even though
              >it's a different JMS connection and session.
              >
              >You can avoid this by creating another "XAQCF" object in the MQ JNDI
              >space
              >and giving it a different name. If you do that -- essentially use different
              >connection factories for the MDB's input and output queues -- then this
              >will
              >work.
              >
              >Also, the transaction enlistement code in 8.1 that supports the
              >"resource-ref" feature avoids this problem.
              >
              > greg
              >
              >"Sridhar Krishnaswamy" <[email protected]> wrote in message
              >news:[email protected]...
              >>
              >> Hi Greg:
              >> I assume you meant to getXAResource() from an Object of type
              >XAQueueSession. Here
              >> is the code I tried within the onMessage() method of the MDB:
              >>
              >> XAQueueConnectionFactory factory = (XAQueueConnectionFactory)
              >ctx.lookup("XAQCF")
              >> ;
              >> XAConnection connection = factory.createXAQueueConnection() ;
              >>
              >> XAQueueSession mqSession = connection.createXAQueueSession() ;
              >> XAResource mqResource = mqSession.getXAResource() ;
              >> Transaction tran = TxHelper.getTransaction() ;
              >> tran.enlist(mqResource) ;
              >>
              >> //Then I was going to get the QueueSession Object from XAQueueSession,
              >obtain
              >> the Queue
              >> //Object from JNDI, create the Sender
              >> //and call the send. But I commented out these calls. Even then, after
              >the
              >onMessage
              >> Method
              >> // completes, I get the following error:
              >>
              >> javax.transaction.SystemException: start() failed on resource
              >'com.ibm.mq.MQXAResource':
              >> XAER_PROT : Routine was invoked in an improper context
              >> javax.transaction.xa.XAException: XA Operation failed. see errorcode
              >(which I
              >> am assuming is XAER_PROT).
              >>
              >> Any idea, what I am doing wrong?
              >>
              >>
              >>
              >>
              >> "Greg Brail" <[email protected]> wrote:
              >> >In 7.0, you can do your MQ "put" inside the same JTA transaction that
              >> >was
              >> >used to receive the message for the MDB, but you have to do the
              >transaction
              >> >enlistment yourself. Basically, you have to use the class
              >> >weblogic.transaction.TxHelper class to get a reference to the current
              >> >transaction, then call "enlistResource" on the transaction using the
              >> >JTA
              >> >"XAResource" that you get from the MQ JMS "Session" object. I'm sure
              >> >we've
              >> >posted the code in this newsgroup before, but I don't know where,
              >so
              >> >it
              >> >would look something like:
              >> >
              >> >// First, get the MQ QueueSession object you're going to use to send
              >> >the
              >> >message
              >> >QueueSession mqSession = mqConnection.createQueueSession(false, 0);
              >> >XAResource mqResource = mqSession.getXAResource();
              >> >weblogic.transaction.Transaction tran =
              >> >weblogic.transaction.TxHelper.getTransaction();
              >> >tran.enlistResource(mqResource);
              >> >// Now send your message
              >> >
              >> >In 8.1, this will still work, but it's not necessary. If you register
              >> >the MQ
              >> >XA connection factory as a "resource-reference" in your EJB deployment
              >> >descriptors and look it up using java:comp/env the way the documentation
              >> >link way below describes, then this transaction enlistment happens
              >> >automatically. This only happens when you use the "resource-reference"
              >> >feature (which means that old code will still work if it does NOT
              >use
              >> >this
              >> >feature), and it's only in 8.1.
              >> >
              >> > greg
              >> >
              >> >"Sridhar Krishnaswamy" <[email protected]> wrote in
              >message
              >> >news:[email protected]...
              >> >>
              >> >> Hi Greg:
              >> >> Is the Statement
              >> >>
              >> >> 'But in this case, you don't get a "non-transactional" session,
              >but
              >> >actually a
              >> >> session that participates in the current JTA transaction for the
              >thread
              >> >where
              >> >> your EJB is running'
              >> >>
              >> >> also true in the case of an MDB running in Weblogic 7.0 (Container
              >> >Managed
              >> >Transactions)
              >> >> driven by an XAQCF and a Foreign JMS Provider such as MQSeries?
              >In
              >> >other
              >> >words,
              >> >> if I want the MDB to PUT the Message into an MQSeries Queue, can
              >the
              >> >PUT
              >> >be invoked
              >> >> under the Context of the Same XA Transaction? My understanding is
              >that
              >> >WebLogic
              >> >> 7.0 doesn't support send
              >> >> messages out of an MDB within the same XA transaction if the MDB
              >is
              >> >> XA-driven by a foreign JMS provider. Please let me know if this
              >is
              >> >false.
              >> >If true,
              >> >> does Weblogic 8.1 also have this restriction?
              >> >>
              >> >> Thanks,
              >> >> Sridhar Krishnaswamy.
              >> >>
              >> >> "Greg Brail" <[email protected]> wrote:
              >> >> >What do you mean by "use transacted session in MDB?" Are you creating
              >> >> >a new
              >> >> >session inside your MDB, or do you mean something else?
              >> >> >
              >> >> >The only Sun thing I can think of is in code that looks like this:
              >> >> >
              >> >> >InitialContext ctx = new InitialContext();
              >> >> >QueueConnectionFactory qcf = ctx.lookup("java:comp/env/jms/QCF");
              >> >> >Queue queue = ctx.lookup("java:comp/env/jms/Queue");
              >> >> >QueueConnection connection = qcf.createQueueConnection();
              >> >> >// Create "transacted" session:
              >> >> >QueueSession session = connection.createQueueSession(true, 0);
              >> >> >QueueSender sender = session.createQueueSender(queue);
              >> >> >TextMessage message = session.createTextMessage("Hello, world");
              >> >> >sender.send(message);
              >> >> >connection.close();
              >> >> >
              >> >> >If you do this, and exactly this, inside an EJB, including the
              >use
              >> >of
              >> >> >"java:comp/env/jms", in WebLogic Server 8.1, then we do indeed
              >ignore
              >> >> >the
              >> >> >"transacted" flag when you create the session, just like Sun says
              >> >we
              >> >> >should
              >> >> >in the EJB and J2EE specs. But in this case, you don't get a
              >> >> >"non-transactional" session, but actually a session that participates
              >> >> >in the
              >> >> >current JTA transaction for the thread where your EJB is running.
              >> >> >
              >> >> >The idea is that if you are working inside an EJB, you don't use
              >> >transacted
              >> >> >sessions -- you use the transaction control given to you by the
              >EJB
              >> >> >container, including the UserTransaction interface and/or the various
              >> >> >container-managed transaction flags, rather than the JMS "transacted
              >> >> >session".
              >> >> >
              >> >> >You can find more information here:
              >> >> >
              >> >> >http://e-docs.bea.com/wls/docs81/jms/j2ee_components.html
              >> >> >
              >> >> > greg
              >> >> >
              >> >> >"Jen" <[email protected]> wrote in message
              >> >> >news:[email protected]...
              >> >> >>
              >> >> >> Hi,
              >> >> >>
              >> >> >> If I use transacted session in MDB with container managed
              >transaction,
              >> >> >dose the
              >> >> >> weblogic ignore the transacted setting or start in it's own
              >> >transaction.
              >> >> >I
              >> >> >looked
              >> >> >> the JMS Tutorial from Sun, the J2EE server just ignore the
              >transacted
              >> >> >setting,
              >> >> >> treated it as non-transacted session.
              >> >> >> Thanks
              >> >> >
              >> >> >
              >> >>
              >> >
              >> >
              >>
              >
              >
              [eRRORS.txt]
              

  • Access EJB from Servlet that in different archive?

    <font class="mediumtxt">package kyro.ejb.session;
    import javax.ejb.*;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    @Stateless(name="StandAlone")
    @Remote(StandAlone.class)
    public class StandAloneBean
    implements StandAlone, StandAloneLocal
    public StandAloneBean() {
    public String sayHello() {     
    return "sayHello";
    I want to access ejb from servlet that .war and .jar not in single .ear. I want to try that just with annotation not xml descriptor cause is easy to understand for me. I use Glassfish. But i can't lookup that ejb. How can i lookup that ejb with jndi? Can't you give me example of servlet to access that? I not use JNDI.properties, are that caused i can't access my ejb? I just thing .war and.jar in one server, are i have to used JNDI.properties. can you explain how to use JNDI.properties in servlet or separate file?
    </font>

    But i can't lookup that ejb. How are you trying and what exception is occurring?
    How can i lookup that ejb with jndi? [https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html|https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html]
    m

  • Jintegra problem - accessing Matlab from Java??

    Hi:
    Sorry if this post doesn't belong here!!
    I am accessing Matlab from JAVA using JIntegra for COM. I tried running the example in their website.
    (http://j-integra.intrinsyc.com/support/com/doc/other_examples/Matlab.htm)
    I have also posted the example below. I am using their trial version and have included all the jars as said. I get the an unexpected output (all zero's) for reading a variable in the matlab workspace. I don't understand why I get this. Can anyone let me know if this runs for you??
    Thanks
    Pavan
    Example code from Jintegra website:
    public class MatlabExample {
    public static void main(java.lang.String[] args) throws Exception {
    try {
    // DCOM authentication: Make sure NT Domain, NT User, NT Password are valid credentials.
    // Uncomment this line if MatlabExample.java remotely accesses MATLAB :
    // com.linar.jintegra.AuthInfo.setDefault("NT DOMAIN", "NT USER", "NT PASSWORD");
    // Create the MATLAB object
    // Specify host name or IP address of MATLAB machine as parameter if
    // MatlabExample.java remotely accesses MATLAB.
    // mlapp.MLApp mlApp = new mlapp.MLApp("123.456.789.0");
    mlapp.MLApp mlApp = new mlapp.MLApp();
    String result = mlApp.execute("a = [1 2 3 4; 5 6 7 8;]");
    System.out.println("Execute result is " + result);
    double mreal[][] = new double[2][4];
    double mimage[] = new double[0];
    mlApp.getFullMatrix("a", "base", new Object[]{mreal}, new Object[]{mimage});
    for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 4; j++) {
    System.out.println(mreal[i][j]);
    } finally {
    com.linar.jintegra.Cleaner.releaseAll();
    }

    ......How are you declaring the class in your JSP? ... are you instantiating it as a bean using the useBean tag, or just instantiating it in your code like normal.
    Maybe you could post the relevant JSP code too?
    Hello again,
    Only the last string is populating after the file has be tokenized. What I'll like to accomplish is passing the very first string in the file. I did not get too far in the JSP file setup because the code is still in it's testing stage, but any help will be highly appreciated.
    Here is the JSP code
    <%@page import="dev.*" %>
    <%@page session="true" language="java" import="java.io.*" %>
    <jsp:useBean id="wagerhist" scope="request" class="dev.RoundDetail2" />
    <html>
    <head>
    <title>Round Detail</title>
    <body>
      <table width="530" bordercolor="#000000" valign="top">
        <tr>
              <td align="left"  width="19%">Game ID<%=wagerhist.string_gameID%></td>
              <td align="left"  width="30%">  </td>
              <td align="left"  width="20%">card1</td>
              <td align="left"  width="31%">  </td>
            </tr>
      </table>
    </body>
    </html>

  • Restoring session from sessionstore.bak file

    I'm trying to recover a session lost after a system crash,I have a '''sessionstore.bak''' file from the time of this crash (about 1.8Mb),and a '''sessionstore-1.js''' file which I assume is a leftover from some time ago and not relevant for this issue:copying this '''.bak''' file in the profile folder and renaming it to '''.js''' has not restored my session, indeed only one of the 10 windows I had open at that time is now restored-Firefox is set to show windows and tabs from the last time,so why this is not working?
    After that crash,not only my profile was missing but the cache folders as well,it all got moved in a C:something directory,maybe I should recover the cache folder also to restore the session?
    Is there any other reason why a sessionstore.bak file could not be used to successfully reopen the last session?

    Thanks for your answer cor-el,I've just successfully restored this 100-ish tabs session from that '''sessionstore.bak''' file,what I've done is
    * copy '''sessionstore.bak''' in the profile folder,rename it to '''.js'''
    * replace the cache folders moved in the "recovered files" directory back in their original location
    * replace a couple of missing '''userchrome.css''' files with some others from a previous backup
    * delete that '''sessionstore-1.js''' as you suggested
    Honestly now I have no clue about the deciding factor,but the pre-crash session is back exactly as it was,I wonder if the cache files are also essential to reopen such a large session (I also have BarTab installed,maybe this extension needs the cache files to work properly?)
    Now about that sessionstore-##.js files you were pointing at,I assume the external programs accessing Firefox would be some security software,or do I have to search now for some out of control application ?

  • [JDBC][ODBC] How to compact access database from Java ?

    Hello,
    I'm developping a java applcation wich is connected to an MS Access file database.
    For now, I don'y compact it but it would be better.
    So How can I compact an access database from Java ?
    thanks :)

    Hi ypiel,
    Try this:
    1) Download JETCOMP.exe (freeware from Microsoft);
    2) Put the following code in your app (assuming your database file name is: "DB.mdb"):
    try {
    File current = new File("DB.mdb");
    File backup = new File("BACKUP.mdb");
    if (current.renameTo(backup)) {
    Runtime.getRuntime().exec("jetcomp -src:BACKUP.mdb -dest:DB.mdb");
    } catch (Exception e) {
    System.out.println(e.getMessage());
    Best regards,
    YT.

  • Should we try to access session scope in ADF BC ?

    hi
    In the blog post "How to Access Session Scope in ADF BC "
    at http://andrejusb.blogspot.com/2012/01/how-to-access-session-scope-in-adf-bc.html
    Andrejus Baranovskis suggests it is no problem to access session scope in ADF BC using
    Map sessionScope = ADFContext.getCurrent().getSessionScope();But I wonder if this is really a good practice, as it looks very much like breaking the MVC pattern.
    At the same time I wonder where the Oracle documentation says this would be a good or bad idea.
    One starting point could be the ADFContext.getCurrent() method
    at http://docs.oracle.com/cd/E24382_01/apirefs.1112/e17486/oracle/adf/share/ADFContext.html#getCurrent%28%29
    that starts with saying "Gets the ADF context for the current thread. ..." which in a typical deployment scenario of ADF BC might not cause a problem.
    But, I wonder how defensive your programming should be when using the getSessionScope() method in your ADF Business Component code (that implements the Model).
    Ideas and feedback welcome.
    many thanks
    Jan Vervecken

    Hi Shay,
    Reviewing ADFContex methods it seems that this object shouldn't be accessible from BC. Example:
    public static ADFContext initADFContext(java.lang.Object context,
                                            java.lang.Object session,
                                            java.lang.Object request,
                                            java.lang.Object response)
        Initializes the ADFContext for the environment of the specified context.
        Parameters:
            context - the ServletContext or PortletContext of the current execution environment.
            session - the HttpSession or PortletSession of the current execution environment. OPTIONAL.
            request - the HttpServletRequest or PortletRequest of the current execution environment. OPTIONAL.
            response - the HttpServletResponse or PortletResponse of the current execution environment. OPTIONAL.
        Returns:
            the ADFContext that was current when init was invoked. Should be passed back to resetADFContext after the block requiring the ADFContext has completed.Kuba

Maybe you are looking for