System.out.println in EJB

Hi I have given System.out.println in my EJB object. But I am not able to see the output in my console. But when I give printStackTrace in my JSP(from where I can EJB)....it is displaying the exception....
So my question is Can we give System.out... in EJB?. Should we set any property to see the output of System.out...in the console?.

Here is my code
From UserManager I call the EJB
public boolean validateSignOn(String strUserName,String strPassword) throws ProdSchedException{
try{
UserMgrHome home = (UserMgrHome)getEJBHome("UserMgr",UserMgrHome.class);
UserMgr userMgr = home.create();
return userMgr.validateSignOn(strUserName,strPassword);
catch(RemoteException rex){
ServerLog.log(rex.getMessage(),ServerLog.ERROR);
throw new ProdSchedException(rex,"Server Failed");
catch(CreateException cex){
ServerLog.log(cex.getMessage(),ServerLog.ERROR);
throw new ProdSchedException(cex,"Create Exception");
This is my EJB code
import javax.ejb.*;
import java.rmi.RemoteException;
import java.util.*;
import javax.xml.parsers.*;
import org.xml.sax.*;
import org.w3c.dom.*;
import java.io.*;
* User Manager Session Bean
public class UserMgrEJB implements SessionBean {
SessionContext cntx;
public boolean validateSignOn(String strUserName,String strPassword) throws ProdSchedException{     
UserDAO dao = new UserDAO();
     System.out.println("Inside EJB");
boolean bValidUser = dao.validateUser(strUserName,strPassword);
if(!bValidUser){
throw new ProdSchedException("Invalid User");
return bValidUser;
//Bean methods
public void ejbCreate(){
     System.out.println("Inside EJB Create");
public void ejbRemove(){
public void ejbActivate(){
     System.out.println("Inside EJB Activate");
public void ejbPassivate(){
public void setSessionContext(SessionContext cntx){
this.cntx = cntx;
This is mu UserDAO code
public class UserDAO extends DAO{
public boolean validateUser(String userName,String password) throws ProdSchedException{
Connection conn = null;
PreparedStatement stmt = null;
ResultSet result = null;
     System.out.println("Inside validateUser in DAO");
try{
          boolean bIsValidUser = true;
     String selectStatement = "SELECT SYSDATE from DUAL";
     conn = getConnection();
stmt = conn.prepareStatement(selectStatement);
result = stmt.executeQuery();
while(result.next()){
bIsValidUser = true;
return bIsValidUser;
catch(SQLException sqex){
ServerLog.log(sqex.getMessage(),ServerLog.ERROR);
throw new ProdSchedException(sqex,sqex.getMessage());
     finally{
try{
close(conn,stmt,result);
catch(ProdSchedException slex){
               ServerLog.log(slex.getMessage(),ServerLog.ERROR);
throw slex;
} // end class
And the error I get in the console is this(since I have given printStackTrace in my JSP)
ProdSchedException: SQL Error
at UserDAO.validateUser(UserDAO.java:
44)
at UserMgrEJB.validateSignOn(
UserMgrEJB.java:26)
at UserMgrEJB_p3hctp_EOImpl.v
alidateSignOn(UserMgrEJB_p3hctp_EOImpl.java:46)
at UserManager.validateSignOn(User
Manager.java:20)
at jsp_servlet._public.__login._jspService(__login.java:123)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:1094)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:437)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:319)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:5626)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServic
eManager.java:685)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3213)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2555)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:251)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:219)

Similar Messages

  • System.out.println and EJBs

    Hi,
    I'm trying to develop an application that has 2 main components:
    1) A stateless session EJB, which is called by the container timer service periodically and makes some DB uptades.
    2) A servlet which basically calls the create method in the EJB.
    I've implemented a prototype of the app and the servlet code looks like this:
    try {
    Context context = new InitialContext();
    MyClassLocalHome home = (MyClassLocalHome)PortableRemoteObject.narrow(
                   context.lookup("java:comp/env/ejb/MyClass"),
              MyClassLocalHome.class);
    System.out.println("Narrowed");
    MyClassLocal timer;
    // create a new instance
    timer = home.create();
    System.out.println("Created!");
    In the ejbCreate() in MyClass callback, all I have is a System.out.println("ejbCreate() called") to show the method was called.
    My problem is the even though the servlet code runs without errors and I can see the output in the application server's SystemOut.log, I can't find "ejbCreate() called" message. Am I looking in the wrong place? Am I doing something wrong?
    Thanks in advance.
    Pedro

    Hi Pedro,
    You're not necessarily doing something wrong. Where are you actually invoking a business method on the Stateless Session bean? In the Stateless Session Bean lifecycle, the actual bean instance creation is not required to be linked to the Home.create() call. That's because Stateless Session bean instances have no client-specific state. The container can delay the bean instance creation until an actual business method is called. Only then would the bean instance's ejbCreate method be called.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Ejb System.out.println

    Does anyone know where System.out.println from a bean goes. I can't seem to find the data in any trace or log files??

    Does anyone know where System.out.println from a bean goes. I can't seem to find the data in any trace or log files??

  • System.out.println not showing up in the console

    Hi,
    I've some System.out.println statements in a static block in a Stateless
    Session Bean. I could not see these outputs in the Weblogic console. I'm
    using Weblogic 5.1 Any one faced this problem before? any help is
    appreciated.
    Thanks & Regards,
    Nithi.

    Take a look in the weblogic log files they might be redirecting std out.
    "Ryan LeCompte" <[email protected]> wrote:
    >
    Hello Nithi,
    I'm all out of ideas, unfortunately! However, check out the following
    links for
    some possible insight into the problem:
    http://groups.google.com/groups?q=System.out.println+5.1+WebLogic&start=60&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3d3df18e%40newsgroups.bea.com&rnum=69
    http://groups.google.com/groups?q=System.out.println+5.1+WebLogic&start=70&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3977417b%40newsgroups.bea.com&rnum=71
    http://groups.google.com/groups?q=System.out.println+5.1+WebLogic&start=200&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3bc20346%241%40newsgroups.bea.com&rnum=209
    Best regards,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    "Nithi Rajan" <[email protected]> wrote:
    Hi Ryan,
    Thanks for your reply and sorry for the long silence. I was on vocation.
    Thre problem still remains.I'm very sure that the EJB
    is deployed by WebLogic as I'm able to call some methods.
    and I'm also calling EJB methods from Servlet. But my
    System.out.println statments work fine in the Servlet and
    not inside EJB (or anyother classes used by EJB).
    Any one has faced similar problems? BTW am using WebLogic 5.1
    Thanks in advance,
    Regards,
    Nithi.
    "Ryan LeCompte" <[email protected]> wrote in message
    news:[email protected]...
    Hello Nithi,
    I find it strange that your System.out.println statements are beingexecuted from
    within your servlets, but not in your stateless session bean. Are
    you
    positive
    that your EJB is being located and deployed by WebLogic? The statementsin
    your
    static { } block should be executed as soon as the WebLogic class
    loader
    finds
    the class and loads it into the JVM. I would suggest examining theconsole
    and
    try to determine if your EJB is in fact being deployed. Are you invokingmethods
    on the EJB inside of your servlets? Are you using any logging frameworkfrom within
    the EJBs which would redirect output to a file?
    Best regards,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    "Nithi Rajan" <[email protected]> wrote:
    Hi Ryan,
    Thanks for your reply. The setting in the weblogic.properties is
    as
    follows.
    weblogic.system.enableConsole=true
    So, that tells me that I should see all the System.out.printlns right?
    (Pleasecorrect me if I'm wrong). I can see all the System.out.println
    from
    my
    servletand not from the Session Bean (even if the System.out.println
    is
    outside
    static block).
    Please let me know your thoughts.
    Thanks & Regards,
    Nithi.
    "Ryan LeCompte" <[email protected]> wrote in message
    news:[email protected]...
    Hello Nithi,
    Are you sure that you don't have WebLogic configured to redirect
    all
    messages
    to a file instead of the console? Are you able to see yourSystem.out.println
    statements when placed within other methods of your stateless sessionbean? Please
    be a bit more specific.
    Thank you,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    "Nithi Rajan" <[email protected]> wrote:
    Hi,
    I've some System.out.println statements in a static block in a
    Stateless
    Session Bean. I could not see these outputs in the Weblogic console.
    I'm
    using Weblogic 5.1 Any one faced this problem before? any helpis
    appreciated.
    Thanks & Regards,
    Nithi.

  • Where does the logging happens for System.out.println

    Hello:
    I'm usingNetWeaver 2004sJava SP9 evaluation version. Added some System.out.println to the ejbs. Would like to know where to look for the logging details in this case.
    Thanks for your help,
    Ravi

    Hi,
      By default, if the setting has been done, then it appears in defaultTrace as mentioned. For configuration of it, refer to this link.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/db315878-0801-0010-928e-98c8283616d3
    Reward points if it helps.
    Regards,
    Vijai

  • Where does System.out.println go?

    Hi Everyone: I know I've seen this topic before, but I'm still having some trouble. I would like to debug my EJBs, and so I've added some System.out.println statements to them. Where does that go? I've looked at the defaultTrace.trc files in the
    C:\usr\sap\P48\JC00\j2ee\cluster\server0\log
    folder, and haven't found any of the text that I think I am writing. I appreciate any guidance! Ian.

    Hi lan,
    I was facing the same question earlier, and now I think I have figured out one possible answer. Actually, where the System.out.println goes is up to the Server Admin to config. There is a default SYSTEM.OUT log controller ( under location controller side) pre-defined to cater for all System.out.println(). All the System.out.println() output is considered as INFO type log message. However, this default SYSTEM.OUT controller is not assigned with any real log destination, thus, we cannot find the output anywhere.
    If you goes to the log configurator (using Visual Admin), you can locate this SYSTEM.OUT controller , and add in a default (Anonymous) destionation for it . (you need to toggle on the advance edit mode from the top menu , then you can add modify the destination settings of a Controller).
    For Anonymous destionation, the println() output will sure go to the defaultTrace.trc (better view it using Log Viewer, instead of viewing it from the log file ).
    Or , you can define a separate file (e.g. c:\temp\myStd.log ) as the log destination ..
    Last but not the least, you need to set the ForceSingleTraceFile setting from 'YES' to 'NO' , then you can see your "myStd.log".
    To change the ForceSingleTraceFile , go to Visual Admin, J2EE server --> Kernel --> LogManager.
    Hope you find the above useful.

  • Help: What can make "System.out.println" not displaying anything?

    Hello,
    We have Portal 10g.
    I have noticed a pb on the interpretation of existing JSP pages.
    I simplified the code... and I noticed that even this command doesn't work :
    <%
    System.out.println("Hello World");
    %>
    Any idea ?
    Is there any security ? permission I should get ?
    JSP works fine on our old 8i environment ...
    Thanks in advance for your help.
    Olivier

    Olivier,
    between 8i and 10g are aeons of time (for computer technology). As far as I recall, in 8i came with a Apache and JServ module. This supported Servlets and JSP through a special Oracle implementation. After that OC4J as a J2EE container for EJBs and Servlets/JSPs was introduced.
    Using JSPs with the database installation only is not advised anymore. You can use OC4J for that. But be aware that will require some changes in the configuration and deployment of JSPs.
    HTH,
    --olaf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Is there a way to make system.out.println() scroll down as it goes?

    I am writing a program where I want to be able to read what's printed out in the console of my IDE through System.out.println() as the program runs/after the program runs. However, right now I run the program, the message prints out, and then when I go to read it the scroll bar is all the way up so I can see only the top of the print-out (the first thing printed out). Is there any way I can get the console to scroll along with the text, kind of like floating boxes you see on various websites for various reasons? In other words, can I get it so that when I look in the console at any given moment of the program running, I am looking at the newest text printed out (the text at the bottom of the "page")? Thank you!

    That would be an IDE problem and not a Java one. You could redirect output into a text file so you can read at your leisure and scroll up and down as much as you like.

  • Is there a way to force System.out.println to run when called

    I working on my first threaded program and having a hard time debugging. I've used System.out.println to let me know what's going on but due (I assume) to the nature of threads the output is not sequential. Is there a way to force println to execute immediatly so that they show up in the order they were called?
    Thanks --- Mike

    mjs1138 wrote:
    endasil, Thanks for the reply. I'm currenlty running the program from within the NetBeans IDE. It is the output displayed by in NetBeans "output" that I'm looking at.
    --- MikeI don't use Netbeans, but I would guess that it too pipes Standard Out and Standard Error to the same console. You didn't address my comment. Are you printing to System.err as well? This happens implicitly if you use Exception.printStackTrace(), for example.

  • 32-bit JDK 7 System.out.println not working in IDE

    Hi folks,
    I have a 64-bit Windows 7 OS.
    Due to 3rd party library/jar dependencies, i had to install the 32-bit Java JDK 1.7 and Eclipse IDE.
    I also installed NetBeans.
    So i have a 64-bit OS and am running 32-bit Java JDK/JRE & IDEs.
    The problem I am having is that my program's System.out.println("...") statements are not outputting strings to either IDE debug console.
    Executing the compiled program from a command line/prompt produces the expected string output.
    The basic "Hello, World" program is enough to cause this behaviour to start occurring.
    I have not manually / intentionally changed any IDE-specific Debug Console or Windows environment settings.
    One caveat: This same environment has worked successfully in the past ?! Yes, this is one of those "..it worked last week & yesterday and today it isn't and i swear i didn't do anything..." issue.
    Thoughts ?

    Thanks for the reply.
    The 64-bit versions of Java & Eclipse were installed first.
    When i discovered I had to use the 32-bit versions, i un-installed the 64-bit ones & installed the 32-bits.
    Even after that initial un-install 64-bit/install 32-bit process, it was working.
    I have also been installing the Windows 7 64-bit OS updates when i am informed of them.
    I'm not sure if any of these would affect how the Eclipse / NetBeans IDEs behave.
    Behaviour has been inconsistent.
    Initially it was always working.
    But over the past several days, it has been working less and less.
    I don't have any large data structures.
    This isn't a large complicated program, couple hundred lines, so i highly doubt that i'm doing anything to the resources, but something has changed.
    The main project I am working on takes command line parameters, does some initial processing, produces output using System.out.printlns [SOP] then depending on the parameters, branches into 2 different processing paths, let's call them A & B. Each of these processing paths also use SOPs. When i run the program in the IDE going thru path A, sometimes the initial SOP statements will work and the SOP statements specific to path A will also work. If i immediately change the parameters to go thru path B & re-run it, not even the initial SOP statements before the branching decision work.
    I've tried doing System.flush()s too - no affect.
    I haven't tried the re-direction option to a file option you mentioned yet.
    It always works from a command prompt - that is telling me that the Java SOPs are working properly, correct ?
    Inside an Eclipse or NetBeans IDE, SOP output to the debug console is inconsistent.
    Running from a command prompt, the SOPs always work.
    It'd help to know if this an IDE issue, a Java issue, a Windows 7 issue so i can narrow down where to try and correct the situation.
    I have a Windows XP VM set up, i'll try running the program there and see if there's a difference.
    Thanks for your reply.

  • How can i put a system.out.println into txt file

    i want to generate a txt file instead of system.out.println. for the output How can i do that and what code can i use for that??
    Edited by: crystalarun on Oct 14, 2007 11:40 AM

    suppose u ant output in "Output.txt"
    then code can be
    PrintStream out = new PrintStream(new FileOutputStream("Output.txt"));
    System.setOut(out)

  • System.out.println () is not working properly

    Hi, Why does this happens:
    Object temp=null;
    System.out.println ("temp is null? "+temp==null);
    just prints: true
    expected: temp is null? true
    Why does this happens????
    If I do System.out.println ("temp is null? "+(temp==null)); it works bu it should work without the pharentesis too

    MelGohan wrote:
    Hi, Why does this happens:
    Object temp=null;
    System.out.println ("temp is null? "+temp==null);
    just prints: trueThat is odd, mine prints "false".
    type Test126.java
    public class Test126 {
        public static void main(String[] args) {
            Object temp=null;
            System.out.println ("temp is null? "+temp);
            System.out.println ("temp is null? "+temp==null);
    }javac Test126.java
    java Test126
    temp is null? null
    false

  • System.out.println in Web Dynpro Java

    I call System.out.println in some components in web dynpro java.  But I cannot find the standard console output file of SAP J2EE Engine. Anyone know where is the location of standard output file?

    Thanks Deepak. Your link blog is working.
    Sreeni: I cannot find a start-up log file. Could you please tell me the real path?
    Edited by: Nuttakorn Boonthamtanarung on Apr 1, 2010 6:58 AM

  • System.out.println not working in Tomcat-4.1.x

    System.out.println not working in Tomcat-4.1.24. Any settings has to be enabled??? I am using tomcat for Solaris

    I think u can use ServletContext.log() to output info instased.

  • Where to see the System.out.println() messages

    I deploy my application in Oracle9ias . I have some System.out.println() statements in java class files.
    When I run the application I need to know where I can see those println() statements.

    The Member Feedback forum is for suggestions and feedback for OTN Developer Services. This forum is not monitored by Oracle support or product teams and so Oracle product and technology related questions will not be answered. We recommend that you post this thread to the Application Server-General forum. The URL is:
    Oracle Application Server - General

Maybe you are looking for

  • New Infinity 2 Order

    Hi Guys, Ive recently placed a new Infinity 2 order, porting from a TalkTalk ADSL service. When I placed the order I did not have my TalkTalk MAC code, however I received this on Sunday via email. When I go into the ordertracking page to input the MA

  • Macbook (white) to external display help

    I would like to know that if you get this(http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=220302853762&_trksid=p2759. l1259) adapter for the mini dvi-d port on my macbook will it work with a dvi-d display and cable due to it being a dvi-i adapte

  • Why can't I make a project progressive?

    When I open a new project in Encore, I want to set it to progressive. But no matter what I try, the Video Transcoding settings are greyed out and I can't change it from Lower Fields First. This has left me with jumpy videos, and I have no idea how to

  • Securely Wipe iPod Touch

    Hey guys, I just got an iPhone 4, and am going to sell my 32GB 3rd gen iPod Touch on ebay. The problem with this is that I don't know who will buy it, and I'va had somewhat sensitive data on it (Like contacts, e-mail, etc.), so I was wondering if any

  • 5TH GEN and Vauxhall Insignia

    Hi again , I have just bought a 59 reg Insignia with a usb port for ipod but when I plug my 5th gen ipod it it states that it is not supported yet I can plug my wife's 3rd gen classic in and that works!!! Anyone else had these issues and been able to