読者です 読者をやめる 読者になる 読者になる

idempiere webui URLメモ

idempiere Eclipse

iDempiereにAngular2を使ったWebUIを作ってみたくなったので、
既存の http://servername:8080/webui/ ではなくて、
新しいURL ( http://servername:8080/angular/ など ) を追加する方法を調査したメモ。

URL追加手順をまとめた記事は↓
iDempiereにangular2のUIを作る準備メモ その1 - kubotti’s memo

/webui/を決めている箇所

idempiere/org.adempiere.ui.zk/META-INF/MANIFEST.MF

Web-ContextPath: webui

4.4 Deploying a bundle

書き換えるとURLのパスが変わる。

org.adempiere.ui.zkフォルダ(ディレクトリ)を別名コピーして配置しても、
Web-ContextPath: webui2 等で表示されない。
⇒ Run Configuratins > server.product > Plug-ins Tabの設定だった。

org.adempiere.ui.zkフォルダを別名コピー
File > Import...
General > Existing Projects into Workspace

memo

org.adempiere.ui.zk
org.adempiere.ui.zk-feature
をClose Projectで閉じてからサーバー起動すると、コンソール出力で以下の部分がなくなる。
404が返るので、jettyは起動している。

Overwrite bundleresource://175.fwk600746945:2/metainfo/zk/config.xml
with bundleresource://175.fwk600746945:19/metainfo/zk/config.xml [16]
12:54:21.091-----------> ClassLocator.getDependentXMLResources: Replicate resource: zk
Overwrite bundleresource://175.fwk600746945:11/metainfo/zk/config.xml
with bundleresource://175.fwk600746945:28/metainfo/zk/config.xml [16]
12:54:21.093-----------> ClassLocator.getDependentXMLResources: Replicate resource: zkbind
Overwrite bundleresource://175.fwk600746945:12/metainfo/zk/config.xml
with bundleresource://175.fwk600746945:29/metainfo/zk/config.xml [16]
12:54:21.112-----------> ClassLocator.getDependentXMLResources: Replicate resource: zul
Overwrite bundleresource://175.fwk600746945:14/metainfo/zk/zk.xml
with bundleresource://175.fwk600746945:31/metainfo/zk/zk.xml [16]
12:54:21.447-----------> LanguageDefinition.<init>: Replicated language: xhtml, overriden by [LanguageDefinition: xhtml] [16]
12:54:21.447-----------> LanguageDefinition.<init>: Replicated language: xul/html, overriden by [LanguageDefinition: xul/html] [16]
12:54:21.478-----------> ClassLocator.getDependentXMLResources: Replicate resource: calendar
Overwrite bundleresource://175.fwk600746945:1/metainfo/zk/lang-addon.xml
with bundleresource://175.fwk600746945:18/metainfo/zk/lang-addon.xml [16]
12:54:21.478-----------> ClassLocator.getDependentXMLResources: Replicate resource: ckez
Overwrite bundleresource://175.fwk600746945:2/metainfo/zk/lang-addon.xml
with bundleresource://175.fwk600746945:19/metainfo/zk/lang-addon.xml [16]
12:54:21.478-----------> ClassLocator.getDependentXMLResources: Replicate resource: gmapsz
Overwrite bundleresource://175.fwk600746945:5/metainfo/zk/lang-addon.xml
with bundleresource://175.fwk600746945:22/metainfo/zk/lang-addon.xml [16]
12:54:21.478-----------> ClassLocator.getDependentXMLResources: Replicate resource: timeline
Overwrite bundleresource://175.fwk600746945:6/metainfo/zk/lang-addon.xml
with bundleresource://175.fwk600746945:23/metainfo/zk/lang-addon.xml [16]
12:54:21.478-----------> ClassLocator.getDependentXMLResources: Replicate resource: timeplot
Overwrite bundleresource://175.fwk600746945:7/metainfo/zk/lang-addon.xml
with bundleresource://175.fwk600746945:24/metainfo/zk/lang-addon.xml [16]
12:54:21.478-----------> ClassLocator.getDependentXMLResources: Replicate resource: zkbind
Overwrite bundleresource://175.fwk600746945:12/metainfo/zk/lang-addon.xml
with bundleresource://175.fwk600746945:29/metainfo/zk/lang-addon.xml [16]
12:54:21.493-----------> ClassLocator.getDependentXMLResources: Replicate resource: zkplus
Overwrite bundleresource://175.fwk600746945:13/metainfo/zk/lang-addon.xml
with bundleresource://175.fwk600746945:30/metainfo/zk/lang-addon.xml [16]
12:54:21.590           WebUIServlet.init: iDempiere Web Client started successfully [16]
12:54:22.898-----------> AnnotationConfiguration.configure: ServletContainerInitializers: detected. Class hierarchy: empty [16]
3 06, 2016 12:54:24 午後 com.hazelcast.instance.Node

http://www.vogella.com/tutorials/EclipseExtensionPoint/article.html

config.xml

ログにある、
metainfo/zk/config.xml
は、
org.adempiere.ui.zk\WEB-INF\src\metainfo\tld
org.adempiere.ui.zk\bin\metainfo\tld
にある。
org.adempiere.ui.zk\bin
は、/org.adempiere.ui.zk/META-INF/MANIFEST.MFのbuild.propertiesに
output.. = bin/
とあるので、出力先ディレクトリ?

WebUIServlet

ログにある、
WebUIServlet.init
は、
/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/session/WebUIServlet.java

/ (root)

サーバーのルートは、
org.adempiere.server

/org.adempiere.server/src/main/home/org/bmlaurus/home/home.properties
の「title = 」を書き換えるとページ(HTML)のタイトルが変わる(再起動後)

osgi ssコマンド

osgi> ss
"Framework is launched."

id  State       Bundle
0   ACTIVE      org.eclipse.osgi_3.10.2.v20150203-1939
                Fragments=9, 147, 172, 146
1   ACTIVE      org.eclipse.equinox.simpleconfigurator_1.1.0.v20131217-1203
2   RESOLVED    com.sun.mail.javax.mail_1.5.1
3   RESOLVED    javax.activation_1.1.0.v201211130549

略

13  RESOLVED    javax.xml.soap_1.3.0.v201105210645
14  RESOLVED    jp.adempiere.testkafka_1.0.0.qualifier
15  ACTIVE      org.adempiere.base_3.1.0.qualifier
                Fragments=21
16  STARTING    org.adempiere.base.callout_3.1.0.qualifier
17  RESOLVED    org.adempiere.base.process_3.1.0.qualifier
18  ACTIVE      org.adempiere.eclipse.equinox.http.servlet_1.1.0.v20100503
19  RESOLVED    org.adempiere.eclipse.equinox.http.servletbridge_1.0.200.v20100503
20  RESOLVED    org.adempiere.eclipse.equinox.servletbridge_1.2.0.v20100503
21  RESOLVED    org.adempiere.extend_3.1.0.qualifier
                Master=15
22  ACTIVE      org.adempiere.install_3.1.0.qualifier
23  RESOLVED    org.adempiere.payment.processor_3.1.0.qualifier

略

170 RESOLVED    org.slf4j.jdk14_1.7.2.qualifier
                Master=168
171 RESOLVED    org.w3c.css.sac_1.3.1.v200903091627
172 RESOLVED    org.w3c.dom.fragment_3.0.0.qualifier
                Master=0
173 RESOLVED    org.w3c.dom.smil_1.0.1.v200903091627
174 RESOLVED    org.w3c.dom.svg_1.1.0.v201011041433
175 ACTIVE      org.zkoss.zk.library_7.0.7.qualifier
osgi> 

org.eclipse.equinox.simpleconfigurator

idempiere\targetPlatform\artifacts.xml
idempiere\org.adempiere.server-feature\server.product
idempiere\org.idempiere.eclipse.platform-feature\director\configuration\config.ini

org.adempiere.server-featureで追加

/org.adempiere.server-feature/feature.xml
Plug-ins tab > Add...

/org.adempiere.server-feature/server.product
configuration tab > Add...

Eclipseのメニューバー > Run > Run Configurations...
server.product
Plug-ins

ssコマンドの結果に足したプロジェクトが追加された。

osgi> ss
"Framework is launched."

id  State       Bundle
0   ACTIVE      org.eclipse.osgi_3.10.2.v20150203-1939
                Fragments=147, 148, 9, 173
1   ACTIVE      org.eclipse.equinox.simpleconfigurator_1.1.0.v20131217-1203


33  RESOLVED    org.adempiere.ui_3.1.0.qualifier
34  RESOLVED    org.adempiere.ui.kubotti_3.1.0.qualifier
35  ACTIVE      org.adempiere.ui.zk_3.1.0.qualifier
36  ACTIVE      org.adempiere.webstore_3.1.0.qualifier
                Fragments=37, 38

起動時エラー

!SESSION 2016-03-07 23:34:03.557 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_73
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=ja_JP
Framework arguments:  -product org.adempiere.server.server_product
Command-line arguments:  -product org.adempiere.server.server_product -data C:\workspace\idempiere/../runtime-server.product -dev file:C:/workspace/idempiere/.metadata/.plugins/org.eclipse.pde.core/server.product/dev.properties -os win32 -arch x86_64 -consoleLog -console

!ENTRY org.adempiere.ui.zk 2 0 2016-03-07 23:34:04.972
!MESSAGE [SCR] Found components with duplicated names! Details: 
Component1 : Component[
    name = org.adempiere.webui.window.ZkReportViewerProvider
    activate = activate
    deactivate = deactivate
    modified = 
    configuration-policy = optional
    factory = null
    autoenable = true
    immediate = false
    implementation = org.adempiere.webui.window.ZkReportViewerProvider
    state = Unsatisfied
    properties = 
    serviceFactory = false
    serviceInterface = [org.compiere.print.ReportViewerProvider]
    references = null
    located in bundle = org.adempiere.ui.zk_3.1.0.qualifier [35]
]

org.adempiere.ui.zkを丸ごとorg.adempiere.ui.kubottiとしてコピーしたので、同じクラスがあることが原因(と思われる)。

/org.adempiere.ui.kubotti/OSGI-INF/reportviewerprovider.xml

!ENTRY org.adempiere.ui.kubotti 4 0 2016-03-08 00:01:28.509
!MESSAGE [SCR] Component definition XMLs not found in bundle org.adempiere.ui.kubotti. The component header value is OSGI-INF/reportviewerprovider.xml

/org.adempiere.ui.kubotti/META-INF/MANIFEST.MF
Service-Component: OSGI-INF/defaultinfofactory.xml,

実行時エラーその2

00:09:13.906-----------> StandardDescriptorProcessor.visitListener: Could not instantiate listener org.adempiere.webui.LoggedSessionListener [16]
java.lang.ClassNotFoundException: org.adempiere.webui.LoggedSessionListener
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:450)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:403)
    at org.eclipse.jetty.osgi.boot.internal.webapp.OSGiWebappClassLoader.loadClass(OSGiWebappClassLoader.java:103)
    at org.eclipse.jetty.server.handler.ContextHandler.loadClass(ContextHandler.java:1583)
    at org.eclipse.jetty.webapp.StandardDescriptorProcessor.visitListener(StandardDescriptorProcessor.java:1956)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.visit(IterativeDescriptorProcessor.java:85)
    at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.process(IterativeDescriptorProcessor.java:72)
    at org.eclipse.jetty.webapp.MetaData.resolve(MetaData.java:408)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1340)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:41)
    at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:186)

00:09:14.021-----------> ClassLocator.getDependentXMLResources: Replicate resource: ckez
Overwrite bundleresource://176.fwk600746945:2/metainfo/zk/config.xml

/org.adempiere.ui.kubotti/WEB-INF/web.xml
タグをすべて削除。

実行時エラーその3

02:01:25.110-----------> BaseHolder.doStart:  [16]
java.lang.ClassNotFoundException: org.adempiere.webui.session.WebUIServlet
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:450)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:403)

/org.adempiere.ui.kubotti/WEB-INF/web.xml

     <servlet-class>
            org.adempiere.webui.session.WebUIServlet
        </servlet-class>


org.adempiere.webui.kubotti.HelloServlet
に書き換え。

作成。

package org.adempiere.webui.kubotti;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class HelloServlet extends HttpServlet {

  public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException{

    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Hello World!</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<h1>Hello World!</h1>");
    out.println("</body>");
    out.println("</html>");
  }
}

ブラウザで、
http://computername:8080/webui2/
と入力して、
Hello World!
と表示される。
(動いた)

extensions and extension points

FAQ What are extensions and extension points? - Eclipsepedia

The simplest metaphor for describing extensions and extension points is electrical outlets. The outlet, or socket, is the extension point; the plug, or light bulb that connects to it, the extension.

Jetty/Tutorial/EclipseRT-Jetty-Starter-Kit - Eclipsepedia

Useful Equinox OSGi commands | Isuru Suriarachchi's Blog