Integral Maven Eclipse Project

classic Classic list List threaded Threaded
9 messages Options
Lvw
Reply | Threaded
Open this post in threaded view
|

Integral Maven Eclipse Project

Lvw
This post was updated on .
Hi list,

I was currently using the WPS for testing purposes like this:

> I downloaded a war which I put in my tomcat container
> This created the wps
> I have a (non-maven) eclipse workspace in which I create my custom processes. I reference the 52N libraries from the tomcat on the buildpath.
> Then I export such a process as jar and put it into the \tomcat\webapps\wps\WEB-INF\lib folder and register the process at the webadmin console
> Done

However, I want to streamline this workflow a little since I want to deploy this wps with my custom process.

What I would like to have in the end is a workspace containing my custom wps processes and the wps server which I can package as war easily and then deploy somewhere on a tomcat.

> So I have now a (maven) workspace which is git connected to the remote repository so I can easily upgrade.
> I created a new Module called 52n-wps-myprocesses
> In this new module I created my new processes
> I added the 52n-wps-myprocesses to the dependencies of 52n-wps-webapp
> Added the full name of my custom process to the wps_config.xml

This all worked quite well. Except for some things:

(1) If I deploy from eclipse on a tomcat, the server initialized to http://localhost:8080/52n-wps-webapp/
instead of http://localhost:8080/wps/. However, all the links in the reponses from the server still point to http://localhost:8080/wps/"whatever". How could I change this?

(2) I am using the plugin mechanism with the serviceloader principle in one of my custom processes, about which I asked already once where to put my META-INF/services (http://geoprocessing.forum.52north.org/Dynamically-loading-classes-in-WPS-process-td4025925.html)
And I found out I have to put this META-INF/services under wps/WEB-INF/classes but where do I put them in the IDE? I tried 52n-wps-myprocess/src/main/java/META-INF/services and webapp/WEB-INF/classes/META-INF/services (under 52n-wps-webapp) but both times my classes couldnt be found.
EDIT: when I put the META-INF/services in webapp/WEB-INF/classes/META-INF/services (under 52n-wps-webapp). Then on WAR exporting and deploying in tomcat it actually DOES work.. however, in test-mode (running the web-app in tomcat in eclipse) it still doesnt... Any ideas how I can also make this work from within eclipse?

(3) Also on startup of the tomcat server in eclipse I get this error:

2014-12-11 15:54:17,497 [localhost-startStop-1] INFO  org.n52.security.service.config.support.SecurityConfigContextListener: SecurityConfiguration successfull stored in ServletContext
2014-12-11 15:54:17,498 [localhost-startStop-1] INFO  org.n52.wps.server.WebProcessingService: WebProcessingService initializing...
2014-12-11 15:54:17,545 [localhost-startStop-1] INFO  org.n52.wps.commons.WPSConfig: Can not get java:comp/env context
javax.naming.NameNotFoundException: Name [wps.config.file] is not bound in this Context. Unable to find [wps.config.file].
        at org.apache.naming.NamingContext.lookup(NamingContext.java:820) ~[catalina.jar:7.0.42]
        at org.apache.naming.NamingContext.lookup(NamingContext.java:168) ~[catalina.jar:7.0.42]
        at org.n52.wps.commons.WPSConfig$JNDIContextStrategy.getPath(WPSConfig.java:469) ~[52n-wps-commons-3.3.2-SNAPSHOT.jar:na]
        at org.n52.wps.commons.WPSConfig$WPSConfigFileStrategy.find(WPSConfig.java:431) ~[52n-wps-commons-3.3.2-SNAPSHOT.jar:na]
        at org.n52.wps.commons.WPSConfig.getConfigPath(WPSConfig.java:248) ~[52n-wps-commons-3.3.2-SNAPSHOT.jar:na]
        at org.n52.wps.commons.WPSConfig.getInstance(WPSConfig.java:240) ~[52n-wps-commons-3.3.2-SNAPSHOT.jar:na]
        at org.n52.wps.server.WebProcessingService.init(WebProcessingService.java:127) ~[52n-wps-server-3.3.2-SNAPSHOT.jar:na]
        at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280) ~[catalina.jar:7.0.42]
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193) ~[catalina.jar:7.0.42]
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088) ~[catalina.jar:7.0.42]
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5176) ~[catalina.jar:7.0.42]
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5460) ~[catalina.jar:7.0.42]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ~[catalina.jar:7.0.42]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) ~[catalina.jar:7.0.42]
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) ~[catalina.jar:7.0.42]
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) ~[na:1.7.0_25]
        at java.util.concurrent.FutureTask.run(FutureTask.java:166) ~[na:1.7.0_25]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) ~[na:1.7.0_25]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) ~[na:1.7.0_25]
        at java.lang.Thread.run(Thread.java:724) ~[na:1.7.0_25]

Although the process continues after this error and server runs ok... what does this mean and what could I do to circumvent this error?

Thnx
Lucas



Reply | Threaded
Open this post in threaded view
|

Re: Integral Maven Eclipse Project

BenjaminPross
Hi Lucas,

I assume that you are using Eclipse JEE and that you have the WPS imported as a maven project.

Regarding question 1: you could modify the wps_config(_geotools).xml and change the webappPath from "wps" to "52n-wps-webapp".

2: As you supposedly have the whole WPS in your workspace, it could be an option to add your process(es) directly to the /52n-wps-algorithm(-geotools) module for testing. That way the classes should be available (you will have to add them to the wps_config once manually, however).

3: The exception you see is the result of the different strategies the WPS has implemented to look for the wps_config.xml. The exception is a "necessary evil", it is properly caught and logged only for informational purposes (note the logging level "INFO"). I see that it could be a bit disturbing to see the exception on startup. We are currently doing some work on the configuration API of the WPS. Once this is finished, the exception might disappear.

Hope these quick answers can help you!

Cheers,

Benjamin
Lvw
Reply | Threaded
Open this post in threaded view
|

Re: Integral Maven Eclipse Project

Lvw
Hi Benjamin,

Thanks for your quick reply. You assumed right, I have the WPS imported as a maven project.

About (1): Interesting. This would also allow for multiple 52N WPS instances at the same physical machine right?

About (2): I currently have a new module: 52n-wps-myprocesses, in which I put my processes. The processes themselves are found and executed. But my question is about where to put the META-INF/services directory for the serviceloader to find it correctly.. But this is a quite general question (not WPS specific) so I have also asked this on stackoverflow (http://stackoverflow.com/questions/27427627/service-loader-config-file-doesnt-explode-properly)

About (3): Okay, thnx.
Reply | Threaded
Open this post in threaded view
|

Re: Integral Maven Eclipse Project

Daniel
Am 11/12/2014 um 17:36 schrieb Lvw:
> Thanks for your quick reply. You assumed right, I have the WPS imported as a
> maven project.
>
> About (1): Interesting. This would also allow for multiple 52N WPS instances
> at the same physical machine right?

Sure. It even allows to have several WPS in the same servlet container.

> About (2): I currently have a new module: 52n-wps-myprocesses, in which I
> put my processes. The processes themselves are found and executed. But my
> question is about where to put the META-INF/services directory for the
> serviceloader to find it correctly.. But this is a quite general question
> (not WPS specific) so I have also asked this on stackoverflow
> (http://stackoverflow.com/questions/27427627/service-loader-config-file-doesnt-explode-properly)

You should put that into your own module, and you must name the file
org.n52.wps.server.IAlgorithm and put into the file the name of the
class implementing the interface, see
https://github.com/52North/WPS-Extension-Skeleton/tree/master/src/main/resources/META-INF/services

Hope this helps!

/Daniel

> About (3): Okay, thnx.
>
>
>
> --
> View this message in context: http://geoprocessing.forum.52north.org/Integral-Maven-Eclipse-Project-tp4025968p4025970.html
> Sent from the 52° North - Geoprocessing Community Forum mailing list archive at Nabble.com.
> _______________________________________________
> Geoprocessingservices mailing list
> [hidden email]
> http://list.52north.org/mailman/listinfo/geoprocessingservices
> http://geoprocessing.forum.52north.org
> Please respect our mailing list guidelines:
> http://52north.org/resources/mailing-lists-and-forums/guidelines
>


--
Daniel Nüst
52°North Initiative for Geospatial Open Source Software GmbH
Martin-Luther-King-Weg 24
48155 Münster, Germany
E-Mail: [hidden email]
Fon: +49-(0)-251–396371-36
Fax: +49-(0)-251–396371-11

http://52north.org/
Twitter: @FiveTwoN

General Managers: Dr. Albert Remke, Dr. Andreas Wytzisk
Local Court Muenster HRB 10849
_______________________________________________
Geoprocessingservices mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/geoprocessingservices
http://geoprocessing.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines
Lvw
Reply | Threaded
Open this post in threaded view
|

Re: Integral Maven Eclipse Project

Lvw
Hey Daniel,

Thanks for your reply! I believe we are talking about slightly different things :)

From your link I understand you mean getting a custom process up and running (whatever the process is doing). For that the WPS-extension-skeleton also uses this serviceloader stuff to which you pointed. This is very interesting in itself, I didnt know I could also create a custom wps process like this. However, I did it differently. I just created a new module from the WPS/pom.xml, called it 52n-wps-myprocesses. In this  module I created my new processes. I then added the 52n-wps-myprocesses to the dependencies of 52n-wps-webapp and added the full name of my custom process to the wps_config.xml. This all worked well. When I explode my WAR in tomcat the defined process is automatically found and usable.

Now comes my problem ;)

IN my process (my process is in fact quite large, takes very often multiple minutes to complete and consists of multiple classes and packages) I have as input a workflow description file and some supplied data. Based on the workflow description the process should validate the supplied data accordingly. In one of the classes being part of this process, I also use a serviceloader (load and run only the validation classes that are included in the workflow description input file). And that is the problem, where do I put the list of implementing classes? From your link I deduced (its the same principle) I should have the following structure:

    WPS
    | 52n-wps-myprocesses
    | | src
    |   | main
    |     | java
    |       | validation.runner.WPSRunner (this is the class which extends AbstractAnnotatedAlgorithm)
    |       | validation.util. (in these packages all the helper classes are)
    |       | validation.jaxb
    |       | ...      
    |     | resources
    |       | META-INF
    |         | services
    |           | [service files]

However, this also doesnt work.. upon explosion of the war the WEB-INF/classes directory does not contain a META-INF/services dir...


Any ideas?
Lvw
Reply | Threaded
Open this post in threaded view
|

Re: Integral Maven Eclipse Project

Lvw
Lvw wrote
Hey Daniel,

Thanks for your reply! I believe we are talking about slightly different things :)

From your link I understand you mean getting a custom process up and running (whatever the process is doing). For that the WPS-extension-skeleton also uses this serviceloader stuff to which you pointed. This is very interesting in itself, I didnt know I could also create a custom wps process like this. However, I did it differently. I just created a new module from the WPS/pom.xml, called it 52n-wps-myprocesses. In this  module I created my new processes. I then added the 52n-wps-myprocesses to the dependencies of 52n-wps-webapp and added the full name of my custom process to the wps_config.xml. This all worked well. When I explode my WAR in tomcat the defined process is automatically found and usable.

Now comes my problem ;)

IN my process (my process is in fact quite large, takes very often multiple minutes to complete and consists of multiple classes and packages) I have as input a workflow description file and some supplied data. Based on the workflow description the process should validate the supplied data accordingly. In one of the classes being part of this process, I also use a serviceloader (load and run only the validation classes that are included in the workflow description input file). And that is the problem, where do I put the list of implementing classes? From your link I deduced (its the same principle) I should have the following structure:

    WPS
    | 52n-wps-myprocesses
    | | src
    |   | main
    |     | java
    |       | validation.runner.WPSRunner (this is the class which extends AbstractAnnotatedAlgorithm)
    |       | validation.util. (in these packages all the helper classes are)
    |       | validation.jaxb
    |       | ...      
    |     | resources
    |       | META-INF
    |         | services
    |           | [service files]

However, this also doesnt work.. upon explosion of the war the WEB-INF/classes directory does not contain a META-INF/services dir...
EDIT TO PREVIOUS POST: This actually DOES work, the services are not found under WEB-INF/classes/ but they are directly packaged in 52n-wps-myprocesses. From there they are also found!

Any ideas?
Reply | Threaded
Open this post in threaded view
|

Re: Integral Maven Eclipse Project

Daniel
Am 12/12/2014 um 10:19 schrieb Lvw:

>> Now comes my problem ;)
>>
>> IN my process (my process is in fact quite large, takes very often
>> multiple minutes to complete and consists of multiple classes and
>> packages) I have as input a workflow description file and some supplied
>> data. Based on the workflow description the process should validate the
>> supplied data accordingly. In one of the classes being part of this
>> process, I also use a serviceloader (load and run only the validation
>> classes that are included in the workflow description input file). And
>> that is the problem, where do I put the list of implementing classes? From
>> your link I deduced (its the same principle) I should have the following
>> structure:
>>
>>      WPS
>>      | 52n-wps-myprocesses
>>      | | src
>>      |   | main
>>      |     | java
>>      |       | validation.runner.WPSRunner (this is the class which extends
>> AbstractAnnotatedAlgorithm)
>>      |       | validation.util. (in these packages all the helper classes
>> are)
>>      |       | validation.jaxb
>>      |       | ...
>>      |     | resources
>>      |       | META-INF
>>      |         | services
>>      |           | [service files]
>>
>> However, this also doesnt work.. upon explosion of the war the
>> WEB-INF/classes directory does not contain a META-INF/services dir...
> *
>> EDIT TO PREVIOUS POST: This actually DOES work, the services are not found
>> under WEB-INF/classes/ but they are directly packaged in
>> 52n-wps-myprocesses. From there they are also found!
> *
>>
>> Any ideas?

How does the POM.xml of your module look?

Do you configure the resources directory in any way?

Have you turned on debugging during the maven build to see if the files
are copied?


/Daniel

--
Daniel Nüst
52°North Initiative for Geospatial Open Source Software GmbH
Martin-Luther-King-Weg 24
48155 Münster, Germany
E-Mail: [hidden email]
Fon: +49-(0)-251–396371-36
Fax: +49-(0)-251–396371-11

http://52north.org/
Twitter: @FiveTwoN

General Managers: Dr. Albert Remke, Dr. Andreas Wytzisk
Local Court Muenster HRB 10849
_______________________________________________
Geoprocessingservices mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/geoprocessingservices
http://geoprocessing.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines
Lvw
Reply | Threaded
Open this post in threaded view
|

Re: Integral Maven Eclipse Project

Lvw
I am not sure if you read the EDIT of my previous post

EDIT TO PREVIOUS POST: This actually DOES work, the services are not found under WEB-INF/classes/ but they are directly packaged in 52n-wps-myprocesses. From there they are also found!

But anyway:

POM looks like this:

<?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">
  <parent>
    <groupId>org.n52.wps</groupId>
    <artifactId>52n-wps-parent</artifactId>
    <version>3.3.2-SNAPSHOT</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>52n-wps-vcsprocesses</artifactId>
  <name>52North WPS Custom (VCS) Processes</name>
        <description>52North WPS Custom (VCS) Processes</description>
  <build>
  <resources>
                        <resource>
                                <directory>src/main/resources</directory>
                        </resource>
                </resources>
                <plugins>
                        <plugin>
                                <groupId>org.jasig.maven</groupId>
                                <artifactId>maven-notice-plugin</artifactId>
                                <executions>
                                        <execution>
                                                <id>check-licenses</id>
                                                <phase />
                                        </execution>
                                </executions>
                        </plugin>
                </plugins>
        </build>
        <dependencies>
            <dependency>
            <groupId>org.n52.wps</groupId>
            <artifactId>52n-wps-io</artifactId>
        </dependency>
        <dependency>
            <groupId>org.n52.wps</groupId>
            <artifactId>52n-wps-algorithm</artifactId>
        </dependency>
        <dependency>
            <groupId>org.n52.wps</groupId>
            <artifactId>52n-wps-io-impl</artifactId>
        </dependency>
        <dependency>
                        <groupId>net.sf.saxon</groupId>
                        <artifactId>Saxon-HE</artifactId>
                        <version>9.4</version>
                </dependency>
        </dependencies>
</project>

So I do not actually configure the resource directory.. because the resource directory that I am mentioning in the POM is actually the default one.. so i guess i could actually remove that entry from the pom.

Maven Build didnt work for some reason:

[ERROR] Failed to find Licenses for the following dependencies:
[ERROR] org.jdom:jdom:jar:1.1:compile
[ERROR] Try adding them to a 'licenseMapping' file.

So I have added the following to the license-mapping.xml

<artifact>
                <groupId>org.jdom</groupId>
                <artifactId>jdom</artifactId>
                <version>1.1</version>
                <name>JDOM</name>
                <license>JDOM license, https://github.com/hunterhacker/jdom/blob/master/LICENSE.txt </license>
        </artifact>


And now its complaining that the NOTICE and the NOTICE.expected don't match:
39d39
<   52North WPS Custom (VCS) Processes under GNU GENERAL PUBLIC LICENSE Version 2, June 1991
---
170d169
<   Saxon-HE under Mozilla Public License Version 1.0
---
200d198
<   XML Commons Resolver Component under The Apache Software License, Version 2.0
---
208d205
<   XOM under The GNU Lesser General Public License, Version 2.1
---

The first three I recognize, they come from my custom project (probably the fourth as well but I don't know from where exactly). So I guess I have to configure something somewhere about these licenses... but Iam still quite unfamiliar with Maven in general and especially with how this license notification system is set up..


Reply | Threaded
Open this post in threaded view
|

Re: Integral Maven Eclipse Project

Daniel
Hi!

Am 12/12/2014 um 14:44 schrieb Lvw:

> I am not sure if you read the EDIT of my previous post
>
> /EDIT TO PREVIOUS POST: This actually DOES work, the services are not found
> under WEB-INF/classes/ but they are directly packaged in
> 52n-wps-myprocesses. From there they are also found! /
>
> But anyway:
>
> POM looks like this:
>
> <?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">
>     <parent>
>       <groupId>org.n52.wps</groupId>
>       <artifactId>52n-wps-parent</artifactId>
>       <version>3.3.2-SNAPSHOT</version>
>     </parent>
>     <modelVersion>4.0.0</modelVersion>
>     <artifactId>52n-wps-vcsprocesses</artifactId>
>     <name>52North WPS Custom (VCS) Processes</name>
> <description>52North WPS Custom (VCS) Processes</description>
>     <build>
>     <resources>
> <resource>
> <directory>src/main/resources</directory>
> </resource>
> </resources>
> <plugins>
> <plugin>
> <groupId>org.jasig.maven</groupId>
> <artifactId>maven-notice-plugin</artifactId>
> <executions>
> <execution>
> <id>check-licenses</id>
> <phase />
> </execution>
> </executions>
> </plugin>
> </plugins>
> </build>
> <dependencies>
>    <dependency>
>              <groupId>org.n52.wps</groupId>
>              <artifactId>52n-wps-io</artifactId>
>          </dependency>
>          <dependency>
>              <groupId>org.n52.wps</groupId>
>              <artifactId>52n-wps-algorithm</artifactId>
>          </dependency>
>          <dependency>
>              <groupId>org.n52.wps</groupId>
>              <artifactId>52n-wps-io-impl</artifactId>
>          </dependency>
>          <dependency>
> <groupId>net.sf.saxon</groupId>
> <artifactId>Saxon-HE</artifactId>
> <version>9.4</version>
> </dependency>
> </dependencies>
> </project>
>
> So I do not actually configure the resource directory.. because the resource
> directory that I am mentioning in the POM is actually the default one.. so i
> guess i could actually remove that entry from the pom.
>
> Maven Build didnt work for some reason:
>
> [ERROR] Failed to find Licenses for the following dependencies:
> [ERROR] org.jdom:jdom:jar:1.1:compile
> [ERROR] Try adding them to a 'licenseMapping' file.
>
> So I have added the following to the license-mapping.xml
>
> <artifact>
> <groupId>org.jdom</groupId>
> <artifactId>jdom</artifactId>
> <version>1.1</version>
> <name>JDOM</name>
> <license>JDOM license,
> https://github.com/hunterhacker/jdom/blob/master/LICENSE.txt </license>
> </artifact>
>
>
> And now its complaining that the NOTICE and the NOTICE.expected don't match:
> 39d39
> <   52North WPS Custom (VCS) Processes under GNU GENERAL PUBLIC LICENSE
> Version 2, June 1991
> ---
> 170d169
> <   Saxon-HE under Mozilla Public License Version 1.0
> ---
> 200d198
> <   XML Commons Resolver Component under The Apache Software License,
> Version 2.0
> ---
> 208d205
> <   XOM under The GNU Lesser General Public License, Version 2.1
> ---
>
> The first three I recognize, they come from my custom project (probably the
> fourth as well but I don't know from where exactly). So I guess I have to
> configure something somewhere about these licenses... but Iam still quite
> unfamiliar with Maven in general and especially with how this license
> notification system is set up..

Ok - so let's fix the build first, and then see if the problem with the
resource is still there:

When you add new dependencies for the project by integrating a new
module,, then you will have to update the NOTICE file.
ou can find out where dependencies come from by looking at the
dependency graph in Netbeans or Eclipse, I'm sure there's also a maven
command for that... sure there is, see

http://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html

To generate the NOTICE file etc. check out

https://wiki.jasig.org/display/LIC/maven-notice-plugin


Hope this helps,
Daniel

>
>
> --
> View this message in context: http://geoprocessing.forum.52north.org/Integral-Maven-Eclipse-Project-tp4025968p4025978.html
> Sent from the 52° North - Geoprocessing Community Forum mailing list archive at Nabble.com.
> _______________________________________________
> Geoprocessingservices mailing list
> [hidden email]
> http://list.52north.org/mailman/listinfo/geoprocessingservices
> http://geoprocessing.forum.52north.org
> Please respect our mailing list guidelines:
> http://52north.org/resources/mailing-lists-and-forums/guidelines
>


--
Daniel Nüst
52°North Initiative for Geospatial Open Source Software GmbH
Martin-Luther-King-Weg 24
48155 Münster, Germany
E-Mail: [hidden email]
Fon: +49-(0)-251–396371-36
Fax: +49-(0)-251–396371-11

http://52north.org/
Twitter: @FiveTwoN

General Managers: Dr. Albert Remke, Dr. Andreas Wytzisk
Local Court Muenster HRB 10849
_______________________________________________
Geoprocessingservices mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/geoprocessingservices
http://geoprocessing.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines