HSener
I'm new here

Service Modul von Ant-Build in Maven umbauen

Hallo Community,

ich bin gerade dabei unser Service Modul in ein Maven-Projekt umzubauen.

Vorgegangen bin ich nach folgender Anleitung

FS Module mit Maven2 bauen

Das Projekt lässt sich auch bauen und installieren. Erhalte jedoch beim Aufruf der Konfiguration im ServerManager folgenden Fehler

ERROR 16.02.2017 09:55:38.293 (de.espirit.firstspirit.client.AbstractGuiHost): ExceptionHandler.uncaughtException() -

java.lang.NullPointerException

FSVersion=5.1.507.70194#4445;JDK=1.8.0_121 32bit Oracle Corporation;OS=Windows 7 6.1 x86;Date=16.02.2017 09:55:38

java.lang.NullPointerException

  at de.kittelberger.module.service.ServiceProviderConfigPanel.initGuiValues(ServiceProviderConfigPanel.java:150)

  at de.kittelberger.module.service.ServiceProviderConfigPanel.getGui(ServiceProviderConfigPanel.java:67)

  at de.espirit.firstspirit.admin.gui.ModuleConfigurationDialog.<init>(ModuleConfigurationDialog.java:51)

  at de.espirit.firstspirit.admin.gui.ModuleConfigurationPanel.openConfigurationDialog(ModuleConfigurationPanel.java:505)

  at de.espirit.firstspirit.admin.gui.ModuleConfigurationPanel.actionPerformed(ModuleConfigurationPanel.java:250)

  at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

  at de.espirit.firstspirit.common.gui.FsButton.fireActionPerformed(FsButton.java:86)

  at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

  at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

  at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

  at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)

  at java.awt.Component.processMouseEvent(Unknown Source)

  at javax.swing.JComponent.processMouseEvent(Unknown Source)

  at java.awt.Component.processEvent(Unknown Source)

  at java.awt.Container.processEvent(Unknown Source)

  at java.awt.Component.dispatchEventImpl(Unknown Source)

  at java.awt.Container.dispatchEventImpl(Unknown Source)

  at java.awt.Component.dispatchEvent(Unknown Source)

  at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

  at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

  at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

  at java.awt.Container.dispatchEventImpl(Unknown Source)

  at java.awt.Window.dispatchEventImpl(Unknown Source)

  at java.awt.Component.dispatchEvent(Unknown Source)

  at java.awt.EventQueue.dispatchEventImpl(Unknown Source)

  at java.awt.EventQueue.access$500(Unknown Source)

  at java.awt.EventQueue$3.run(Unknown Source)

  at java.awt.EventQueue$3.run(Unknown Source)

  at java.security.AccessController.doPrivileged(Native Method)

  at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)

  at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)

  at java.awt.EventQueue$4.run(Unknown Source)

  at java.awt.EventQueue$4.run(Unknown Source)

  at java.security.AccessController.doPrivileged(Native Method)

  at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)

  at java.awt.EventQueue.dispatchEvent(Unknown Source)

  at de.espirit.firstspirit.client.AWTDispatchingEventQueue.defaultDispatchEvent(AWTDispatchingEventQueue.java:161)

  at de.espirit.firstspirit.client.AWTDispatchingEventQueue._dispatchEvent(AWTDispatchingEventQueue.java:138)

  at de.espirit.firstspirit.client.AWTDispatchingEventQueue.dispatchEvent(AWTDispatchingEventQueue.java:131)

  at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

  at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

  at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

  at java.awt.WaitDispatchSupport$2.run(Unknown Source)

  at java.awt.WaitDispatchSupport$4.run(Unknown Source)

  at java.awt.WaitDispatchSupport$4.run(Unknown Source)

  at java.security.AccessController.doPrivileged(Native Method)

  at java.awt.WaitDispatchSupport.enter(Unknown Source)

  at java.awt.Dialog.show(Unknown Source)

  at java.awt.Component.show(Unknown Source)

  at java.awt.Component.setVisible(Unknown Source)

  at java.awt.Window.setVisible(Unknown Source)

  at java.awt.Dialog.setVisible(Unknown Source)

  at de.espirit.common.gui.SelfDisposingDialog.setVisible(SelfDisposingDialog.java:157)

  at de.espirit.firstspirit.admin.gui.ServerDialog.getResult(ServerDialog.java:247)

  at de.espirit.firstspirit.admin.gui.CMSAdminConsole.actionPerformed(CMSAdminConsole.java:985)

  at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

  at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

  at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

  at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

  at javax.swing.AbstractButton.doClick(Unknown Source)

  at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)

  at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)

  at java.awt.Component.processMouseEvent(Unknown Source)

  at javax.swing.JComponent.processMouseEvent(Unknown Source)

  at java.awt.Component.processEvent(Unknown Source)

  at java.awt.Container.processEvent(Unknown Source)

  at java.awt.Component.dispatchEventImpl(Unknown Source)

  at java.awt.Container.dispatchEventImpl(Unknown Source)

  at java.awt.Component.dispatchEvent(Unknown Source)

  at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

  at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

  at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

  at java.awt.Container.dispatchEventImpl(Unknown Source)

  at java.awt.Window.dispatchEventImpl(Unknown Source)

  at java.awt.Component.dispatchEvent(Unknown Source)

  at java.awt.EventQueue.dispatchEventImpl(Unknown Source)

  at java.awt.EventQueue.access$500(Unknown Source)

  at java.awt.EventQueue$3.run(Unknown Source)

  at java.awt.EventQueue$3.run(Unknown Source)

  at java.security.AccessController.doPrivileged(Native Method)

  at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)

  at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)

  at java.awt.EventQueue$4.run(Unknown Source)

  at java.awt.EventQueue$4.run(Unknown Source)

  at java.security.AccessController.doPrivileged(Native Method)

  at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)

  at java.awt.EventQueue.dispatchEvent(Unknown Source)

  at de.espirit.firstspirit.client.AWTDispatchingEventQueue.defaultDispatchEvent(AWTDispatchingEventQueue.java:161)

  at de.espirit.firstspirit.client.AWTDispatchingEventQueue._dispatchEvent(AWTDispatchingEventQueue.java:138)

  at de.espirit.firstspirit.client.AWTDispatchingEventQueue.dispatchEvent(AWTDispatchingEventQueue.java:131)

  at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

  at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

  at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

  at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

  at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

  at java.awt.EventDispatchThread.run(Unknown Source)

Das Projekt hat bei mir folgenden Aufbau

8460_pastedImage_15.png

fsm.xml

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"

          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">

    <id>fsm</id>

    <baseDirectory>/</baseDirectory>

    <formats>

        <format>zip</format>

    </formats>

    <files>

        <file>

            <source>target/${project.artifactId}-${project.version}-jar-with-dependencies.jar</source>

            <outputDirectory>/lib/</outputDirectory>

        </file>

    </files>

    <fileSets>

        <fileSet>

            <!--directory>${project.basedir}/src/main/resources</directory-->

            <directory>target/classes</directory>

            <includes>

                <include>service-provider.conf</include>

                <include>module.xml</include>

            </includes>

            <outputDirectory>/META-INF/</outputDirectory>

        </fileSet>

    </fileSets>

</assembly>

modules.xml

<?xml version="1.0" encoding="UTF-8"?>

<module>

  <name>ServiceProviderModule</name>

  <displayname>Service Provider Module</displayname>

  <version>${project.version}</version>

  <vendor>Company Name</vendor>

  <components>

    <service>

      <name>ServiceProvider</name>

      <displayname>Service Provider</displayname>

      <class>de.company.module.service.ServiceProviderServiceImpl</class>

      <configurable>de.company.module.service.ServiceProviderConfigPanel</configurable>

      <resources>

        <resource scope="module" name="serviceprovider">lib/${project.artifactId}-${project.version}-jar-with-dependencies.jar</resource>

        <resource>META-INF/service-provider.conf</resource>

      </resources>

    </service>

  </components>

</module>

pom.xml

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"

         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>de.company</groupId>

    <artifactId>service-provider</artifactId>

    <version>1.1</version>

    <packaging>jar</packaging>

    <inceptionYear>2017</inceptionYear>

    <properties>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    </properties>

    <build>

        <resources>

            <resource>

                <directory>src/main/resources</directory>

                <filtering>true</filtering>

            </resource>

        </resources>

        <plugins>

            <plugin>

                <groupId>org.apache.maven.plugins</groupId>

                <artifactId>maven-compiler-plugin</artifactId>

                <configuration>

                    <source>1.7</source>

                    <target>1.7</target>

                </configuration>

            </plugin>

            <plugin>

                <artifactId>maven-assembly-plugin</artifactId>

                <executions>

                    <execution>

                        <id>jar-with-dependencies</id>

                        <phase>package</phase>

                        <goals>

                            <goal>single</goal>

                        </goals>

                        <configuration>

                            <descriptorRefs>

                                <descriptorRef>jar-with-dependencies</descriptorRef>

                            </descriptorRefs>

                        </configuration>

                    </execution>

                    <execution>

                        <id>fsm</id>

                        <phase>package</phase>

                        <goals>

                            <goal>single</goal>

                        </goals>

                        <configuration>

                            <descriptors>

                                <descriptor>src/main/assembly/fsm.xml</descriptor>

                            </descriptors>

                            <appendAssemblyId>true</appendAssemblyId>

                            <finalName>${project.artifactId}-${project.version}</finalName>

                        </configuration>

                    </execution>

                </executions>

            </plugin>

            <plugin>

                <artifactId>maven-jar-plugin</artifactId>

                <version>2.3.2</version>

                <executions>

                    <execution>

                        <id>default-jar</id>

                        <phase>none</phase>

                    </execution>

                </executions>

            </plugin>

            <plugin>

                <groupId>org.apache.maven.plugins</groupId>

                <artifactId>maven-antrun-plugin</artifactId>

                <version>1.4</version>

                <executions>

                    <execution>

                        <id>rename</id>

                        <phase>package</phase>

                        <configuration>

                            <tasks>

                                <property name="compile_classpath" refid="maven.compile.classpath"/>

                                <property name="runtime_classpath" refid="maven.runtime.classpath"/>

                                <property name="test_classpath" refid="maven.test.classpath"/>

                                <property name="plugin_classpath" refid="maven.plugin.classpath"/>

                                <move file="target/${project.artifactId}-${project.version}-fsm.zip"

                                      tofile="target/${project.artifactId}-${project.version}.fsm" />

                            </tasks>

                        </configuration>

                        <goals>

                            <goal>run</goal>

                        </goals>

                    </execution>

                </executions>

            </plugin>

        </plugins>

        <defaultGoal>package</defaultGoal>

    </build>

    <dependencies>

        ...

    </dependencies>

</project>

Würde mich über eine positive Meldung freuen.

Gruß

Sener

Labels (1)
0 Kudos
9 Replies
mikula
Crownpeak employee
Crownpeak employee

Re: Service Modul von Ant-Build in Maven umbauen

Hallo Hüseyin

ich habe mir nun gerade nicht dein ganzes Posting durchgelesen, aber ich nutze diese Stelle mal um Werbung für den FSM package type zu machen:
GitHub - zaplatynski/fsm-packagetype: A simple approach to a Maven package type for FirstSpirit modu...

Vielleicht macht der auch für euch die Entwicklung leichter.

LG Martin

0 Kudos
rrichter
Crownpeak employee
Crownpeak employee

Re: Service Modul von Ant-Build in Maven umbauen

Hallo Hüseyin,

vielleicht hilft auch das hier:

FirstSpirit Maven Artifacts for external use (Release 1.1)

Viele Grüße,

Raphael.

1+1=3 for large values of 1.
0 Kudos
HSener
I'm new here

Re: Service Modul von Ant-Build in Maven umbauen

Hi Raphael,

danke für den Hinweis.

Mein Problem ist eher die GUI die sich nicht öffnen lässt, denn ohne GUI funktioniert das Maven-Modul.

Gibt es denn kein Beispiel Projekt eines Service Moduls, das mit Maven erstellt worden ist?

Gruß

Hüseyin

0 Kudos
rrichter
Crownpeak employee
Crownpeak employee

Re: Service Modul von Ant-Build in Maven umbauen

Hi Hüseyin,

das hängt sicher nicht damit zusammen, dass es ein Service-Modul ist. Dass sich ein fsm bauen lässt, ist noch kein Garant dafür, dass das Modul dann auch fehlerfrei im Servermanager funktioniert.

Hast du denn mal in Zeile 150 geschaut, wo hier ein Null-Wert vorkommen kann, der anscheinend nicht abgefangen wird?

de.kittelberger.module.service.ServiceProviderConfigPanel.initGuiValues(ServiceProviderConfigPanel.java:150)

1+1=3 for large values of 1.
0 Kudos
HSener
I'm new here

Re: Service Modul von Ant-Build in Maven umbauen

Hallo Raphael,

in Zeile 150 wird die GUI mit dem Feld _textGuiField befüllt

private void initGuiValues() {

    

     _textGuiField.setText(_config.getTextGuiField().toString().trim());

}

Ist es möglich, dass er die Config-Datei nicht einlesen kann?

Gruß

Hüseyin

0 Kudos
marza
I'm new here

Re: Service Modul von Ant-Build in Maven umbauen

Hallo Hüseyin,

ich denke, dass es schon helfen könnte, wenn Du aus Deiner Zeile 150 mehere Zeilen Code machst, um eine Chance zu haben, die NullPointerException einzugrenzen.

Grüße

Marian

0 Kudos
thmarx
I'm new here

Re: Service Modul von Ant-Build in Maven umbauen

Hallo Hüseyin,

an der Stelle können ja einige Sachen null sein:

_textGuiField.setText(_config.getTextGuiField().toString().trim());

_textGuiField, wurde das TextField richtig initialisiert?

_config, das Einlesen der Config musst du selbst machen, erzeuge vielleicht entsprechen Logs, damit du sicher sein kannst, dass es geklappt hat

_config.getTextGuiField(), kann es sein, das beim ersten Aufruf ein null zurück kommt, es wurde bis jetzt ja noch keine Config gespeichert.

Viele Grüße

Thorsten

0 Kudos
tenter
I'm new here

Re: Service Modul von Ant-Build in Maven umbauen

Hallo Hüseyin,

Konnten dir Raphael, Marian und Thorsten weiterhelfen? Über einen neuen Stand zu deinem Problem würden wir uns freuen Smiley Happy

Grüße,

Hannes

0 Kudos
HSener
I'm new here

Re: Service Modul von Ant-Build in Maven umbauen

Hallo Hannes,

bin derweilen noch nicht dazu gekommen weiter am Modul weiterzumachen.

Sobald ich wieder zeitlich wieder dazu komme, werde ich hier berichten.

FYI thmarx​ & marza

Gruß

Hüseyin

0 Kudos