:::: MENU ::::

ConfluenceのBlueprintsプラグイン作成環境をプロキシありWindowsで整える

Pocket

まず、ここを見て書いてある通りにやっていったが、
Linuxではエラーが起きて、Windowsではプロキシに阻まれて散々だった。

Windowsでは結果なんとかなったが、Linuxはどうしてもダメだった。
逆ならよくあるんだが、Linuxがダメとか理由が分からん。。。

そんな感じのメモ。

Linux (失敗)

過去に一度やったときは普通に成功したのだが、
なぜか今回やろうとしたら見事に失敗した。

SDKはyumで入れればいいだけなので割愛。

# javac -version
javac 1.8.0_65

# atlas-version
ATLAS Version:    5.1.10
ATLAS Home:       /usr/share/atlassian-plugin-sdk-5.1.10
ATLAS Scripts:    /usr/share/atlassian-plugin-sdk-5.1.10/bin
ATLAS Maven Home: /usr/share/atlassian-plugin-sdk-5.1.10/apache-maven-3.2.1
AMPS Version:     5.1.18
--------
Executing: /usr/share/atlassian-plugin-sdk-5.1.10/apache-maven-3.2.1/bin/mvn --version -gs /usr/share/atlassian-plugin-sdk-5.1.10/apache-maven-3.2.1/conf/settings.xml
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in 8.0
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-15T02:37:52+09:00)
Maven home: /usr/share/atlassian-plugin-sdk-5.1.10/apache-maven-3.2.1
Java version: 1.8.0_65, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-0.b17.el6_7.x86_64/jre
Default locale: ja_JP, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-504.el6.x86_64", arch: "amd64", family: "unix"

# cd /usr/local
# mkdir atlatutorial
# atlas-create-confluence-plugin
group-id   com.example.plugins.tutorial.confluence.simplebp
artifact-id  simplebp
version  1.0-SNAPSHOT
package  com.example.plugins.tutorial.confluence.simplebp

# atlas-run
Executing: /usr/share/atlassian-plugin-sdk-5.1.10/apache-maven-3.2.1/bin/mvn com.atlassian.maven.plugins:maven-amps-dispatcher-plugin:5.1.18:run -gs /usr/share/atlassian-plugin-sdk-5.1.10/apache-maven-3.2.1/conf/settings.xml
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in 8.0
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.example.plugins.tutorial.confluence.simplebp:simplebp:atlassian-plugin:1.0.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 67, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
...
[INFO] confluence started successfully in 43s at http://localhost:1990/confluence
[INFO] Type Ctrl-D to shutdown gracefully
[INFO] Type Ctrl-C to exit

ブラウザでアクセスすると以下のようなエラーが出る。

メッセージ 
java.lang.IllegalStateException: Spring Application context has not been set

説明 
The server encountered an internal error that prevented it from fulfilling this request.

例外
com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.IllegalStateException: Spring Application context has not been set
	com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:149)
	com.atlassian.util.concurrent.LazyReference.get(LazyReference.java:112)
	com.atlassian.confluence.plugin.servlet.filter.ServletFilterModuleContainerFilter.getServletModuleManager(ServletFilterModuleContainerFilter.java:23)
	com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:62)
	com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:58)
	com.atlassian.confluence.web.filter.validateparam.RequestParamValidationFilter.doFilter(RequestParamValidationFilter.java:58)
	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)
	com.atlassian.confluence.web.filter.TranslationModeFilter.doFilter(TranslationModeFilter.java:44)
	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)
	com.atlassian.confluence.plugin.servlet.filter.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:73)
	com.atlassian.confluence.web.filter.LanguageExtractionFilter.doFilter(LanguageExtractionFilter.java:53)
	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)
	com.atlassian.confluence.util.RequestCacheThreadLocalFilter.doFilter(RequestCacheThreadLocalFilter.java:32)
	com.atlassian.confluence.web.filter.ResponseOutputStreamFilter.doFilter(ResponseOutputStreamFilter.java:25)
	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)
	com.atlassian.core.filters.encoding.AbstractEncodingFilter.doFilter(AbstractEncodingFilter.java:41)
	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)
	com.atlassian.core.filters.HeaderSanitisingFilter.doFilter(HeaderSanitisingFilter.java:44)
	com.atlassian.confluence.servlet.FourOhFourErrorLoggingFilter.doFilter(FourOhFourErrorLoggingFilter.java:71)
	com.atlassian.confluence.web.filter.DebugFilter.doFilter(DebugFilter.java:50)
	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)

原因
java.lang.IllegalStateException: Spring Application context has not been set
	com.atlassian.spring.container.SpringContainerContext.getComponent(SpringContainerContext.java:48)
	com.atlassian.spring.container.ContainerManager.getComponent(ContainerManager.java:33)
	com.atlassian.confluence.util.LazyComponentReference$Accessor.get(LazyComponentReference.java:46)
	com.atlassian.util.concurrent.Lazy$Strong.create(Lazy.java:85)
	com.atlassian.util.concurrent.LazyReference$Sync.run(LazyReference.java:321)
	com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:143)
	com.atlassian.util.concurrent.LazyReference.get(LazyReference.java:112)
	com.atlassian.confluence.plugin.servlet.filter.ServletFilterModuleContainerFilter.getServletModuleManager(ServletFilterModuleContainerFilter.java:23)
	com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:62)
	com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:58)
	com.atlassian.confluence.web.filter.validateparam.RequestParamValidationFilter.doFilter(RequestParamValidationFilter.java:58)
	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)
	com.atlassian.confluence.web.filter.TranslationModeFilter.doFilter(TranslationModeFilter.java:44)
	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)
	com.atlassian.confluence.plugin.servlet.filter.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:73)
	com.atlassian.confluence.web.filter.LanguageExtractionFilter.doFilter(LanguageExtractionFilter.java:53)
	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)
	com.atlassian.confluence.util.RequestCacheThreadLocalFilter.doFilter(RequestCacheThreadLocalFilter.java:32)
	com.atlassian.confluence.web.filter.ResponseOutputStreamFilter.doFilter(ResponseOutputStreamFilter.java:25)
	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)
	com.atlassian.core.filters.encoding.AbstractEncodingFilter.doFilter(AbstractEncodingFilter.java:41)
	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)
	com.atlassian.core.filters.HeaderSanitisingFilter.doFilter(HeaderSanitisingFilter.java:44)
	com.atlassian.confluence.servlet.FourOhFourErrorLoggingFilter.doFilter(FourOhFourErrorLoggingFilter.java:71)
	com.atlassian.confluence.web.filter.DebugFilter.doFilter(DebugFilter.java:50)
	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)

ググると権限エラーだと言うので、権限付けたが結果は同じ。

In my case all confluence directories under both /var and /opt needed to be removed. The uninstall does not appear to remove pertinent files under /var/ and this error will persist until they’re removed. I tried all other remedies, but a previous partially install must of somehow corrupted those files under /var.

/varと/optのatlassianを消せばいいとあったので、消してみても結果は同じ。

Linux上で環境を用意する方法が分からない……
普通のプラグイン作成ならうまくいったのだが。

Windows環境(プロキシあり)

プロキシなしは何の問題もなくできたが、プロキシありの環境だといろいろ面倒だった。
atlas-create-confluence-pluginとatlas-runのときに大量にファイルをダウンロードするため、
外部通信ができないと行き詰まってしまう。

winhttpにieの設定を差し込む。

netsh winhttp import proxy source=ie

cmdを管理者権限で実行しないと、書き込みできませんでしたとエラーになるので注意!

winhttpを設定しても通信できずにタイムアウトになったのでこれはダメ。

org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute 
情報: I/O exception (java.net.SocketException) caught when processing request: Connection reset

apache-mavenを使っているので、そちらにプロキシ設定を入れれば行けるのでは?と思って、

# vi C:\Applications\Atlassian\atlassian-plugin-sdk-6.1.0\apache-maven-3.2.1\conf
  <proxies>
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     |-->
    <proxy>
      <id>myHttpProxy</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>xxx.xxx.xxx.xxx</host>
      <port>8080</port>
      <nonProxyHosts>localhost</nonProxyHosts>
    </proxy>
    <proxy>
      <id>myHttpsProxy</id>
      <active>true</active>
      <protocol>https</protocol>
      <host>xxx.xxx.xxx.xxx</host>
      <port>8080</port>
      <nonProxyHosts>localhost</nonProxyHosts>
    </proxy>
  </proxies>

設定を追記、これでいけた。

もしくはコマンドのオプションで指定しても良い。

atlas-create-confluence-plugin -Dhttps.proxyHost=xxx.xxx.xxx.xxx  -Dhttps.proxyPort=8080
atlas-run -Dhttps.proxyHost=xxx.xxx.xxx.xxx  -Dhttps.proxyPort=8080
Pocket


So, what do you think ?