ResourceBundle problem

Hello !
I am trying to load a resource bundle properties file and I get a MissingResourceException no matter where I put the file. I tried in the /src and the /bin directory of my project. I even tried in the project's root directory. And I don't know where else to try :(
So, please help me!
Thanks!

#1 - it may be caused by an incorrect bundle name
#2 - it may be caused by an classpath setting error
#1 - The name of the bundle class must include the "Bundle" tag: example: 'PalavrasBundle_pt_BR.java'
      ResourceBundle bundle = ResourceBundle.getBundle("Palavras",new Locale("pt", "BR"));#2 - check if the '.' is present in the classpath settings...

Similar Messages

  • ResourceBundle problem with IE7

    Hi all,
    I have problems getting the correct ResourceBundle from the Locale in my applet using IE7. It works with Firefox2 (and with IE6 as a user told me, I did not test this though). Can anyone help me with this? Below you see relevant code and the output in Firefox and IE7:
      System.out.println("DisplayLanguage: "+currentLocale.getDisplayLanguage());
        res_bundle = ResourceBundle.getBundle("myResources.ApplicationResources", currentLocale);
        System.out.println("Locale in ResourceBundle: "+res_bundle.getLocale().toString());
        System.out.println("DisplayLanguage in ResourceBundle: "+res_bundle.getLocale().getDisplayLanguage());
    Output in Firefox 2:
    DisplayLanguage: Italienisch
    Locale in ResourceBundle: it //correct
    DisplayLanguage in ResourceBundle: Italienisch
    Output in InternetExplorer 7:
    DisplayLanguage: it_it //different from the Firefox output
    Locale in ResourceBundle: de //incorrect, this is the default Locale
    DisplayLanguage in ResourceBundle: Deutsch

    Ok, this is apparently a JSP issue. The Language Code provided by request.getLocale() in the JSP is not the same for every browser:
    in Firefox: de, it (this is what the Locale constructor needs: the ISO-639 language code)
    in IE7, Safari: de_DE, it_IT
    I don't know why this is the case, but now I can use a workaround (i.e. ignore the second part of the language code).
    So, the problem is solved. However, I would be still interested in the reasons for these differences...
    Thanks, Gonzberg

  • WSAD Generate RMIC ResourceBundle Problem

    Hello Everyone,
    If anyone could answer this, I'd be grateful. This has even IBM people stumped.
    I created a Resource Bundle in the src directory a WSAD project. It's named Messages_en_US.properties. I've tested getting strings from this resource bundle, in an ejb, on Websphere, at runtime and it works fine.
    The problem comes when I want to create a static enum class which references this resource bundle. When I do that and run Generate RMIC, I get the following error in a window:
    com.ibm.etools.rmic.RMICException: RMIC Command returns RC = 1. The problems which stopped RMIC are displayed, and have also been recorded in the log file.
    Then in the log file, I get this exception:
    !MESSAGE java.lang.ExceptionInInitializerError: java.util.MissingResourceException: Can't find bundle for base name com.retek.mdm.app.attribute.service.impl.Messages, locale en_US
         at java.lang.Throwable.<init>(Throwable.java)
         at java.lang.Throwable.<init>(Throwable.java)
         at java.util.MissingResourceException.<init>(MissingResourceException.java:39)
         at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:724)
         at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java)
         at java.util.ResourceBundle.getBundle(ResourceBundle.java:558)
         at com.retek.mdm.domain.attribute.AttributeFormatType.<clinit>(AttributeFormatType.java:33)
         at java.lang.Class.initializeImpl(Native Method)
         at java.lang.Class.initialize(Class.java)
         at java.lang.ClassLoader.resolveClassImpl(Native Method)
         at java.lang.ClassLoader.resolveClass(ClassLoader.java:617)
         at com.ibm.tools.rmic.iiop.DirectoryLoader.loadClass(DirectoryLoader.java:102)
         at com.ibm.tools.rmic.iiop.CompoundType.loadClass(CompoundType.java:348)
         at com.ibm.tools.rmic.iiop.Type.initClass(Type.java:994)
         at com.ibm.tools.rmic.iiop.Type.setRepositoryID(Type.java:1011)
         at com.ibm.tools.rmic.iiop.CompoundType.initialize(CompoundType.java:756)
         at com.ibm.tools.rmic.iiop.ValueType.initialize(ValueType.java:251)
         at com.ibm.tools.rmic.iiop.ValueType.forValue(ValueType.java:111)
         at com.ibm.tools.rmic.iiop.CompoundType.makeType(CompoundType.java)
         at com.ibm.tools.rmic.iiop.CompoundType$Method.<init>(CompoundType.java)
         at com.ibm.tools.rmic.iiop.CompoundType.addAllMethods(CompoundType.java:1302)
         at com.ibm.tools.rmic.iiop.ValueType.initialize(ValueType.java:240)
         at com.ibm.tools.rmic.iiop.ValueType.forValue(ValueType.java:111)
         at com.ibm.tools.rmic.iiop.CompoundType.makeType(CompoundType.java)
         at com.ibm.tools.rmic.iiop.CompoundType$Method.<init>(CompoundType.java)
         at com.ibm.tools.rmic.iiop.CompoundType.addAllMethods(CompoundType.java:1302)
         at com.ibm.tools.rmic.iiop.RemoteType.isConformingRemoteInterface(RemoteType.java:217)
         at com.ibm.tools.rmic.iiop.RemoteType.initialize(RemoteType.java:166)
         at com.ibm.tools.rmic.iiop.RemoteType.forRemote(RemoteType.java:85)
         at com.ibm.tools.rmic.iiop.CompoundType.addRemoteInterfaces(CompoundType.java:1434)
         at com.ibm.tools.rmic.iiop.ImplementationType.initialize(ImplementationType.java:161)
         at com.ibm.tools.rmic.iiop.ImplementationType.forImplementation(ImplementationType.java:87)
         at com.ibm.tools.rmic.iiop.StubGenerator.getTopType(StubGenerator.java:143)
         at com.ibm.tools.rmic.iiop.Generator.generate(Generator.java:279)
         at sun.rmi.rmic.Main.doCompile(Main.java:547)
         at sun.rmi.rmic.Main.compile(Main.java:142)
         at java.lang.reflect.AccessibleObject.invokeI(AccessibleObject.java:215)
         at java.lang.reflect.Method.invoke(Method.java:255)
         at com.ibm.etools.rmic.RMICClassLoader.runCompile(RMICClassLoader.java)
         at com.ibm.etools.rmic.RMICOperation.invokeRMICInJVM(RMICOperation.java:466)
         at com.ibm.etools.rmic.RMICOperation.rmic(RMICOperation.java:561)
         at com.ibm.etools.rmic.RMICOperation.generateStubs(RMICOperation.java:206)
         at com.ibm.etools.ejbdeploy.ui.plugin.rmic.UIRMICBeansOperation.generateStubs(UIRMICBeansOperation.java:132)
         at com.ibm.etools.rmic.RMICOperation.run(RMICOperation.java:642)
         at com.ibm.etools.ejbdeploy.ui.plugin.DeployRMICBeansOperation.generateRMICCode(DeployRMICBeansOperation.java:319)
         at com.ibm.etools.ejbdeploy.ui.plugin.DeployRMICBeansOperation.run(DeployRMICBeansOperation.java)
         at org.eclipse.core.internal.resources.Workspace.run(Workspace.java)
         at com.ibm.etools.ejbdeploy.ui.plugin.DeployRunnableWithProgress.run(DeployRunnableWithProgress.java:92)
         at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:101)
    Apparently, because I created a static variable, RMIC tries to instantiate it, and then it can find it. Any ideas?
    Thanks,
    Tim

    Not sure if this is the answer but...
    Websphere starts it's Web container after it's EJB container. If the class that tries to call that is in the ejb level it might not have read the property file yet because that is in the web level.
    We had this problem and it was traced back to the threading of the start up.

  • ResourceBundle problem with JSP

    Hello,
    I am accessing a ResourceBundle from a bean. I am also using Tomcat 3.1. The properties file that I am accesing is called res.properties, and resides in the following folder structure.
    c:\projects\test\web\WEB-INF\classes\com\riz\test
    The code to access the properties file in my bean is
    private static ResourceBundle res =           ResourceBundle.getBundle("com.riz.test.res");This works fine. My problem is now I am trying to access this same properties file in a JSP. I have tried to call it using the code:
    ResourceBundle res =           ResourceBundle.getBundle("com.riz.test.res");but I get the following error:
    javax.servlet.ServletException: Can't find bundle for base name com.riz.test.res, locale en_US
         at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:386)
         at _0002fwebboss_0002ejspwebboss_jsp_212._jspService(_0002fwebboss_0002ejspwebboss_jsp_212.java:430)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:174)
         at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
         at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
         at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
         at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
         at java.lang.Thread.run(Thread.java:484)
    Can anyone give me some guiding suggestions please?
    Thanks,
    Mike...

    You will not be able to use this resource from jsp because the resource is under WEB-INF directory structure. The jsp are in the application root directory. You should get the resource bundle once in the begining while logging and after that you can put it in the session and then can make use of it in the jsp pages and anywhere else.
    just do...
    session.setAttribute("res",res); // in the begining
    after that in servlet you can do something like
    ResourceBundle res = (ResourceBundle)session.getAttribute("res");
    then use it.......
    hope it helps
    vinod

  • French symbol in ResourceBundle problem

    I have a problem with a special french symbol in my ResourceBundle.
    It is the symbol � (similar to "oe" or \u009D).
    I can't event print this symbol to the console. Instead always a ? is displayed. All other french symbols are displayed fine. I tried also to switch the file encoding to UTF-8 ( System.setProperty("file.encoding", "UTF-8")) ), but this does not solve my problem.
    Any ideas ?

    You may want to check the Locale for the console window/application.
    What OS are you running on?
    vbk

  • Problem using Regex with ResourceBundle

    Hi,
    i'm using a ResourceBundle to store I18N strings in various languages. Now when I try to use those as patterns in a Regex, it just doesn't match.
    Here is a sample string:
    Mode lecture : S�curis� SANS C2, Flux pr�cis, Cache d�sactiv�
    In the ResourceBundle it looks like this, encoded as Unicode codepoints:
    eaclog.1254=S\u201acuris\u201a SANS C2, Flux pr\u201acis, Cache d\u201asactiv\u201a
    When I retrieve the regex pattern (myPattern.pattern()), it looks like this on the console:
    S�curis� SANS C2, Flux pr�cis, Cache d�sactiv�
    It seems like the encoding in the regex isn't right. What have I done wrong?

    Cool, thanks for the reply. The character encoding was broken even before I converted it using natice2ascii, now it works!
    From now on, I will always use the "-reverse" option to see if the output looks right. Boy, and I thought it was some weird regex problem...

  • Problems in Arabic and ResourceBundle

    i have a problem with arabic text using the resource bundle property file.
    I using struts framework and in the jsp i use <bean:meassage key="TheKey">
    like:
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
    <%@ page contentType="text/html; charset=windows-1256"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1256"/>
    </head>
    <body>
    <bean:message key="deposits.deposit.global.depositId"/></td>
    </body>
    </html>
    and the value of the key is arabic text , when i run this page , the arabic text was displayed as ????.
    i have seaching the forum and no solution for this case << Using resource bundle >>.
    Any help Please.

    I think that the solution is to use Unicode utf-8
    add this line in the header of every page that content arabic word
    <%@ page contentType="text/html; charset=utf-8" %>
    and in the ResourceBundle file write in arabic , you will see after compilation that what you had write in arabic became in Unicode.
    exemple :
    before compilation
    Form.label.sndName= &#1575;&#1604;&#1573;&#1587;&#1605;
    after comilation
    Form.label.sndName= \u0627\u0644\u0625\u0633\u0645
    and remember that i sad that you must add
    <%@ page contentType="text/html; charset=utf-8" %> in every page that content arabic word
    in jsp page write
    <bean:message key="Form.label.sndName"/>
    if you folowing this concept you will not encounter any problem with javascript validation

  • ResourceBundle - Hebrew problem

    Hi,
    I need to translate my program to different languages.
    all swing components and messages.
    I put in translate.properties file hebrew translations.
    I get junk words of hebrew (gibrish) when I do this:
    ResourceBundle labels =
    ResourceBundle.getBundle("translate",java.util.Locale.getDefault());
    String value = labels.getString(key);
    label.setText(value);
    What should I do to solve this problem?
    Thanks,
    Anat

    1) Make sure the bytes of 'value' are what you expect.
    2) If they are then make sure the Label's font has glyphs for Hebrew characters.

  • Problems with loading ResourceBundle

    I want to load a ResourceBundle with
    ResourceBundle reb = ResourceBundle.getBundle(baseclass,locale);
    In the api it is documentated, that the jvm looks in the following order for the the baseclass file of my ResourceBundle:
    baseclass + "_" + language1 + "_" + country1 + "_" + variant1
    baseclass + "_" + language1 + "_" + country1 + "_" + variant1 + ".properties"
    baseclass + "_" + language1 + "_" + country1
    baseclass + "_" + language1 + "_" + country1 + ".properties"
    baseclass + "_" + language1
    baseclass + "_" + language1 + ".properties"
    baseclass + "_" + language2 + "_" + country2 + "_" + variant2
    baseclass + "_" + language2 + "_" + country2 + "_" + variant2 + ".properties"
    baseclass + "_" + language2 + "_" + country2
    baseclass + "_" + language2 + "_" + country2 + ".properties"
    baseclass + "_" + language2
    baseclass + "_" + language2 + ".properties"
    baseclass
    baseclass + ".properties"
    I have a filemonitor running and the JVM definitly doesn t look for baseclass.properties, but starts with baseclass.class and so on: so it doesn t find the baseclass.properties file (I need to use it as default) It does find baseclass_de.properties, baseclass_class etc.. Any idea anyone?
    Thanks Anke

    thanks KPSeal, but it doesn t really solve the problem: I have got the files
    baseclass.properties
    baseclass_de.properties
    baseclass_en.properties
    baseclass_ja.properties
    I want to use baseclass.properties as default for languages which are not yet available. If I call getBundle with a Chinese locale then the jvm does not use baseclass.properties. In the filemonitor I see that the jvm looks for baseclass.class, baseclass_zh.properties etc. but not for baseclass.properties....

  • Problem with ResourceBundle in Jar

    Hi,
    I've written the following class which works perfectly in my program but not when used in the same code but distributed as a Jar file.
    In this case, only the default locale is used on a "Messages.getString" call, even if I swith the local to English...
    I've read that there was a "bug" in the j2sdk1.4.2_05 and I'm using the j2sdk1.4.2_06.
    Do you have any idea ?
    Thanks,
    Marc.
    package com.oxiane.marketing.IHM;
    import java.util.Locale;
    import java.util.MissingResourceException;
    import java.util.ResourceBundle;
    * Classe servant � g�rer les langues Anglaise et Fran�aise pour
    * l'interface.
    public class Messages {
         private static final String BUNDLE_NAME = "Messages" ;
         private static ResourceBundle RES_BUNDLE_FR = ResourceBundle.getBundle(BUNDLE_NAME, Locale.getDefault());
         private static ResourceBundle RES_BUNDLE_EN = ResourceBundle.getBundle(BUNDLE_NAME, Locale.ENGLISH);
            public static String getString(String msg){
                 try {
                      if (Locale.getDefault().getLanguage() == "fr")
                           return RES_BUNDLE_FR.getString(msg);
                      else
                           return RES_BUNDLE_EN.getString(msg);
                 catch (MissingResourceException e){
                      System.out.println(e.getMessage());
                      return "";
         public static void setLocale(Locale loc){
              Locale.setDefault(loc);
         public static Locale getLocale(){
              return Locale.getDefault();
    }

    You should take care of the directory structure according to the package structure.
    I for example have this jar:
    C:\source\java\ebank2_util\smsunlock>unzip -l pro-ebank_sms_unlock.jar
    Archive:  pro-ebank_sms_unlock.jar
    Length    Date    Time    Name
          0  10-28-05  17:27   hu/
          0  10-28-05  17:27   hu/khb/
          0  10-28-05  18:17   hu/khb/smsunlock/
        256  11-07-05  16:33   hu/khb/smsunlock/DButils$MySQLException.class
       4229  11-07-05  16:33   hu/khb/smsunlock/DButils.class
       1700  11-07-05  16:33   hu/khb/smsunlock/GUI$1.class
       2318  11-07-05  16:33   hu/khb/smsunlock/GUI$2.class
        988  11-07-05  16:33   hu/khb/smsunlock/GUI$3.class
       1402  11-07-05  16:33   hu/khb/smsunlock/GUI$mywl.class
       5630  11-07-05  16:33   hu/khb/smsunlock/GUI.class
        818  11-07-05  16:33   hu/khb/smsunlock/LimitedLength_TextField.class
       2452  11-07-05  16:33   hu/khb/smsunlock/Main.class
        900  11-07-05  16:33   hu/khb/smsunlock/MyInputStream.class
          0  11-07-05  16:33   META-INF/
         98  10-27-05  15:53   META-INF/manifest.mf
         90  11-07-05  16:33   hu/khb/smsunlock/properties
      20881                    16 filesAnd the resource is loaded like this from hu.khb.smsu.Main:
    InputStream is = new MyInputStream( Main.class.getResourceAsStream( "properties" ) );

  • Problem for ResourceBundle calling from jsp file

    Hi, I am using WebLogic 5.1 in Solaris 8
              I use java.util.resourceBundle to get the information from a .properties
              file
              I put the properties file in /opt/weblogic/myserver/serverclasses
              When I call the properties file from EJB, It seems to be OK
              But when I call the properties file from JSP using the same script, It said
              the properties files not found
              The Error message is:
              <ServletContext-General> Servlet fail
              ed with Exception
              java.util.MissingResourceException: Can't find bundle for base name
              test.dbini,
              locale zh_TW
              at
              java.util.ResourceBundle.throwMissingResourceException(ResourceBundle
              .java:707)
              at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:679)
              at java.util.ResourceBundle.getBundle(ResourceBundle.java:546)
              at
              jsp_servlet._test._global_95_variable._jspService(_global_95_variable
              .java:85)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
              pl.java:105)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
              pl.java:123)
              at
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletCon
              textImpl.java:742)
              at
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletCon
              textImpl.java:686)
              at
              weblogic.servlet.internal.ServletContextManager.invokeServlet(Servlet
              ContextManager.java:247)
              at
              weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.jav
              a:361)
              at
              weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:261)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              PLease Help!!
              Regards,
              Fannie
              

    Hi,
    open dataset file for input in text mode.
    check sy-subrc = 0.
    while sy-subrc = 0.
      read dataset file into wa.
      if sy-subrc = 0.
      append wa to itab.
      else.
        exit.
      endif.
    endwhile.
    close dataset file.
    regards
    Siggi
    PS: check also the F1-help for open, read and close statements!

  • Problem w/ ResourceBundle and default locale

    I have a couple of resource bundles:
    - Messages.properties (default, in English)
    - Messages_nl.properties
    - Messages_fr.properties
    Windows' regional settings are set to Dutch (Belgium) which makes the Java default locale 'nl_BE'.
    I want to get the resource bundle using the locale 'en'.
    I expect to get 'Messages.properties' but I get 'Messages_nl.properties' instead.
    Apparently, the lookup algorithm goes like this:
    look for Messages_en.properties -> not found
    look for Messages_'default locale'.properties = Messages_nl_BE.properties -> not found
    look for Messages_nl.properties -> found
    I have a solution, but it isn't a very good one:Locale locale = new Locale("en");
    Locale defaultLocale = Locale.getDefault();
    Locale.setDefault(locale);
    ResourceBundle resourceBundle = ResourceBundle.getBundle("Messages", locale);
    Locale.setDefault(defaultLocale);Do you see a more elegant solution?
    Thanks.

    I don't know that it's more elegant, but it's probably the one I would use:
    Include a Messages_en.properties resource bundle. I believe that this resource bundle can actually simply be empty (the lookup will not find any entries in the en version, and it will then look in the base version - the default locale will not be used in this scenario, where a bundle with the en ID is found). Otherwise, If the bundle cannot be empty, it will be a copy of the base bundle.

  • I am facing problem while reading values from properties file ...i am getting null pointer exception earlier i was using jdeveloper10g now i am using 11g

    i am facing problem while reading values from properties file ...i am getting null pointer exception earlier i was using jdeveloper10g now i am using 11g

    hi TimoHahn,
    i am getting following exception in JDeveloper(11g release 2) Studio Edition Version 11.1.2.4.0 but it works perfectly fine in JDeveloper 10.1.2.1.0
    Root cause of ServletException.
    java.lang.NullPointerException
    at java.util.PropertyResourceBundle.handleGetObject(PropertyResourceBundle.java:136)
    at java.util.ResourceBundle.getObject(ResourceBundle.java:368)
    at java.util.ResourceBundle.getString(ResourceBundle.java:334)
    at org.rbi.cefa.master.actionclass.UserAction.execute(UserAction.java:163)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

  • Problem in JSF with Swing in a web application

    hi
    i am using jsf for my online projects.my problem is that when i use Swing concept ,the server is closed automatically when i click the swing dialog option 'OK', how can i protect server being closed automatically when user click the the options of Swing dialog box.it is so tedious because my application is going to integrate
    with online server?
    my swing java file is
    * FileExistsDialog.java
    package com.obs.ftw.util.alert;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.Rectangle2D;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.plaf.metal.MetalLookAndFeel;
    * FileExistsDialog: A JOptionPane-like dialog that displays the message
    * that a file exists.
    public class FileExistsDialog extends JDialog {
    * The component that gets the focus when the window is first opened
    private Component initialFocusOwner = null;
    * Command string for replace action (e.g., a button).
    * This string is never presented to the user and should
    * not be internationalized.
    private String CMD_REPLACE = "OK"/*NOI18N*/;
    * Command string for a cancel action (e.g., a button).
    * This string is never presented to the user and should
    * not be internationalized.
    private String CMD_CANCEL = "CANCEL"/*NOI18N*/;
    // Components we need to access after initialization
    private JButton replaceButton = null;
    private JButton cancelButton = null;
    public FileExistsDialog(){
         System.out.println("INSIDE THE FILE EXIST DIALOG");
         JFrame frame = new JFrame() {
         public Dimension getPreferredSize() {
         return new Dimension(200,100);
         frame.setTitle("Debugging frame");
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         frame.pack();
         frame.setVisible(false);
    FileExistsDialog dialog = new FileExistsDialog(frame, true);
         dialog.addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent event) {
         System.exit(0);
         public void windowClosed(WindowEvent event) {
         System.exit(0);
         dialog.pack();
         dialog.setVisible(true);
    * Creates a new FileExistsDialog
    * @param parent parent frame
    * @param modal modal flag
    public FileExistsDialog(Frame parent,boolean modal) {
    super(parent, modal);
         //initResources();
         System.out.println("INSIDE THE FILE EXIST DIALOG CONSTRUCTOR");
    initComponents();
    pack();
    * Determines the locale, loads resources
    /* public void initResources() {
         Locale locale = Locale.getDefault();
    resources = ResourceBundle.getBundle(
              "samples.resources.bundles.FileExistsDialogResources", locale);
    imagePath = resources.getString("images.path");
    }*/ // initResources()
    * Sets all of the buttons to be the same size. This is done
    * dynamically after the buttons are created, so that the layout
    * automatically adjusts to the locale-specific strings.
    private void equalizeButtonSizes() {
         System.out.println("INSIDE THE equalizeButtonSizes()");
    String[] labels = new String[] {
    replaceButton.getText(),
         cancelButton.getText()
         // Get the largest width and height
         Dimension maxSize= new Dimension(0,0);
         Rectangle2D textBounds = null;
         Dimension textSize = null;
    FontMetrics metrics =
              replaceButton.getFontMetrics(replaceButton.getFont());
         Graphics g = getGraphics();
         for (int i = 0; i < labels.length; ++i) {
         textBounds = metrics.getStringBounds(labels, g);
         maxSize.width =
         Math.max(maxSize.width, (int)textBounds.getWidth());
         maxSize.height =
         Math.max(maxSize.height, (int)textBounds.getHeight());
    Insets insets =
         replaceButton.getBorder().getBorderInsets(replaceButton);
    maxSize.width += insets.left + insets.right;
    maxSize.height += insets.top + insets.bottom;
    // reset preferred and maximum size since BoxLayout takes both
         // into account
    replaceButton.setPreferredSize((Dimension)maxSize.clone());
    cancelButton.setPreferredSize((Dimension)maxSize.clone());
    replaceButton.setMaximumSize((Dimension)maxSize.clone());
    cancelButton.setMaximumSize((Dimension)maxSize.clone());
    } // equalizeButtonSizes()
    * This method is called from within the constructor to
    * initialize the dialog.
    private void initComponents() {
         System.out.println("INSIDE THE initComponents()");
         // Configure the window, itself
    Container contents = getContentPane();
    contents.setLayout(new GridBagLayout ());
    GridBagConstraints constraints = null;
    setTitle("Waring");
         // accessibility - all applets, frames, and dialogs should
         // have descriptions
         this.getAccessibleContext().setAccessibleDescription("Descriptions");
         addWindowListener(new WindowAdapter() {
         public void windowOpened(WindowEvent event) {
              // For some reason the window opens with no focus owner,
              // so we need to force the issue
         if (initialFocusOwner != null) {
              initialFocusOwner.requestFocus();
              // Only do this the 1st time the window is opened
              initialFocusOwner = null;
         public void windowClosing(WindowEvent event) {
         System.out.println("INSIDE THE windowClosing");     
         // Treat it like a cancel
              windowAction(CMD_CANCEL);
         // image
    JLabel imageLabel = new JLabel();
    imageLabel.setIcon(
    new ImageIcon("/images/degraded_large.gif"));
    // accessibility - set name so that low vision users get a description
    imageLabel.getAccessibleContext().setAccessibleName("OK");
    constraints = new GridBagConstraints ();
    constraints.gridheight = 2;
    constraints.insets = new Insets(12, 33, 0, 0);
    constraints.anchor = GridBagConstraints.NORTHEAST;
    contents.add(imageLabel, constraints);
    // header
    JLabel headerLabel = new JLabel ();
    headerLabel.setText("SAMPLE");
    headerLabel.setForeground(
         new Color(MetalLookAndFeel.getBlack().getRGB()));
    constraints = new GridBagConstraints ();
    constraints.insets = new Insets(12, 12, 0, 11);
    constraints.anchor = GridBagConstraints.WEST;
    contents.add(headerLabel, constraints);
         // Actual text of the message
         JTextArea contentTextArea = new JTextArea();
    contentTextArea.setEditable(false);
    contentTextArea.setText("SAMPLE");
    contentTextArea.setBackground(
              new Color(MetalLookAndFeel.getControl().getRGB()));
    // accessibility -- every component that can have the
         // keyboard focus must have a name. This text area has no
         // label, so the name must be set explicitly (if it had a
         // label, the name would be pulled from the label).
    contentTextArea.getAccessibleContext().setAccessibleName(
              "CONTENTNAME");
    constraints = new GridBagConstraints ();
    constraints.gridx = 1;
    constraints.gridy = 1;
    constraints.insets = new Insets(0, 12, 0, 11);
    constraints.anchor = GridBagConstraints.WEST;
    contents.add(contentTextArea, constraints);
         // Buttons
         JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout (new BoxLayout(buttonPanel, 0));
         replaceButton = new JButton();
         replaceButton.setActionCommand(CMD_REPLACE);
    replaceButton.setText("OK");
    replaceButton.setToolTipText("TO OK");
         replaceButton.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent event) {
         windowAction(event);
    buttonPanel.add(replaceButton);
    // spacing
    buttonPanel.add(Box.createRigidArea(new Dimension(5,0)));
         cancelButton = new JButton();
         cancelButton.setActionCommand(CMD_CANCEL);
    cancelButton.setText("CANCEL");
    cancelButton.setNextFocusableComponent(replaceButton);
         cancelButton.setToolTipText("TO CANCEL");
         cancelButton.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent event) {
         windowAction(event);
    buttonPanel.add(cancelButton);
    constraints = new GridBagConstraints ();
    constraints.gridx = 1;
    constraints.gridy = 2;
    constraints.insets = new Insets(12, 12, 11, 11);
    constraints.anchor = GridBagConstraints.WEST;
    contents.add(buttonPanel, constraints);
         // Equalize the sizes of all the buttons
         equalizeButtonSizes();
         // For some reason, the dialog appears with no input focus.
         // We added a window listener above to force the issue
         initialFocusOwner = replaceButton;
    } // initComponents()
    * The user has selected an option. Here we close and dispose the dialog.
    * If actionCommand is an ActionEvent, getCommandString() is called,
    * otherwise toString() is used to get the action command.
    * @param actionCommand may be null
    private void windowAction(Object actionCommand) {
         System.out.println("INSIDE THE WINDOW ACTION");
         String cmd = null;
    if (actionCommand != null) {
         if (actionCommand instanceof ActionEvent) {
         cmd = ((ActionEvent)actionCommand).getActionCommand();
         } else {
         cmd = actionCommand.toString();
         if (cmd == null) {
         // do nothing
         } else if (cmd.equals(CMD_REPLACE)) {
         System.out.println("your replace code here...");
         } else if (cmd.equals(CMD_CANCEL)) {
         System.out.println("your cancel code here...");
         setVisible(false);
         dispose();
    } // windowAction()
    * This main() is provided for debugging purposes, to display a
    * sample dialog.
    // main()
    } // class FileExistsDialog
    and calling java function is
    public String fileDialog(){
         return "Success";
    public void processFile(ActionEvent event){
         System.out.println("INSIDE THE FILE DIALOG");
         FileExistsDialog file     = new FileExistsDialog();
         System.out.println("SUCCESS");
    called from
         <h:commandButton action="#{userLogin.fileDialog}" actionListener="#{userLogin.processFile}"></h:commandButton>
    pls help me as soon
    advance thanks
    rgds
    oasisdeserts

    Swing is GUI library for use in desktop applications.
    JSF is a web application framework which runs on an application server and is accessed by clients via web browsers.
    To fully understand what you have done, try accessing your application from a different machine than the server.
    To answer your question, don't invoke System.exit() if you would like the process to continue. But that is the least of your problems.

  • Focus Problem on Solaris with jdk 1.3.1

    Hi all,
    We are having a focus problem on Solaris. The same code works fine on Windows without any problem.
    I am sending the test code and run steps below which you can compile and repeat the problem.
    NOTE: When we put a comment on the line "f1.requestFocus();" in TestFocus.java it works OK.
    Run Steps :
    1. Run TestFocus.class
    2. A JFrame appears with 2 text field and a button
    3. Try to write something on the text fields. It works OK.
    4. Click the button to open a new JFrame
    5. A new JFrame opens with a single text field and a button.
    6. Click the button to close the second frame
    7. You are now on the main JFrame
    8. Try to write something on the text fields. It works OK.
    9. Repeat the steps 4-7
    10. Try to write something on the text fields. You are able to focus and write on the first field. BUT you cannot select or write the second Field!
    JAVA SOURCE FILES :
    PenHesapListener.java :
    public interface PenHesapListener extends java.util.EventListener {
    void tamam_actionPerformed(java.util.EventObject newEvent);
    void iptal_actionPerformed(java.util.EventObject newEvent);
    ------PenHesapLisEventMulticaster.java----------------------------------
    public class PenHesapLisEventMulticaster extends java.awt.AWTEventMulticaster implements PenHesapListener {
    * Constructor to support multicast events.
    * @param a java.util.EventListener
    * @param b java.util.EventListener
    protected PenHesapLisEventMulticaster(java.util.EventListener a, java.util.EventListener b) {
         super(a, b);
    * Add new listener to support multicast events.
    * @return muhasebe.HesappenListener
    * @param a muhasebe.HesappenListener
    * @param b muhasebe.HesappenListener
    public static PenHesapListener add(PenHesapListener a, PenHesapListener b) {
         return (PenHesapListener)addInternal(a, b);
    * Add new listener to support multicast events.
    * @return java.util.EventListener
    * @param a java.util.EventListener
    * @param b java.util.EventListener
    protected static java.util.EventListener addInternal(java.util.EventListener a, java.util.EventListener b) {
         if (a == null) return b;
         if (b == null) return a;
         return new PenHesapLisEventMulticaster(a, b);
    * @return java.util.EventListener
    * @param oldl muhasebe.HesappenListener
    protected java.util.EventListener remove(PenHesapListener oldl) {
         if (oldl == a) return b;
         if (oldl == b) return a;
         java.util.EventListener a2 = removeInternal(a, oldl);
         java.util.EventListener b2 = removeInternal(b, oldl);
         if (a2 == a && b2 == b)
              return this;
         return addInternal(a2, b2);
    * Remove listener to support multicast events.
    * @return muhasebe.HesappenListener
    * @param l muhasebe.HesappenListener
    * @param oldl muhasebe.HesappenListener
    public static PenHesapListener remove(PenHesapListener l, PenHesapListener oldl) {
         if (l == oldl || l == null)
              return null;
         if(l instanceof PenHesapLisEventMulticaster)
              return (PenHesapListener)((PenHesapLisEventMulticaster) l).remove(oldl);
         return l;
    public void tamam_actionPerformed(java.util.EventObject newEvent) {
         ((PenHesapListener)a).tamam_actionPerformed(newEvent);
         ((PenHesapListener)b).tamam_actionPerformed(newEvent);
    public void iptal_actionPerformed(java.util.EventObject newEvent) {
         ((PenHesapListener)a).iptal_actionPerformed(newEvent);
         ((PenHesapListener)b).iptal_actionPerformed(newEvent);
    ---------TestFocus2.java-----------------------------------------
    import javax.swing.*;
    import javax.swing.JOptionPane;
    import java.awt.event.WindowAdapter;
    import java.awt.event.KeyListener;
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.awt.event.ActionEvent;
    import java.awt.event.WindowEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
    import java.util.StringTokenizer;
    import java.text.SimpleDateFormat;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.awt.Color;
    import java.util.Locale;
    import java.util.ResourceBundle;
    public class TestFocus2 extends JFrame implements ActionListener
         protected transient PenHesapListener PenhListener = null ;
         JTextField f10 = null;
         JButton b10= null ;
         JTextField f1 = new JTextField() ;
         JButton b1 = new JButton() ;
         JFrame f20 = null;
         public TestFocus2()
              getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
              getContentPane().add(f1);
              getContentPane().add(b1);
              pack();
              setVisible(true);
              b1.addActionListener(this);
         public void actionPerformed(ActionEvent e)
              if(e.getSource() == b1)
                   fireTamam_actionPerformed(e);
         public void addPenHesapListener(PenHesapListener newListener)
              PenhListener = PenHesapLisEventMulticaster.add(PenhListener, newListener);
              return;
         protected void fireTamam_actionPerformed(java.util.EventObject newEvent) {
              PenhListener.tamam_actionPerformed(newEvent);
              this.setVisible(false);
         protected void fireiptal_actionPerformed(java.util.EventObject newEvent) {
              PenhListener.iptal_actionPerformed(newEvent);
         public static void main(String x[])
              TestFocus2 gen01 = new TestFocus2();
    --------TestFocus.java-----------------------------------
    import javax.swing.*;
    import javax.swing.JOptionPane;
    import java.awt.event.WindowAdapter;
    import java.awt.event.KeyListener;
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.awt.event.ActionEvent;
    import java.awt.event.WindowEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
    import java.util.StringTokenizer;
    import java.text.SimpleDateFormat;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.awt.Color;
    import java.util.Locale;
    import java.util.ResourceBundle;
    import java.awt.Container;
    public class TestFocus extends JFrame implements ActionListener
         PenKreKart aPenKreKart = null ;      
         Container ctn = null;
         JTextField f10 = null;
         JButton b10= null ;
         JTextField f1 = new JTextField() ;
         JTextField f2 = new JTextField() ;
         JButton b1 = new JButton() ;
         JFrame f20 = null;
         public TestFocus()
              //aPenKreKart = new PenKreKart(true);
              //aPenKreKart.aTemelPencere.setVisible(false);
              getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
              getContentPane().add(f1);
              getContentPane().add(f2);
              getContentPane().add(b1);
              pack();
              setVisible(true);
              b1.addActionListener(this);
         public void actionPerformed(ActionEvent e)
              if(e.getSource() == b1)
                   pencere_islemi();
         // pencere koyma k?sm? .. begin                               
         public void pencere_islemi() {     
              ctn = this;
              ctn.setEnabled(false);
              TestFocus2 fpen = new TestFocus2();
              //aPenKreKart.aTemelPencere.setVisible(true); //buras?          
              //aPenKreKart.aTemelPencere.addPenHesapListener(new PenHesapListener() {
              fpen.addPenHesapListener(new PenHesapListener() {
                        // metod      tamam_actionPerformed begin...          
                        public void tamam_actionPerformed(java.util.EventObject newEvent) {
                             ctn.setEnabled(true);
                             ctn.requestFocus();
                             // Problem is when we comment the below line it works .....
                             f1.requestFocus();
                             System.out.println("tamam");
                        // metod      tamam_actionPerformed end...          
                        // metod      iptal_actionPerformed begin...          
                        public void iptal_actionPerformed(java.util.EventObject newEvent) {
                             ctn.setEnabled(true);
                             ctn.requestFocus();
                             System.out.println("iptal");
                        // metod      iptal_actionPerformed begin...          
         // pencere koyma k?sm? .. end                               
         public static void main(String x[])
              TestFocus gen01 = new TestFocus();

    Hi all,
    We are having a focus problem on Solaris. The same code works fine on Windows without any problem.
    I am sending the test code and run steps below which you can compile and repeat the problem.
    NOTE: When we put a comment on the line "f1.requestFocus();" in TestFocus.java it works OK.
    Run Steps :
    1. Run TestFocus.class
    2. A JFrame appears with 2 text field and a button
    3. Try to write something on the text fields. It works OK.
    4. Click the button to open a new JFrame
    5. A new JFrame opens with a single text field and a button.
    6. Click the button to close the second frame
    7. You are now on the main JFrame
    8. Try to write something on the text fields. It works OK.
    9. Repeat the steps 4-7
    10. Try to write something on the text fields. You are able to focus and write on the first field. BUT you cannot select or write the second Field!
    JAVA SOURCE FILES :
    PenHesapListener.java :
    public interface PenHesapListener extends java.util.EventListener {
    void tamam_actionPerformed(java.util.EventObject newEvent);
    void iptal_actionPerformed(java.util.EventObject newEvent);
    ------PenHesapLisEventMulticaster.java----------------------------------
    public class PenHesapLisEventMulticaster extends java.awt.AWTEventMulticaster implements PenHesapListener {
    * Constructor to support multicast events.
    * @param a java.util.EventListener
    * @param b java.util.EventListener
    protected PenHesapLisEventMulticaster(java.util.EventListener a, java.util.EventListener b) {
         super(a, b);
    * Add new listener to support multicast events.
    * @return muhasebe.HesappenListener
    * @param a muhasebe.HesappenListener
    * @param b muhasebe.HesappenListener
    public static PenHesapListener add(PenHesapListener a, PenHesapListener b) {
         return (PenHesapListener)addInternal(a, b);
    * Add new listener to support multicast events.
    * @return java.util.EventListener
    * @param a java.util.EventListener
    * @param b java.util.EventListener
    protected static java.util.EventListener addInternal(java.util.EventListener a, java.util.EventListener b) {
         if (a == null) return b;
         if (b == null) return a;
         return new PenHesapLisEventMulticaster(a, b);
    * @return java.util.EventListener
    * @param oldl muhasebe.HesappenListener
    protected java.util.EventListener remove(PenHesapListener oldl) {
         if (oldl == a) return b;
         if (oldl == b) return a;
         java.util.EventListener a2 = removeInternal(a, oldl);
         java.util.EventListener b2 = removeInternal(b, oldl);
         if (a2 == a && b2 == b)
              return this;
         return addInternal(a2, b2);
    * Remove listener to support multicast events.
    * @return muhasebe.HesappenListener
    * @param l muhasebe.HesappenListener
    * @param oldl muhasebe.HesappenListener
    public static PenHesapListener remove(PenHesapListener l, PenHesapListener oldl) {
         if (l == oldl || l == null)
              return null;
         if(l instanceof PenHesapLisEventMulticaster)
              return (PenHesapListener)((PenHesapLisEventMulticaster) l).remove(oldl);
         return l;
    public void tamam_actionPerformed(java.util.EventObject newEvent) {
         ((PenHesapListener)a).tamam_actionPerformed(newEvent);
         ((PenHesapListener)b).tamam_actionPerformed(newEvent);
    public void iptal_actionPerformed(java.util.EventObject newEvent) {
         ((PenHesapListener)a).iptal_actionPerformed(newEvent);
         ((PenHesapListener)b).iptal_actionPerformed(newEvent);
    ---------TestFocus2.java-----------------------------------------
    import javax.swing.*;
    import javax.swing.JOptionPane;
    import java.awt.event.WindowAdapter;
    import java.awt.event.KeyListener;
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.awt.event.ActionEvent;
    import java.awt.event.WindowEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
    import java.util.StringTokenizer;
    import java.text.SimpleDateFormat;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.awt.Color;
    import java.util.Locale;
    import java.util.ResourceBundle;
    public class TestFocus2 extends JFrame implements ActionListener
         protected transient PenHesapListener PenhListener = null ;
         JTextField f10 = null;
         JButton b10= null ;
         JTextField f1 = new JTextField() ;
         JButton b1 = new JButton() ;
         JFrame f20 = null;
         public TestFocus2()
              getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
              getContentPane().add(f1);
              getContentPane().add(b1);
              pack();
              setVisible(true);
              b1.addActionListener(this);
         public void actionPerformed(ActionEvent e)
              if(e.getSource() == b1)
                   fireTamam_actionPerformed(e);
         public void addPenHesapListener(PenHesapListener newListener)
              PenhListener = PenHesapLisEventMulticaster.add(PenhListener, newListener);
              return;
         protected void fireTamam_actionPerformed(java.util.EventObject newEvent) {
              PenhListener.tamam_actionPerformed(newEvent);
              this.setVisible(false);
         protected void fireiptal_actionPerformed(java.util.EventObject newEvent) {
              PenhListener.iptal_actionPerformed(newEvent);
         public static void main(String x[])
              TestFocus2 gen01 = new TestFocus2();
    --------TestFocus.java-----------------------------------
    import javax.swing.*;
    import javax.swing.JOptionPane;
    import java.awt.event.WindowAdapter;
    import java.awt.event.KeyListener;
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.awt.event.ActionEvent;
    import java.awt.event.WindowEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
    import java.util.StringTokenizer;
    import java.text.SimpleDateFormat;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.awt.Color;
    import java.util.Locale;
    import java.util.ResourceBundle;
    import java.awt.Container;
    public class TestFocus extends JFrame implements ActionListener
         PenKreKart aPenKreKart = null ;      
         Container ctn = null;
         JTextField f10 = null;
         JButton b10= null ;
         JTextField f1 = new JTextField() ;
         JTextField f2 = new JTextField() ;
         JButton b1 = new JButton() ;
         JFrame f20 = null;
         public TestFocus()
              //aPenKreKart = new PenKreKart(true);
              //aPenKreKart.aTemelPencere.setVisible(false);
              getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
              getContentPane().add(f1);
              getContentPane().add(f2);
              getContentPane().add(b1);
              pack();
              setVisible(true);
              b1.addActionListener(this);
         public void actionPerformed(ActionEvent e)
              if(e.getSource() == b1)
                   pencere_islemi();
         // pencere koyma k?sm? .. begin                               
         public void pencere_islemi() {     
              ctn = this;
              ctn.setEnabled(false);
              TestFocus2 fpen = new TestFocus2();
              //aPenKreKart.aTemelPencere.setVisible(true); //buras?          
              //aPenKreKart.aTemelPencere.addPenHesapListener(new PenHesapListener() {
              fpen.addPenHesapListener(new PenHesapListener() {
                        // metod      tamam_actionPerformed begin...          
                        public void tamam_actionPerformed(java.util.EventObject newEvent) {
                             ctn.setEnabled(true);
                             ctn.requestFocus();
                             // Problem is when we comment the below line it works .....
                             f1.requestFocus();
                             System.out.println("tamam");
                        // metod      tamam_actionPerformed end...          
                        // metod      iptal_actionPerformed begin...          
                        public void iptal_actionPerformed(java.util.EventObject newEvent) {
                             ctn.setEnabled(true);
                             ctn.requestFocus();
                             System.out.println("iptal");
                        // metod      iptal_actionPerformed begin...          
         // pencere koyma k?sm? .. end                               
         public static void main(String x[])
              TestFocus gen01 = new TestFocus();

Maybe you are looking for