Hi Justin
I followed your suggestions and the *.ili is now in the jar (org/geoserver/myModel.ili). But I don't see how to access/read the *.ili file successfully with a non absolute path. In Eclipse fileName="myModel.ili" will look in /home/stefan/Develop/GSOutputFormats/ili1/ where ili1 is the plugin root dir. In Geoserver fileName="myModel.ili" it will look in /home/stefan/. How can I access the file with relative paths?
regards
Stefan
mit freundlichem Gruss
Stefan Ziegler
----- Originalnachricht -----
Von: Justin Deoliveira <jdeolive@anonymised.com>
Gesendet: Mit, 7.10.2009 19:41
An: Ziegler Stefan <Stefan.Ziegler@anonymised.com>
Cc: geoserver-devel@lists.sourceforge.net
Betreff: Re: [Geoserver-devel] create wfs output format
Hi Stefan,
My guess is that it is not being included in the final jar built by
maven. This is a common problem with the way GeoServer sets up its
resources. Basically maven assumes all your resources (non java files)
are under src/main/resources, rather than src/main/java. But GeoServer
puts its resources in src/main/java. But to do this you have to do some
special maven configuration for them to get picked up. This
configuration specifies the files extensions to include, and .ili is not
one of them.
What you should do is create a new directory under the root of your
plugin, src/main/resources. Then put the .ili file under that. Make sure
it mirrors whatever structure you had under src/main/java. So if you
have it in src/main/java/com/xyz/myModel.ili, then put it in
src/main/resources/com/xyz/myModel.ili.
Then when you build your module with maven the file should be picked up.
You will also want to do another mvn eclipse:eclipse to refresh your
eclipse project to pick up the new src/main/resources directory.
Hope that helps.
-Justin
Ziegler Stefan wrote:
Hi Justin
I stumbled across another problem: I need to read a local file "myModel.ili". Putting it in the plugin-root directory works for the test case. I the copy my new outputformat jar into the geoserver/WEB-INF/lib directory and try to request some data. The plugin does not find the local file anymore.
The working directory (System.getProperty("user.dir")) while running the test case is the plugin-root dir. While running in GeoServer it is the home of the user which started GeoServer. Is there way to deal with this issue and to make the local file accessible with relative paths in the test case and in production?regards
Stefan----- Originalnachricht -----
Von: Ziegler Stefan <Stefan.Ziegler@anonymised.com>
Gesendet: Son, 4.10.2009 15:15
An: Ziegler Stefan <Stefan.Ziegler@anonymised.com> ; Justin Deoliveira <jdeolive@anonymised.com>
Cc: geoserver-devel@lists.sourceforge.net
Betreff: AW: [Geoserver-devel] create wfs output formatHi Justin
while running the test case I get the following error:
04 Oct 15:00:24 ERROR [geoserver.ows] -
java.lang.RuntimeException: Multiple responses: (class
net.opengis.wfs.impl.FeatureCollectionTypeImpl)
at org.geoserver.ows.Dispatcher.response(Dispatcher.java:677)
at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:213)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.geoserver.test.GeoServerAbstractTestSupport.dispatch(GeoServerAbstractTestSupport.java:1064)
at org.geoserver.test.GeoServerAbstractTestSupport.dispatch(GeoServerAbstractTestSupport.java:1031)
at org.geoserver.test.GeoServerAbstractTestSupport.getAsServletResponse(GeoServerAbstractTestSupport.java:473)
at org.geoserver.test.GeoServerAbstractTestSupport.get(GeoServerAbstractTestSupport.java:454)
at org.geoserver.CSVOutputFormatTest.testOutputFormat(CSVOutputFormatTest.java:12)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:154)
at org.geoserver.test.GeoServerAbstractTestSupport.runTest(GeoServerAbstractTestSupport.java:134)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
<?xml version="1.0" encoding="UTF-8"?>
<ows:ExceptionReport version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/ows
http://localhost:80/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ows="http://www.opengis.net/ows">;;
<ows:Exception exceptionCode="NoApplicableCode">
<ows:ExceptionText>java.lang.RuntimeException: Multiple
responses: (class
net.opengis.wfs.impl.FeatureCollectionTypeImpl)
Multiple responses: (class
net.opengis.wfs.impl.FeatureCollectionTypeImpl)</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>
It happens with trunk and the 1.7.x branch. There is no tomcat/geoserver running on my system so I'm confused againBTW: Where is the requested (cite:Buildings) coming from?
mit freundlichem Gruss
Stefan Ziegler----- Originalnachricht -----
Von: Ziegler Stefan <Stefan.Ziegler@anonymised.com>
Gesendet: Fre, 2.10.2009 21:52
An: Justin Deoliveira <jdeolive@anonymised.com>
Cc: geoserver-devel@lists.sourceforge.net
Betreff: Re: [Geoserver-devel] create wfs output formatHi Justin
cool, it works like a charm. I added some 3rd party jar to my repository and added a dependency in my pom.xml file. Is there a way to have this jar exported when building the module?
regards
Stefanmit freundlichem Gruss
Stefan Ziegler----- Originalnachricht -----
Von: Justin Deoliveira <jdeolive@anonymised.com>
Gesendet: Fre, 2.10.2009 15:49
An: Ziegler Stefan <Stefan.Ziegler@anonymised.com>
Cc: geoserver-devel@lists.sourceforge.net
Betreff: Re: [Geoserver-devel] create wfs output formatHi Stefan,
No problem. Hope you are making progress
Ziegler Stefan wrote:
Hi Justin
thanks so far. I try to find some wifi here in the office to use my notebook. In the meantime one more question: How does the mvn archetype:create command knows where to look for the appropriate archetype which is somewhere on my local machine? I don't see any reference between <geoserver_checkout> and <somewhere_else> directories.
Basically, it will local in your local maven repository. Usually in your
home directory under .m2/repository.WHen you specify:
mvn archetype:create -DarchetypeGroupId=org.geoserver.maven \
-DarchetypeArtifactId=geoserver-archetype-wfsoutputformat \
-DarchetypeVersion=1.7.7-SNAPSHOTIt will look in the directory:
<HOME>/.m2/repository/org/geoserver/maven/geoserver-archetype-wfsoutputformat/1.7.7-SNAPSHOT
Now, let's say you don't have it installed locally. What will happen is:
a) if you are running the archetype from an existing maven project (ie a
directory that has a pom.xml), it will use any repositories defined in
the pom.xml.b) if you are not running the archetype from an existing project it will
use the default public maven repository (http://repo1.maven.org/maven2/).So to sum up, in the wfs output format tutorial the first step is to
build geoserver, which will put the archetype in the local repository.
Unfortunately the version on the wiki is old, and it references an old
version.Hope that helps.
-Justin
regards
Stefanmit freundlichem Gruss
Stefan Ziegler----- Originalnachricht -----
Von: Justin Deoliveira <jdeolive@anonymised.com>
Gesendet: Fre, 2.10.2009 14:20
An: Ziegler Stefan <Stefan.Ziegler@anonymised.com>
Cc: geoserver-devel@lists.sourceforge.net
Betreff: Re: [Geoserver-devel] create wfs output formatHi Stefan,
So yeah, what i am suggesting is you do the following:
1) update from svn (1.7.x or 2.0.x, your choice)
2) do a full geoserver build (this will include the new archetype)
3) change the archetype version to 1.7.7-SNAPSHOT or 2.0-SNAPSHOT
(whichever version you choose to use)To verify i deleted all local jars for geoserver, geotools, and geoapi
from my local repository and did the following:cd <geoserver_checkout>/src
mvn clean install
cd <somewhere else>
mvn archetype:create -DarchetypeGroupId=org.geoserver.maven \
-DarchetypeArtifactId=geoserver-archetype-wfsoutputformat \
-DarchetypeVersion=1.7.7-SNAPSHOT -DgroupId=org.geoserver \
-DartifactId=csv
cd csv
mvn eclipse:eclipseI then loaded the csv project into eclipse with no problems.
Hope that helps.
-Justin
Ziegler Stefan wrote:
Hi Justin
I tried to use the version written in the tutorial (1.7.0.-SNAPSHOT). The maven archedtype:create command ends with the following error:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error creating from archetypeEmbedded error: org.apache.maven.archetype.downloader.DownloadNotFoundException: Requested download does not exist.
Unable to determine the release versionTry downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.geoserver.maven -DartifactId=geoserver-archetype-wfsoutputformat -Dversion=RELEASE -Dpackaging=jar -Dfile=/path/to/fileAlternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.geoserver.maven -DartifactId=geoserver-archetype-wfsoutputformat -Dversion=RELEASE -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]org.geoserver.maven:geoserver-archetype-wfsoutputformat:jar:RELEASE
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error creating from archetype
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:583)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:512)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:482)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:227)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error creating from archetype
at org.apache.maven.archetype.mojos.MavenArchetypeMojo.execute(MavenArchetypeMojo.java:241)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
... 16 more
Caused by: org.apache.maven.archetype.exception.UnknownArchetype: org.apache.maven.archetype.downloader.DownloadNotFoundException: Requested download does not exist.
at org.apache.maven.archetype.common.DefaultArchetypeArtifactManager.getArchetypeFile(DefaultArchetypeArtifactManager.java:117)
at org.apache.maven.archetype.old.DefaultOldArchetype.createArchetype(DefaultOldArchetype.java:119)
at org.apache.maven.archetype.mojos.MavenArchetypeMojo.execute(MavenArchetypeMojo.java:230)
... 18 more
Caused by: org.apache.maven.archetype.downloader.DownloadNotFoundException: Requested download does not exist.
at org.apache.maven.archetype.downloader.DefaultDownloader.download(DefaultDownloader.java:63)
at org.apache.maven.archetype.common.DefaultArchetypeArtifactManager.getArchetypeFile(DefaultArchetypeArtifactManager.java:98)
... 20 more
Caused by: org.apache.maven.artifact.resolver.ArtifactNotFoundException: Unable to determine the release versionTry downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.geoserver.maven -DartifactId=geoserver-archetype-wfsoutputformat -Dversion=RELEASE -Dpackaging=jar -Dfile=/path/to/fileAlternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.geoserver.maven -DartifactId=geoserver-archetype-wfsoutputformat -Dversion=RELEASE -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]org.geoserver.maven:geoserver-archetype-wfsoutputformat:jar:RELEASE
at org.apache.maven.artifact.transform.ReleaseArtifactTransformation.transformForResolve(ReleaseArtifactTransformation.java:53)
at org.apache.maven.artifact.transform.DefaultArtifactTransformationManager.transformForResolve(DefaultArtifactTransformationManager.java:57)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:129)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:74)
at org.apache.maven.archetype.downloader.DefaultDownloader.download(DefaultDownloader.java:55)
... 21 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Thu Oct 01 19:20:28 CEST 2009
[INFO] Final Memory: 9M/81M
[INFO] ------------------------------------------------------------------------So I used -DarchetypeVersion=1.7.0 which was the only one without getting the error. I build GeoServer from SVN and found some wfs-outputformat-2.0.jar (can't remember the precise name of the jar). Can I force maven to use this one instead (you see I'm really not familiar with this maven stuff :-)).
regards
Stefanmit freundlichem Gruss
Stefan Ziegler----- Originalnachricht -----
Von: Justin Deoliveira <jdeolive@anonymised.com>
Gesendet: Don, 1.10.2009 15:05
An: Ziegler Stefan <Stefan.Ziegler@anonymised.com>
Cc: geoserver-devel@lists.sourceforge.net
Betreff: Re: [Geoserver-devel] create wfs output formatHi Stefan,
The geoapi dependency *should* be getting dragged in transitively.
Although i guess depending on your local maven repository it might not be.What version of the archetype are you using? I just tweaked the
resulting pom in svn to add the opengeo repository to the resulting pom.
That might fix the problem. Are you running from svn? If so can you
update. If not i can send you an updated archetype jar.-Justin
Ziegler Stefan wrote:
Hi
I'm following the "Creating a WFS Output Format" tutorial [1] to create a new wfs output format but struggling a bit at step 4: Eclipse throws some errors in the import section since the org.opengis.feature.simple classes cannot be resolved/imported. Do I have to add them somehow?
[1]: http://geoserver.org/display/GEOSDOC/Creating+a+WFS+Output+Format
regards
Stefanmit freundlichem Gruss
Stefan Ziegler------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel
--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.