Forum Discussion

hbjastad's avatar
hbjastad
Contributor
8 years ago

HeadlessException when deploying war file

I have created a war file using Ready!API, and then I want to deploy it to Jetty. This works fine on a Windows machine, but when I try to do it in Jenkins (running Linux) I get:

 

[INFO] An exception was caught and reported. Message: java.awt.HeadlessException
java.awt.HeadlessException
	at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:204)
	at java.awt.Window.<init>(Window.java:536)
	at java.awt.Frame.<init>(Frame.java:420)
	at java.awt.Frame.<init>(Frame.java:385)
	at javax.swing.SwingUtilities$SharedOwnerFrame.<init>(SwingUtilities.java:1758)
	at javax.swing.SwingUtilities.getSharedOwnerFrame(SwingUtilities.java:1833)
	at javax.swing.JOptionPane.getRootFrame(JOptionPane.java:1696)
	at javax.swing.JOptionPane.getFrameForComponent(JOptionPane.java:1612)
	at com.jp.protection.gui.dialogs.LicenseErrorDialog.<init>(LicenseErrorDialog.java:49)
	at com.jp.protection.gui.dialogs.DefaultLicenseAdapter.<init>(DefaultLicenseAdapter.java:56)
	at com.jp.protection.pub.launch.ProtectionLauncher.initLicenseListener(ProtectionLauncher.java:128)
	at com.jp.protection.pub.launch.HeadlessProtectionLauncher.init(HeadlessProtectionLauncher.java:189)
	at com.jp.protection.pub.launch.ProtectionLauncher.init(ProtectionLauncher.java:113)
	at com.smartbear.ready.license.protection.HeadlessProtectionLauncherAdapter.init(HeadlessProtectionLauncherAdapter.java:93)
	at com.smartbear.ready.license.protection.SoapuiProtectionSupport.a(SoapuiProtectionSupport.java:124)
	at com.smartbear.ready.license.protection.SoapuiProtectionSupport.initProtectionLauncher(SoapuiProtectionSupport.java:103)
	at com.smartbear.ready.license.protection.SoapuiProtectionSupport.<init>(SoapuiProtectionSupport.java:70)
	at com.smartbear.ready.license.LicenseModule.configure(LicenseModule.java:29)
	at com.google.inject.PrivateModule.configure(PrivateModule.java:97)
	at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
	at com.smartbear.ready.license.headless.HeadlessLicenseInitializerModule.configureModule(HeadlessLicenseInitializerModule.java:47)
	at com.smartbear.ready.license.LicenseInitializerModule.configureModule(LicenseInitializerModule.java:31)
	at com.smartbear.ready.license.headless.HeadlessLicenseInitializerModule.configure(HeadlessLicenseInitializerModule.java:39)
	at com.google.inject.AbstractModule.configure(AbstractModule.java:59)
	at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
	at com.google.inject.spi.Elements.getElements(Elements.java:101)
	at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:133)
	at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
	at com.google.inject.Guice.createInjector(Guice.java:95)
	at com.google.inject.Guice.createInjector(Guice.java:72)
	at com.google.inject.Guice.createInjector(Guice.java:62)
	at com.eviware.soapui.mockaswar.MockAsWarProServlet$MockServletSoapUIProCore.<init>(MockAsWarProServlet.java:69)
	at com.eviware.soapui.mockaswar.MockAsWarProServlet.initMockServiceParameters(MockAsWarProServlet.java:33)
	at com.eviware.soapui.mockaswar.MockAsWarServlet.init(MockAsWarServlet.java:75)
	at javax.servlet.GenericServlet.init(GenericServlet.java:244)
	at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:640)

 

I can see that the exception comes when doing some licensing checking, so I have the following questions:

 

1. Should a war file created with Ready!API be possible to run in Jetty without having a Pro license?

- If yes, then why does it fail on a headless server?

- If no, then why doesn't it fail on a Windows machine?

 

2. Jenkins has already specified -Djava.awt.headless=true, what else can be done to avoid the exception?

3 Replies

    • hbjastad's avatar
      hbjastad
      Contributor

      Hi Rao, you're right that a license is required to run the Ready!API GUI application.

      However, my question is about deploying/running a war file created from SoapUI/Ready!API - as you can see from my post, this works well when running on Windows, but fails when running on a headless Linux server. So I'm hoping to get some insight from SmartBear - is it a bug that it's working on Windows or is it a bug that it's not working headless?

      • hbjastad's avatar
        hbjastad
        Contributor

        A bit more trial and error indicates that:

         

        • A war file generated by Ready!API requires a license to be used
          • This means that it's a bug when I can use the war file without a license on Windows
          • It also means that giving a HeadlessException on Linux is ridiculous, when the problem is a missing license
        • A war file generated by the open source version of SoapUI does NOT require a license to be used
          • Learning point: Even if using (a licensed) Ready!API to design tests and virts, you should use SoapUI Open Source to generate the war - that way making it possible to use the war without licensing restrictions

        It would be good if someone from SmartBear could clarify/comment/confirm the above observations.