22. September 2013

Deploy Spring application by Maven to Tomcat7 via HTTPS – PKIX problem

Simple scenario: deploy spring application to remote server which has https management interface.

Easy task. When you have properly configured project with pom.xml then you can use tomcat7 plugin for Maven.

Part of pom.xml

<plugin>
 <groupId>org.apache.tomcat.maven</groupId>
 <artifactId>tomcat7-maven-plugin</artifactId>
 <version>2.0-SNAPSHOT</version>
 <configuration>
  <path>/test</path>
  <!-- username and password must be set in ~/.m2/settings.xml -->
  <server>mytomcat</server>
  <!-- URL where Maven can find Tomcat 7 Manager -->
  <url>https://test.sinusgear.com:443/manager/text</url>
 </configuration>
</plugin>

Just run:

mvn tomcat7:deploy

Upload fails with error message:

PKIX path building failed

Ups. Not that easy? :)
The problem is that Java does not trust certificate of remote server.

Here is how to fix PKIX issue in Windows.

Open url of remote server by Firefox and save certificate to file.

Run PowerShell as administrator.

Go to directory with JDK cacets and import certificate. Default password is “changeit“.

cd C:\Program Files\Java\jdk1.7.0_40\jre\lib\security
keytool -import -alias test.sinusgear.com -keystore cacerts -file C:\Users\georgik\Documents\test.sinusgear.com

Done. Now you can start mvn tomcat7:deploy again.

13. November 2011

Apache Tomcat 7 Maven plugin

I was searching for Apache Tomcat 7 Maven plugin. I found only messages that no such thing exists and that I have to use some workaround. Finally I found link at StackOwerflow that pointed me to the testing version of  such a plugin.

You just need to configure repository and update mojo definition.

 <repositories>
    <repository>
      <id>people.apache.snapshots</id>
      <url>http://repository.apache.org/content/groups/snapshots-group/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>apache.snapshots</id>
      <name>Apache Snapshots</name>
      <url>http://repository.apache.org/content/groups/snapshots-group/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>
...
<plugin>
      <groupId>org.apache.tomcat.maven</groupId>
      <artifactId>tomcat7-maven-plugin</artifactId>
      <version>2.0-SNAPSHOT</version>
      <configuration>
        <path>/</path>
      </configuration>
    </plugin>

You can run Tomcat7 by: mvn tomcat7:run

You can read more about this new version of Tomcat Maven plugin at tomcat.apache.org.

This plugin is still under development.

BTW: List Maven plugins hosted at Apache.org is available at maven.apache.org/plugins.

21. October 2010

FlexMojos – off-line build

FlexMojos: How to build Flex application when you’re off-line? It’s quite easy, just add -o

mvn -o install

What to do when Maven is complaining about some plugin?

Go to your home directory. Enter .m2/repository, locate broken plugin and delete it. Maven will download those files again.

Previous part of screencast: How to build Flex app from command line.

17. October 2010

FlexMojos – how to build Flex app from command line

You can use FlexMojos to build Flex/AIR application on Linux, Windows or Mac.

Resources:

Put this application on web server and you will see statistics about IT Gigants.

Let me know if you have any questions.

You can find further information about Flex/AIR/Maven training at SinusGear.com.

10. August 2010

Automating Flex and AIR builds with Maven and Flexmojos

Update: fixed point of this article. ;-)

It is daunting task to build project in Flash Builder over and over again, fix bugs, create build and produce release build. You change libs in your system and it screws up whole project and you have to start from the scratch :-( . It takes at least whole day to reestablish proper build environment.

Nightmare for developers,  lost budget and time for managers.

Adobe folks know this and they use Ant to build projects. Yea, it’s good, but little bit crude. It’s like moving from stone age to bronze age. It is BIG improvement once build.xml is in place and it saves a lot of time. But you have to find right Flex SDK, libraries, this swc, that swc, this certificate. Yay. Much better, just half a day is lost.

Java civilization already moved away from distant bronze-age and for several years they’ve been evolving Maven project. Ok, so how fast is Maven in establishing complete build environment? Very fast.

Download: Maven3, extract it, go to your project (with pom.xml), type e.g.: mvn install.

Bang! And you’ve got AIR package.

No manual downloads, no extraction of SDK, no manual copy of files back and forward.

Where is the hidden magic? It’s in Flexmojos project from Sonatype.

The only problem is to create good pom.xml. Stay tuned, there will be more articles about this topic. :-)

2. July 2010

Ako vytvoriť klientskú aplikáciu pre Google App Engine s podporou Remote Development Services

Ako som už spomínal na BarCampe v Brne, klasický model vývoja klient server aplikácii je celkom pracný. Na jednej strane musíte implementovať serverový interface a na strane druhej musíte vyreplikovať dátové triedy a volania v klientovi. Uznávam, že ručná práca je dnes cenená, ale nie v IT.

Predstavme si scenár:

  • serverový vývojár: naimplementuje funkcie a dáta zaperzistuje pomocou JDO
  • vývojár klienta: pripojí sa na server a vytiahne si volania, ktoré potrebuje a pokračuje v implementácii GUI

Typickým problémom býva zmena rozhrania. Rozšírme scenár:

  • serverový vývojár: zmení API a definíciu tried
  • vývojár klienta: zvolí refresh, zmeny sa vyreplikujú do klientskej aplikácie a len opraví zasiahnutý kód

Pomerne jednoduché scenáre, bez dobrých nástrojov sú však veľmi pracné.

Open source technológia BlazeDS od Adobe podporuje tzv. Remote Development Service. Umožňuje automatizovať veľkú časť manuálnych prác, ktoré sa objavia pri replikácii serverového API do klientských aplikácií. Technológia BlazeDS je primárne integrovaná s Tomcatom a Spring serverom. Mňa zaujímala iná oblasť a síce ako dostať BlazeDS na Google App Engine.

V nasledujúcom screencaste je ukázané, ako RDS funguje.

Archetyp pre Mave nájdete na maven.sinusgear.com.

5. June 2010

Experimentálna verzia Maven repozitáru pre EngineDS

Vytvoril som experimentálnu verziu úložiska pre Maven. V repozitári je uložená patchnutá verzia EngineDS, ktorá je potrebná pre správne fungovanie EngineDS aplikácií na Google App Engine.

Patch bol aplikovaný podľa návodu Martina Zoldana. Patch obsahuje opravu chyby:

flex.messaging.request.DuplicateSessionDetected

Na rozdiel od jeho verzie, prekompilované jary nevyžadujú Spring.

Upozorňujem, že sa jedná o experimentálnu verziu. Ak by ste narazili na problém, dajte mi prosím vedieť.

  • Babel fish

      Translate from:

      Translate to:

  • Where’s the fish?

  • Further info

  • Badges

  • Video channel

  • Learning

    lynda.com online training tutorials
  • Tags

  • Topics

  • Comments