Java Persistency problem

I need to read data from existing SAP built-in table called MLICHECK which contains Netweaver Lincense info. But i ran into problem because Java dictionary required the table's name to have a namespace, ie, XXXX_tablename. Btw, i'm using entity bean. Is there workaround to do it?

Hi Maksim,
I got the "table MLICHECK Unknown" error. I guess the MLICHECK was created by N01 user, but doesnt allow any other user to access it. Unfortunetely, j2ee application default user is SAPN01DB.
I put the jdbc connection in the Entity Bean. The error occured when executing this:
String query = "select * from MLICHECK";
ResultSet rs = stmt.executeQuery(query);
i'm using the default data source.
Anything i can do to solve it without manually changing the table's permission property?
Message was edited by: julius

Similar Messages

  • Persistant problems with FF 27.0.1 on Windows 7/64

    I seem to have a persistent problem with Firefox 27.0.1 and my MSN homepage. When I open FF, it takes me to both my Outlook Mail page and My MSN pages in two separate tabs. Outlook Mail had a problem taking my correct password, but that issue seems to have resolved itself (I did clear all cookies and caches related to the website). But My MSN is still giving me this message...
    "The page you have requested cannot be found.
    The web page you were attempting to view may not exist or may have moved — try checking the web address for typos."
    I tried the same thing as I did with Outlook (deleted cookies and caches), but the problem persists. I disabled all plugins, and still no luck. The MSN Homepage comes up, and I'm shown as logged into My MSN, but when I click the My MSN link, I get the "The page you have requested..." message.
    Another issue relating to both websites is password remembering. FF will NOT ask to remember the passwords for those sites. I have Remember Passwords box checked in Settings and it does for other sites, but not my Homepage(s). Clearing cookies/caches didn't help, and the password is not listed in the Remembered Passwords page of Settings.
    Finally, Firefox on my home laptop (Windows 7/64 as well) freezes and crashes a lot, as well as displayes a warning there is something with Flash, which I have updated many times over.
    I used to use Internet Explorer as a browser exclusively until I started having problems with certain websites not allowing me to log in. I realized it was not the website, but some incompatibility with IE. I started using Firefox, and fouind no problems, and heard it was more secure and easier to configure than Internet Explorer anyway. But since these problems started occurring (especially with NO way for me to log onto My MSN), I have to go back to using IE (except for select website logons), which is disappointing :-(.

    About your home page; Manually set up Firefox with the window(s) and tab(s)
    the way you want them to be. Then;
    '''''Firefox Options > General > Homepage'''''.
    Press the button labeled ''''Use Current'''.'
    =====================================
    Open a new window or tab. In the address bar, type '''''about:config'''''.
    If a warning screen comes up, press the '''''Be Careful''''' button.
    This is where Firefox finds information it needs to run.
    At the top of the screen is a search bar. Enter '''''browser.newtab.url'''''
    and press enter. '''''browser.newtab.url'''''
    tells Firefox what to show when a new tab is opened.
    If you want, right click and select '''''Modify'''''. You can change the
    setting to;<BR><BR>about:home (Firefox default home page),<BR>
    about:newtab (shows the sites most visited),<BR>
    about:blank (a blank page),<BR>
    or you can enter any web page you want.<BR><BR>
    The same instructions are used for the new window setting, listed as
    '''''browser.startup.homepage'''''.

  • Java Session problem while sending mail(using javamail) using Pl/SQL

    Hello ...
    i am using Java stored procedure to send mail. but i'm getting java session problem. means only once i can execute that procedure
    pls any help.

    props.put("smtp.gmail.com",host);I doubt javamail recognizes the 'smtp.gmail.com' property. I think it expects 'mail.host'. Of course since it cannot find a specified howt it assumes by default localhost
    Please format your code when you post the next time, there is a nice 'code' button above the post area.
    Mike

  • Java Programming Problem

    Hi all,
    I was looking for this java programming problem which had to do with a large building and there was some gallons of water involved in it too somehow and we had to figure out the height of the buiding using java. This problem is also in one of the java books and I really need to find out all details about this problem and the solution. NEED HELP!!
    Thanks
    mac

    Yes, it will. The water will drain from the bottom of
    the tank until the pressure from the water inside the
    tank equals the pressure from the pipe. In other
    words, without a pump, the water will drain out until
    there is the same amount of water in the tank as in
    the pipe The water pressure depends on the depth of the water, not the volume. So once the depth of the water inside the pipe reaches the same depth as the water inside the tank it will stop flowing. This will never be above the height of the tank.
    I found this applet which demonstrates our problem. If you run it you can drag the guy up to the top, when water in his hose reaches the level of the water in the tank it will stop flowing out.

  • Java Uninstall Problem

    Java Uninstall Problem
    This all came about because of a failed uninstall, using Your Uninstaller.
    The {Java runtime which is all I want) is not listed now & I tried all the other fix bad uninstall type features, all to no avail.} )
    When I DL & run the latest package (jxpiinstall-6u11-fcs-bin-b90-windows-i586-25_nov_2008.exe}
    & run it I get:
    1st message:
         "This software has already been installed on your computer.
         Would you like to install it?"
    If I say no, it exits.
    If I say yes, I get this second message:
         :This action is only valid for products that are currently installed."
    So Now I have no Java & have no idea what to do.
    Any help would be greatly appreciated.
    Thanks, Neuromancer23

    Sorry...after posting it i realized there was a more appropriate forum, of which it took quiet awhile to find.)
    Now that I know where to find the forum list I will never double-post again.
    I'll close the question if I can

  • Which is better? JDO or Java Persistance API?

    Hi folks
    I'm trying to build an app on Google's cloud service.
    Looking into this ( [http://code.google.com/appengine/docs/java/overview.html|http://code.google.com/appengine/docs/java/overview.html]), it tells me that for java projects there are 2 possibilities for persistance - JDO , and Java Persistance. Does anyone have any advice on which is better and/or easier? Also, if anyone has a small example they could post, that would be very useful too.
    this isn't exactly a JDBC question, and maybe this should be posted somewhere else? If so please tell me where I should be asking this question.
    Thanks!
    -Tom

    I personally find Java Persistence to be easy to use and it works just fine.
    I can't say if you would agree. You'll just have to judge that for yourself, which means: put some effort into trying it out. I'd start by not requesting small examples in a forum, but by actually looking for them yourself using your search engine of choice.

  • Sun Java security problems

    Please any one tel me about Sun Java security problems
    with Desktop application

    Hi.
    If you're using SSGD 4.41, please download the Admin guide from here:
    http://docs.sun.com/app/docs/doc/820-4907
    There, at page #41 you'll find useful info concerning "Client Connections and Security Warnings".
    Hope this helps,
    Rob

  • OS X Lion - JAVA SCRIPT PROBLEM

    I recently updated from Snow Leopard to OS X Lion. Now I seem to have a JAVA Script problem. Where do I start fixing this issue. I have checked updates etc etc but it seems to be updated. However, when I login to my web site backend, I have a problem. Any advice please?

    Would you please write some more details? explain the problem and what web site backend you use. Thanks.

  • Java Server Problem

    I am using Secure Global Desktop Enterprise Edition (4.0) on Fedora Core 3
    Linux.
    Sometime, the system shows the following error message when I click the
    application.
    Starting...
    Locating session...
    Couldn't start application. Please inform an Administrator.
    Error code: 17
    Details: javax.naming.NoPermissionException [Root exception is
    java.lang.SecurityException: Cannot list directory.]
    I had checked the Server log and I found the error message in
    jserver20936_error.log as follow:
    2005/07/31 04:51:03.756     (pid 20936)     audit/license/error     #1122756663756
    Tarantella Secure Global Desktop Enterprise Edition (4.0) ERROR:
    An exception occurred writing to the file
    /opt/tarantella/var/info/licenseuse/namestamp
    java.io.FileNotFoundException:
    /opt/tarantella/var/info/licenseuse/new.namestamp (Too many open files)
         at java.io.RandomAccessFile.open(Native Method)
         at java.io.RandomAccessFile.<init>(RandomAccessFile.java:204)
         at com.sco.tta.server.license.LicenseFile.newFile(LicenseFile.java:362)
         at
    com.sco.tta.server.license.UsagePersister.writeUsageToDisk(UsagePersister.java:642)
         at
    com.sco.tta.server.license.UsagePersister$1.run(UsagePersister.java:851)
         at java.lang.Thread.run(Thread.java:534)
    The information written to this file will be invalid. This may cause
    more licenses to be consumed than should be.
    Check there is enough free disk space, and that the file exists.
    If the file does not exist, restart the server.
    2005/07/31 04:52:05.929     (pid 20936)     server/server/error     #1122756725929
    Tarantella Secure Global Desktop Enterprise Edition (4.0) ERROR:
    A server socket accepting connections has encountered an unexpected error.
    The Exception was: java.net.SocketException: Too many open files
         at java.net.PlainSocketImpl.socketAccept(Native Method)
         at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:353)
         at java.net.ServerSocket.implAccept(ServerSocket.java:448)
         at
    com.sco.cid.net.BufferedServerSocket.accept(BufferedServerSocket.java:37)
         at com.sco.cid.net.MultiServerSocket.accept(MultiServerSocket.java:265)
         at com.sco.tta.server.server.ServerTask.runTask(ServerTask.java:396)
         at com.sco.tta.server.server.Task.run(Task.java:122)
         at com.sco.cid.common.WorkerPool$Worker.run(WorkerPool.java:524)
         at java.lang.Thread.run(Thread.java:534)
    The server will attempt to create a new socket to handle new connections.
    If this happens frequently it may indicate a problem with resources on the
    server.
    2005/08/01 08:19:11.491     (pid 20936)     server/server/fatalerror     #1122855551496
    Tarantella Secure Global Desktop Enterprise Edition (4.0) FATAL ERROR:
    JServer error: java.lang.NoClassDefFoundError:
    com/sco/tta/common/jndi/auth/ResourceMapper
         at com.sco.tta.server.glue.BaseCtx.setExtendedError(BaseCtx.java:109)
         at
    com.sco.tta.server.glue.SearchAsadOp.handleResults(SearchAsadOp.java:518)
         at
    com.sco.tta.server.glue.SearchAsadOp.doDownSearch(SearchAsadOp.java:273)
         at com.sco.tta.server.glue.SearchAsadOp.search(SearchAsadOp.java:130)
         at com.sco.tta.server.glue.AsadOpHandler.search(AsadOpHandler.java:212)
         at
    com.sco.tta.server.server.asad.AsadCalcTask.search(AsadCalcTask.java:910)
         at
    com.sco.tta.server.server.asad.AsadCalcTask.processEnvelope(AsadCalcTask.java:198)
         at com.sco.tta.server.server.CalcTask.runTask(CalcTask.java:125)
         at com.sco.tta.server.server.Task.run(Task.java:122)
         at com.sco.cid.common.WorkerPool$Worker.run(WorkerPool.java:524)
         at java.lang.Thread.run(Thread.java:534)
    There may be a problem with the JVM.
    The server will exit.
    Check the logs for more information.
    What happen? How could I fix the error?

    Dear Barrie,
    I am using Fedora Core 3 Linux.
    The Tarantella Secure Global Desktop Enterprise Edition(4.0) have 20
    concurrent user license.
    Normally, about 10 users would access the application through Secure
    Global Desktop Enterprise Edition.
    Could I use the license of Tarantella EE 4 to upgrade to Tarantella EE 4.1
    PW Ng
    barrie wrote:
    Hi Ng
    Sorry, I forgot to ask whether you are using Solaris or Linux? I don't
    think Solaris has an upper limit for this value but I'm less sure about
    Linux. I would make sure all tta processes have been terminated and try
    again.
    My feeling is that you shouldn't really be using 4096 files in a single
    process -- not unless you're system is very very large. In 4.0 there is
    a problem with the 1.5 JVM holding on to references that keep files open for
    longer than is necessary and potentially leads to a loss of service by
    keeping too many files open. 4.1 has a fix for this. I think there is a
    good chance this may be your problem aswell.
    Barrie
    On 2005-08-09, Ng Ping Wah <[email protected]> wrote:
    Dear Barrie,
    When i set the file descriptor to 8192 and restart the server, I found the
    error log has follow error message:
    2005/08/09 08:13:46.265     (pid 31540)     pem/circuit     #24
    Tarantella Secure Global Desktop Enterprise Edition(4.0) ERROR:
    An error occurred reading on circuit fdcircuit. Reason: (9) Bad file
    descriptor.
    The current operation has failed.
    If persistent, restart the server.
    2005/08/09 08:13:46.266     (pid 31540)     pem/circuit     #26
    Tarantella Secure Global Desktop Enterprise Edition (4.0) FATAL ERROR:
    The program has encountered an error that means it cannot continue.
    It will now exit. A technical description is given below to help
    establish the cause.
    Error/EOF on file descriptor circuit. Killing PE Manager.
    Services unavailable.
    Restart the server.
    Is the value '8192' too large ?
    What is the Suitable value ?
    best regards
    PW Ng
    barrie wrote:
    Hi Ng,
    Yes, you've run out of files. But, this ulimit thing is already done by
    the SGD EE start up files. What you can do is edit the tuning properties
    of the server in ArrayManager. By default, this should be 4096 but you
    can try increasing this here. You may also change the value of
    rlim_fd_max in /etc/system on Solaris, although the value given in the
    arraymanager should override the setting in /etc/system.
    It's unusual to use this many files, you may be seeing a file descriptor
    leak that was in 4.0 and may be causing this problem, the problem is
    subtle and doesn't necessarily effect all users. I recommend you upgrade
    to 4.1 though.
    Regards
    Barrie
    On 2005-08-04, Rob <[email protected]> wrote:
    PW Ng wrote:
    I am using Secure Global Desktop Enterprise Edition (4.0) on Fedora
    Core 3
    Linux.
    Sometime, the system shows the following error message when I click the
    application.
    Starting...
    Locating session...
    Couldn't start application. Please inform an Administrator.
    Error code: 17
    Details: javax.naming.NoPermissionException [Root exception is
    java.lang.SecurityException: Cannot list directory.]
    I had checked the Server log and I found the error message in
    jserver20936_error.log as follow:
    2005/07/31 04:51:03.756     (pid 20936)     audit/license/error     #1122756663756
    Tarantella Secure Global Desktop Enterprise Edition (4.0) ERROR:
    An exception occurred writing to the file
    /opt/tarantella/var/info/licenseuse/namestamp
    java.io.FileNotFoundException:
    /opt/tarantella/var/info/licenseuse/new.namestamp (Too many open files)[snip]
    I think the "Too many open files" may give you a clue.
    Try by editing the SGD EE startup files (either under /etc/init.d or in
    the /opt/tarantella/bin/scripts folder) and adding the
         ulimit -n 4096
    statement. Of course, 4096 is just an example; find your "maximum number
    of open file descriptors" limit and raise it accordingly.
    Best,
    Rob

  • Jdk1.2.2 java commands problem on win98, win2000 and XP

    To Whom It May Concern:
    I have just bought a new PC and made 3 partitions on the hard drive, each of them has 10G space, to installed 3 operation systems on each of these partitions, win98se, win2000 and XP. Then I installed jdk1.2.2 on each of these operation systems. However, when I go into the �\jdk1.2.2\bin directory and run the executable commands, eg. javac and java etc., get the following different error messages on different operating systems. I have spent a lot of time on trying to fix these problems, however, no any luck. It will be very appreciated if you super expert can have some help on them.
    win98se
    After run the javac command, get the following error message displayed on a prompt with a Close and a Details buttons.
    This program has performed an illegal operation and will be shut down.
    If the problem persists, contact the program verdor.
    After click the Details button, get the following message:
    JAVA caused an invalid page fault in
    module SYMCJIT.DLL at 019f:500bf974.
    Registers:
    EAX=00000e03 CS=019f EIP=500bf974 EFLGS=00010206
    EBX=006539a0 SS=01a7 ESP=0063f894 EBP=00000e7f
    ECX=0000009f DS=01a7 ESI=00000e7f FS=3557
    EDX=00000003 ES=01a7 EDI=05110010 GS=0000
    Bytes at CS:EIP:
    f3 a5 ff 24 95 48 42 0c 50 8d 49 00 8d 74 31 fc
    Stack dump:
    500bf8c7 0000027f 500c42b0 5007cc24 05110010 00000e7f 0000027f 007608c0 00000283 006a81a8 006539a0 0063f940 006539e8 05110010 006539a0 00000e7f
    win2000
    After run the javac command, get the following error message displayed on a prompt with a OK button.
    java.exe has generated errors and will be closed by Windows. You will need to restart the program.
    An error log is being created.
    XP
    After run the javac command, get the following error message displayed on a prompt with a Send Error Report and Don't Send buttons.
    java.exe has encountered a problem and needs to close. We are sorry for the inconvenience.
    If you were in the middle of something, the informaiton you were working on might be lost.
    Please tell Micorsoft about this problem.
    We have created an error report that you can send to us. We will treat this report as confidential and enonymous.
    To see what this error report contains, click here.
    thanks and regards!
    ZhiCheng

    http://java-virtual-machine.net/tech-faq.html
    is a great link.
    It claims to have a newer, fixed version of problem DLL, SYMCJIT.DLL . Try that.
    The page has an Intel link that is out-of -date. The current Intel link is
    http://support.intel.com/support/processors/pentium4/sb/CS-007990.htm
    "CPUID detection for Intel� Pentium� 4 processor system"
    In two lines, they recommend:
    dir /s SYMCJIT.DLL
    ren SYMCJIT.DLL SYMCJIT.OLD
    Of course, Java will run slower, but JIT is a machine-specific concept and this *.DLL was coded to fail if it did not recognize the CPU type. Maybe not a great decision, but there you are.

  • Persist problem in cascade using @OneToMany

    We are trying to persist an object which has a OneToMany relationship to other objects with CascadeType.ALL
    When we persist, the log shows that it creates the INSERT statement with the correct bind variables (sequence-generated REPORT_ID, etc.) for the first object.
    The problem happens when it tries to cascade and insert the Many part. The log shows the it tries to create the INSERT statement for the second object but the bind variable for the REPORT_ID is null.
    Since we defined the relationship of the OneToMany using the REPORT_ID, we assumed that the REPORT_ID that was auto-generated for the first object would be used for the @Many objects.
    What are we missing ??????
    First Object:
    @Id
    @SequenceGenerator(name = "REPORT_HEADER_S", initialValue = 1, allocationSize = 1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "REPORT_HEADER_S")
    @Column(name = "REPORT_ID", nullable = false)
    private Long reportId;
    @OneToMany(mappedBy = "report", cascade = { CascadeType.ALL})
    private List<Summary> summaryList;
    Second Object
    @ManyToOne
    @JoinColumn(name = "REPORT_ID", referencedColumnName = "REPORT_ID")
    private Report report;

    Hello, Chris.
    Thank you for your reply.
    The structure of my tables is:
    table document (id int not null constraint document_pk primary key,
    table document_price (document_id int not null constraint document_price_fk references document (id),
    date date not null default current_date,
    price decimal(9,2) not null,
    primary key (document_id, date)).
    The entity classes are:
    @Entity @Table(name = "DOCUMENT")
    public class Document implements Serializable {
    @TableGenerator(name = "document_generator", table = "ID_GENERATION", pkColumnName = "TABLE_NAME", valueColumnName = "ID_VALUE",
    pkColumnValue = "DOCUMENT", allocationSize = 1)
    @Id
    @GeneratedValue(generator = "document_generator")
    @Basic(optional = false)
    @Column(name = "ID")
    private Integer id;
    // other fields
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "document", fetch = FetchType.LAZY)
    private Collection<DocumentPrice> documentPriceCollection;
    // constructors, getters, setters ...
    @PostPersist
    public void initializePrices() {
    for (DocumentPrice dp : documentPriceCollection) {
    dp.documentPricePK.setDocumentId(id);
    @Entity
    @Table(name = "DOCUMENT_PRICE")
    public class DocumentPrice implements Serializable {
    @EmbeddedId
    protected DocumentPricePK documentPricePK;
    @Basic(optional = false)
    @Column(name = "PRICE")
    private BigDecimal price;
    @JoinColumn(name = "DOCUMENT_ID", referencedColumnName = "ID", insertable = false, updatable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Document document;
    // constructors, getters, setters ...
    @Embeddable
    public class DocumentPricePK implements Serializable {
    @Basic(optional = false)
    @Column(name = "DOCUMENT_ID")
    private int documentId;
    @Basic(optional = false)
    @Column(name = "DATE")
    @Temporal(TemporalType.DATE)
    private Date date;
    // constructors, getters, setters ...
    I create first Document entity, create DocumentPrice entity and add DocumentPrice entity to the documentPriceCollection of the first Document entity. I invoke commit method of my entity manager, and corresponding rows are added to the document and document_price tables.
    I invoke clear method of my entity manager.
    Then I create new entities Document and DocumentPrice and add new DocumentPrice entity to the documentPriceCollection of the new Document entity. I invoke commit method and get the following exception:
    oracle.toplink.essentials.exceptions.ValidationException
    Exception Description: Cannot persist detached object [entities.DocumentPrice[documentPricePK=.entities.DocumentPricePK[documentId=0;
    date=Sat May 29 00:00:00 MSD 2010];
    price=11]].
    Class> entities.DocumentPrice Primary Key> [2010-05-29, 0]
    at oracle.toplink.essentials.exceptions.ValidationException.cannotPersistExistingObject(ValidationException.java:2171)
    at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.registerNotRegisteredNewObjectForPersist(UnitOfWorkImpl.java:3251)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.registerNotRegisteredNewObjectForPersist(RepeatableWriteUnitOfWork.java:339)
    at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:3220)
    at oracle.toplink.essentials.mappings.CollectionMapping.cascadeRegisterNewIfRequired(CollectionMapping.java:265)
    at oracle.toplink.essentials.internal.descriptors.ObjectBuilder.cascadeRegisterNewForCreate(ObjectBuilder.java:1294)
    at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:3226)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl.persist(EntityManagerImpl.java:205)
    And I see through debugging that @PostPersist method of the Document entity isn't invoked during second commit before the exception is generated.
    What should I do to avoid exception during second commit?

  • Adobe Dreamweaver CS5.5 - Windows 7 - Java Script Problem

    I am having trouble with Anchor.htm.
    When I try to insert an anchor in the text (Insert > Named Anchor> I get this error message:
    "While executing insertObject in Anchor.htm a Java Script error occurred."
    I recently downloaded both the 32- and 64-bit Java Script applications when I received a message that the existing version of Java Script was out-of-date. Anchor.htm worked before I installed the update.
    The files I downloaded and installed are:
    jre-7u9-windows-i586.exe
    jre-7u9-windows-x64.exe
    Please can anyone help me with this problem?

    From Dreamweaver FAQ
    http://forums.adobe.com/thread/429114
    "If Dreamweaver is acting erratically, or if you see a message saying "the following JavaScript error(s) occurred",  it's usually a sign of a corrupt cache file. The first thing to try should always be to delete the file cache. If that doesn't work, delete your personal Configuration folder. Full instructions are in Deleting a corrupted cache file.
    http://forums.adobe.com/thread/494811"
    Nancy O.

  • Java application problem

    I am using JDK1.4 and working on Windows Xp.
    I have written a code for application in java as follows:
    import javax.swing.*;
    public class sample
    JPanel panel;
    static JFrame frame;
    JButton but;
    public sample()
    frame=new JFrame("frame");
    panel=new JPanel();
    frame.getContentPane().add(panel);
    but=new JButton("click");
    panel.add(but);
    public static void main(String args[])
    sample s=new sample();
    frame.setSize(300,300);
    frame.setVisible(true);
    on executing program application window has appeared and it ran properly.
    Then I closed that application window.But after that in command prompt window curser was just blinking and it was not allow to enter also.
    I have tried pressing CTRL+C also.But situation in command prompt was same i.e curser in command prompt was just blinking.
    Then I closed cmd window ;but one error has occured saying that cmd window can not close .
    My friend has told me that she is also having windows xp and JDK1.4 ; ctrl+c is working properly in her command prompt.She has written the above same code in her computer and it executes properly.
    Even though she has not written following statement:
    "frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);"
    when she exits from application window ,her cmd window gave same problem of only blinking curser.But when she press CTRL+C ; her command prompt starts responding by giving root.But my command prompt is not giving
    positive responce to "ctrl+c" when I am exiting java application.
    Is it possible to solve this problem without giving statement
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ?
    Why my command prompt is not responding to CTRL+c?
    How can I tackle this problem ?
    Is there any other key which can be used in command prompt of Windows Xp?

    Is it possible to solve this problem without giving
    statement
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    ?this is because Swing have started some non-daemon helper threads for its internal purposes and the default close operation for frame is just HIDE_ON_CLOSE. So, the system will not exit because those non-daemon thread still not terminated.
    What is the problems setting the default close operation to JFrame.EXIT_ON_CLOSE ?

  • Java threading problem... threads only work on 1 processor

    I've got a iterative deepening problem that i have to parallelize. As far as i know i did everything correctly however everything seems to be running on 1 processor instead of 2 processors. As far as i know i am using threads (-Xprof either defines them as thread-1 thread-2 or pool1-thread1,depending on the method used for issueing)
    the worker thread is:
    public int solutionsT(Board board, int currentDepth) {
            int temp = 0;
            int result = 0;
            if (board.distance() == 0) {
               return 1;
            if (board.distance() > board.bound()) {
                return 0;
            Board[] children = board.makeMoves();
            result = 0;
            for (int i = 0; i < children.length; i++) {
                if (children[i] != null) {
                    temp = solutionsT(children, currentDepth + 1);
    if(temp != 0){
    result += temp;
    return result;
    public void run() {
    int temp =0;
    int i = 0;
    while(true){
    while(bag.size() !=0){
    bag.putSolution(solutionsT(bag.get(),1));
    try{   
    barrier.await();
    }catch(Exception e){}
    it get's it's input from a bag that is filled before the iteration begins. (once the bag is filled it trips a barrier) this worker thread is a implementation of Runnable
    This piece of code is used to make the thread object and to issue it
    public SolutionThread(int numberOfThreads) {
       thread = numberOfThreads;
       bag = new bagOfBoards();
       barrier = new CyclicBarrier(thread+1);
       if(thread > 1){
          ExecutorService threadExecutor = Executors.newFixedThreadPool( thread );
          solution = new ThreadTest[thread];
          bag = new bagOfBoards();
          for(int i = 0;i<thread;i++){
             solution[i] = new ThreadTest(bag, lock, barrier, i);
             threadExecutor.execute(solution);
    finally this is the code which is used to acces the bag and get a board.
    synchronized public Board get() {
                if (size > 0) {
                size--;
                Board result = bag[size];
                return result;
            } else {
             return null;
        }since this method is synchronized and it always returns something (either null or a board) and the worker tests for this. there is no race condition here.
    furter more. the main thread is a loop. It fills te bags with an intial state. then it trips the barrier and waits for the workers to do the work. the workers then process the bag until it hits zero and then trip the barrier so that the main thread can do the next iteration (and fill the bag)
    p.s. i know the code is a bit messy, but i want to get the threading to work. As of now i relaly don't understand why the threads are just running on 1 processor instead of 2 processors. not only that. the excecution time is nearly the same as that of a sequential equivalent.
    p.s.2 the code is parallisable. and it is run on a smp system.
    Message was edited by:
    jstrike

    i'm very sure that the jvm and os support smp. the
    problem really should be in the code.I don't see how this can be the case. There's nothing in the Java language that deals with how threads are assigned to processors (at least not as far as I know) so there isn't anything you can do in your code to affect that.
    Or did you meant that i have to tell the jvm in the class that
    there is support for multiple processorsThat would be the only possibility. I have no idea whether it can be done or not, though.

  • Java Threads Problem

    Hi, I am trying to write a simple java threads program where in one thread reads a file and another thread writes the data into a second file....
    Here is my code, although i think i am correct, my program still runs in a sequential fashion help help help!!!
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    class MyThread extends Thread{
    private int a;
    private int c;
    FileInputStream in;
    FileOutputStream out;
    public MyThread(int a){
    this.a = a;
    public void run(){
    if(this.a==5)
         try {
         in = new FileInputStream("Britney.txt");
    } catch (FileNotFoundException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
    try {
         while((c=in.read())!=-1)
              a = (char) c;
              System.out.println(a);
    catch (IOException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
    if(this.a==10)
         try {
              out = new FileOutputStream("romi.txt");
         } catch (FileNotFoundException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
         for(int i = 0;i<50;i++)
              try {
                   System.out.println(c);
                   out.write(c);
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    class MainMyThread{
    public static void main(String args[]){
    MyThread thr1, thr2;
    thr1 = new MyThread(5);
    thr2 = new MyThread(10);
    thr1.start();
    thr2.start();
    }

    Encephalopathic wrote:
    malcolmmc wrote:
    ... Chances of getting any kind of reply except "me too" can be pretty remote. ....there's actually a better chance of getting a reply on a general forum like this one, ....Can't you just post in both the narrow and the general forum, but include links one to the other in each thread? Or is that against the forum rules/etiquette? Most people here are ok with a crosspost IF those links are included.
    I would also ask that the OP designate one of those threads as the real discussion thread and just direct folks there from the other threads, so that we have one coherent discussion. If he does that, there's no problem with trying to reach out to as broad an audience as possible.
    I would figure that if the poster were upfront about what they are doing, folks wouldn't mind, but I could be wrong.I think that's generally the case. As long as the discussion is confined to one thread (and pointed there from the crossposts) or at the very least all the participants can see all the discussions, I think most people don't have a problem with it. It's when we waste our time answering when he's already got the answer elsewhere that's annoying.

Maybe you are looking for