Netbeans webservice client works only when running from IDE - java

Using Netbeans 6.8 and metro 2.0 I have written a simple application that makes calls to a webservice and displays the results in java swing components. When I run the application in the Netbeans IDE (using F6), the application works perfectly.
However, when I attempt to run the compiled application from the .jar file in the dist folder, my swing UI comes up, but when I press the button that causes my web service to be called, nothing happens.
Anyone know how I can get this to work?

Try running in a terminal window (CMD.EXE) to see if there are any exceptions printed to the console.
Does your action listener work when stand alone? Confirm by printing a message to System.out.

Related

JFrame not loading when Jar is launched through Windows Service

I installed my program in a Jar file as a Windows Service using Apache Procrun.
When I run it using the command start "prunsrv.exe //TS//TestService" it runs perfectly. But when I start the service in Windows services program, it doesn't launch the JFrame.
Yet the application does start as I can see the log entries. But related to the JFrame section, there are no exceptions yet it doesn't launch. Why does it not launch?
Your service is not permitted to use the desktop, if it does not run as the current user (the owner of the desktop).
If so, the first call to Dialog.open() or other methods which paint on the desktop just hangs.

Java Web Start doesn't launch my .jar without enabling the "show console"

As stated in the title, my software won't launch unless the "Show console" option is selected in Java settings. I'm not sure what kind of code you'd like me to post, so please ask.
When I try to run it, the Java dialog pops up and the progress bar that loads the software completes before it closes. When the console is up, the software finally loads and displays afterwards. Without the console, nothing happens.
I've tried to run the web start on different computers, and they all had the same problem. The console doesn't print out any error messages, so I don't have anything to use for debugging the problem.
Some information about the software:
It's a JavaFX project, compiled using Oracle jdk 1.7.0_65 on OS X with Netbeans. It requires full security permission, and all jars (I use a bunch of libraries) are being signed using a key store from a trusted vendor.
EDIT
I tried to launch my program through console using the following command: javaws -viewer http://www.website.com/software.jnlp, and - without launching my software - it returned the following result to the terminal:
java.lang.NullPointerException
at sun.awt.SunToolkit.getSystemEventQueueImplPP(SunToolkit.java:1003)
at sun.awt.SunToolkit.getSystemEventQueueImplPP(SunToolkit.java:998)
at sun.awt.SunToolkit.getSystemEventQueueImpl(SunToolkit.java:993)
at java.awt.Toolkit.getEventQueue(Toolkit.java:1749)
at java.awt.EventQueue.invokeLater(EventQueue.java:1245)
at javax.swing.SwingUtilities.invokeLater(SwingUtilities.java:1290)
at com.oracle.deploy.update.UpdateCheck.updateStateChange(Unknown Source)
Could this be of any help?
For others who might have this problem, this is what caused it for me:
I had a thread running in the background that would show the stage once it was done loading all the assets. This stopped the whole thing from executing, so I had to change the loading logic inside of my code instead to allow for the primary stage to use the show-method in the UI-thread.

javafx jscript runtime error

When running the sample java fx applications or making my own fx application in netbeans I get a message before the software runs that is titled Microsoft JScript runtime error. The message says Automation server can't create object. After I press okay I can get to my application. I have set up my java proxy and netbeans proxy and don't understand why this stop pops up. This happens when running throught command line (java -jar syntax) or through netbeans, the only way to avoid it is by running the application as through the java webstart. I am behind a firewall, is this related to my message or am I chasing down the wrong path?

How do I run multiple instances of a JMS program in Eclipse?

I copied a sample Chat application from http://onjava.com/pub/a/onjava/excerpt/jms_ch2/index.html?page=2 I also got it to compile and run under GlassFish. Unfortunately to see the program in action you need to run multiple instances of it, passing different user names as command line arguments.
I know how to pass command line arguments to a program in Eclipse. I can also run different configuration settings for the same program at once. But instead of opening a different Console window, Eclipse uses the same console window for everything (including the GlassFish server). To make matters worse, Eclipse switches between the different users automatically. That is, once I type a message in the Chat application under one user name and press Enter, Eclipse will automatically switch to different user's console window.
I need distinct console windows for each instance of the program that I run. Is there a way to do this in Eclipse? Alternatively, is it possible to start the GlassFish server in Eclipse and then run the program outside of Eclipse? (Note: The GlassFish server was installed through Eclipse, not as a separate server).
You can run a server in Eclipse and then run your program outside of Eclipse.
For the console: Each application you run in Eclipse gets its own console window. You can switch them with one of the icons in the console view (it looks like a monitor). However, Eclipse "reuses" console windows of terminated applications.
If you want to have multiple side-by-side, see In Eclipse, can I have multiple Console views at once, each showing a different Console?
Eclipse always switches to the "active" console in its stack of consoles. You can turn this behavior off with "Show Console When Standard Output Changes" icon.

Java service wrapper to create service for Java UI application

I have created a Java application which needs to run as a service. For service wrapper I tried using tanuki and other wrapper softwares.
Now, my application does run as a service - however, it runs as a service under SYSTEM and not under currently logged in user.
My application has a UI, which does not show when the application is running as a service. I doubt that this has happened because the service is running under SYSTEM and not under currently logged in user.
When I run the application (without installing it as a service), the UI does show up and I could see the java process running under the current user's id, whereas it runs under SYSTEM when installed as a service.
Now, there is nothing to my application if there is no UI. I need to application to run as a service when the system boots up and the UI needs to show up as well.
Has anyone tried to do what I am doing here and has faced a similar issue. If so, how did you go about resolving it?
Is there a different wrapper service that I could use and not have this issue.
Tanuki's documentation does explain setting a java application as a service, but does not talk about a java applicaiton with a UI and running it under the currently logged in user.
Update
Just so that folks here could get a bit more idea as to what is it that I am trying to accomplish - the behavior that I am trying to have with my app is similar to how Dropbox or Yahoo Messenger or any other software has which starts with Windows boot and continues to run in the background, allowing the users to interact with it using the system tray icon. So basically all of this has been built in Java/Swing. Now when it has come to deployment of the app - I can run it standalone but running the jar file or by creating and running an executable wrapper for it. However, I want the software to start with Windows boot and continue to run as a service in the background, while allowing the user to make changes and interact with it via lets say bringing up the UI from a system tray icon that it sets.
As of now, it does run as a service successfully. It performs all the actions that it ideally should - there just is no system tray icon to bring up the UI and make changes to its configuration.
Update - 2
Ok.. I tried advanced installer and it does wrap up everything for me to generate an exe installer for windows. Now all I need is to auto-start the software. Can anyone help me with this? I don't see an option in Advanced installer to automatically have the program add itself up in the auto-start.
Link to tanuki's doc http://wrapper.tanukisoftware.com/doc/english/faq.html
Rohan,
Please take a look at the following page:
http://wrapper.tanukisoftware.com/doc/english/prop-ntservice-interactive.html
You will need to mark the Service as interactive and then run as the SYSTEM user in order to get your GUI to show up on the first logged in desktop.
The problem is that Microsoft changed what services are allowed to do starting with Windows 2008 and Vista. This means that starting with these versions, the GUI will always show up on a sandboxed desktop which the user will need to switch over to.
If you want to show a GUI on all desktops, in all versions of Windows, you will need to run the JVM within the desktop.
Cheers,
Leif
I wanted to comment on your question, but I don't have enough reputation to do it. So I'm misusing the answer function now.
I have a similar problem. I used the tanuki wrapper for a while now on a Windows XP machine and the Swing GUI was shown to all users who logged in.
Now I migrated to Windows 2008 Server and configured the current version of the tanuki wrapper like this:
wrapper.ntservice.interactive=true
wrapper.ntservice.hide_console=true
(see documentation here and here)
The Windows service runs under the LOCAL SYSTEM account.
But the GUI is still not shown. Did you find any solution to the problem?
Don't think you should have a UI with a service. Put it in the startup group instead ?
What's does the UI and application do?

Categories

Resources