• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Bulding a true war
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bulding a true war


  • Subject: Re: Bulding a true war
  • From: Gintautas Sulskus <email@hidden>
  • Date: Sun, 20 Oct 2013 21:25:11 +0100

Hello,

Thanks, John and Michael for your answers. 
Sorry for a very delayed reply. Unfortunately this message was filtered out by accident with other wo conversations.


To be specific - I want to build a true WAR app with maven.
I tried to follow your suggestions, but they didn't work - I still get the same error as in the first post. Let me explain my steps in detail.

1. After building war with maven I get MyApp.war archive [1]. Inside, empty META-INF folder. WEB-INF/lib contains all WO, 3rd party and MyApp.jar libraries.
MyApp.jar structure can be seen in target/classes . 

2. My Info.plist is in [2]. The problem is, I can not find any documentation on the requirements so I had to use Wonder Source framework as an example. Also, I am not sure why paths are like Resources/Java while there are no Java folder inside  Resources (Ajax lib for instance).

3. Web.xml is almost identical to yours, Michael, with the exception of (that doesn't exist):

                <listener>

                                <listener-class>com.commoditrack.core.SystemPropertiesHelper</listener-class>

                </listener>


I assume it is optional.


4. Is there any way to debug paths/missing resources?


Your help is much appreciated.


Regards,

Gintautas


[1] MyApp.
├── pom.xml
├── target
│   ├── classes
│   │   ├── Resources 
│   │   │   └── Info.plist
│   │   ├── WebServerResources
│   │   └── com
│   │   │   └── MyApp srouce
│   ├── MyApp - extracted MyApp.war
│   │   ├── META-INF
│   │   └── WEB-INF
│   │       ├── classes - empty
│   │       ├── lib
│   │       │   ├── MyApp.jar
│   │       │   ├── WO_jars.jar
│   │       │   └── 3rd_party_jars.jar
│   │       └── web.xml
│   └── MyApp.war - the actual WAR file
├── build.properties
├── build.xml
└── woproject

[2]
Info.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www..apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
                <key>CFBundleDevelopmentRegion</key>
                <string>English</string>
                <key>CFBundleExecutable</key>
                <string>MyApp</string>
                <key>CFBundleIconFile</key>
                <string>WOAfile.icns</string>
                <key>CFBundleIdentifier</key>
                <string> MyApp </string>
                <key>CFBundleInfoDictionaryVersion</key>
                <string>6.0</string>
                <key>CFBundleName</key>
                <string>WOA</string>
                <key>CFBundlePackageType</key>
                <string>APPL</string>
                <key>CFBundleShortVersionString</key>
                <string>0.0.1</string>
                <key>CFBundleVersion</key>
                <string>0.0.1</string>
                <key>CFBundleSignature</key>
                <string>webo</string>
                <key>CFBundleVersion</key>
                <string>5.4</string>
                <key>Has_WOComponents</key>
                <true/>
                <key>Java</key>
                <dict>
                                <key>JVMVersion</key>
                                <string>1.5+</string>
                </dict>
                <key>NSExecutable</key>
                <string> MyApp </string>
                <key>NSJavaClientRoot</key>
                <string>WebServerResources/Java</string>
                <key>NSJavaNeeded</key>
                <true/>
                <key>NSJavaPath</key>
                <array>
                                <string> MyApp.jar</string>
                </array>
                <key>NSJavaPathClient</key>
                <string> MyApp.jar</string>
                <key>NSJavaRoot</key>
                <string>Resources/Java</string>
                <key>NSPrincipalClass</key>
                <string>com.myapp.Application</string>
</dict>
</plist>

[3]

web.xml


<web-app>

                <display-name>MyApp</display-name>

                <context-param>

                                <param-name>WOJarBundle</param-name>

                                <param-value>YES</param-value>

                                <description>

                                                Whether this app is a "true" WAR, rather than a "stub" WAR

                                                or SSDD Note that WOROOT, LOCALROOT, WOAINSTALLROOT,

                                                WOClassPath are ignored if this is true However, if this is

                                                true, WOMainBundle must be set to the main bundle name

                                </description>

                </context-param>

 

                <context-param>

                                <param-name>WOMainBundle</param-name>

                                <param-value>MyApp</param-value>

                                <description>

                                                Sets the name of the main bundle. Only used if WOJarBundle

                                                is true

                                </description>

                </context-param>

 

                <!-- Indicates if application is in development or deployment mode. In development

                                mode, images are vended by the application directly from frameworks. In

                                deployment mode, images are vended by the webserver. -->

                <context-param>

                                <param-name>WOAppMode</param-name>

                                <param-value>development</param-value>

                </context-param>

 

                <!-- Class name of the WOApplication subclass that defines the

                                WebObjects application. -->

                <context-param>

                                <param-name>WOApplicationClass</param-name>

                                <param-value>

                                                com.myapp.Application

                                </param-value>

                </context-param> 

 

                <!-- The WebObjects Servlet that interfaces between the Servlet container

                                world and the WebObjects world. -->

                <servlet>

                                <servlet-name>WOServletAdaptor</servlet-name>

                                <servlet-class>er.extensions.jspservlet.ERXServletAdaptor</servlet-class>

                                <load-on-startup>5</load-on-startup>

                </servlet>

 

                <!-- URLs starting with 'WebObjects' use the WebObjects Servlet adaptor. -->

                <servlet-mapping>

                                <servlet-name>WOServletAdaptor</servlet-name>

                                <url-pattern>/WebObjects/*</url-pattern>

                </servlet-mapping>

                               

</web-app>



On Fri, Oct 4, 2013 at 3:58 PM, <email@hidden> wrote:

Hi Gintautas,

 

I went through the same struggle last year.  Below are working configurations for a true war app built with maven.

 

Notes:

·         The below configuration is for a wonder project (i.e. uses the ERXServletAdaptor, etc)

·         Make sure you have a correctly templated Info.plist under your Resources directory

·         If using maven to build the war, I suggest avoiding the WO/wonder plugins; they aren’t required and can be nettlesome.

 

If everything works correctly, you should be able to plop your war file into the webapps directory of a tomcat and watch it run.

 

Hope this helps,

Mike

 

 

 

WEB.XML:

 

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web

Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

 

<!-- This web.xml file by itself will allow you to run the corresponding

                WebObjects application in a Servlet container. If you would like to

                merge the WebObjects application with your existing JSP/Servlet

                application, you have to merge this web.xml with your existing web.xml.

 

                NOTE: This file is normally included as the template file 'web.xml.template'.

                During the build process, the placeholders for WOROOT, LOCALROOT, WOAINSTALLROOT,

                WOAppMode, WOClassPath, WOApplicationClass and WOtaglib will be replaced

                with the appropriate values. Other parts of the template file may be

                customized as required.

 

                NOTE: WEBINFROOT is added to the WOClassPath at build time, but the replacement

                value is replaced at runtime to be the path to the WEB-INF directory.

-->

 

<web-app>

                <display-name>${project.build.finalName}</display-name>

                <context-param>

                                <param-name>WOJarBundle</param-name>

                                <param-value>YES</param-value>

                                <description>

                                                Whether this app is a "true" WAR, rather than a "stub" WAR

                                                or SSDD Note that WOROOT, LOCALROOT, WOAINSTALLROOT,

                                                WOClassPath are ignored if this is true However, if this is

                                                true, WOMainBundle must be set to the main bundle name

                                </description>

                </context-param>

 

                <context-param>

                                <param-name>WOMainBundle</param-name>

                                <param-value>${project.build.finalName}</param-value>

                                <description>

                                                Sets the name of the main bundle. Only used if WOJarBundle

                                                is true

                                </description>

                </context-param>

 

                <!-- Indicates if application is in development or deployment mode. In development

                                mode, images are vended by the application directly from frameworks. In

                                deployment mode, images are vended by the webserver. -->

                <context-param>

                                <param-name>WOAppMode</param-name>

                                <param-value>development</param-value>

                </context-param>

 

                <!-- Class name of the WOApplication subclass that defines the

                                WebObjects application. -->

                <context-param>

                                <param-name>WOApplicationClass</param-name>

                                <param-value>

                                                ${mainclass}

                                </param-value>

                </context-param>

 

                <listener>

                                <listener-class>com.commoditrack.core.SystemPropertiesHelper</listener-class>

                </listener>

 

 

                <!-- The WebObjects Servlet that interfaces between the Servlet container

                                world and the WebObjects world. -->

                <servlet>

                                <servlet-name>WOServletAdaptor</servlet-name>

                                <servlet-class>er.extensions.jspservlet.ERXServletAdaptor</servlet-class>

                                <load-on-startup>5</load-on-startup>

                </servlet>

 

                <!-- URLs starting with 'WebObjects' use the WebObjects Servlet adaptor. -->

                <servlet-mapping>

                                <servlet-name>WOServletAdaptor</servlet-name>

                                <url-pattern>/WebObjects/*</url-pattern>

                </servlet-mapping>

                               

</web-app>

 

POM.XML

 

<?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/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
        <groupId>your.app</groupId>
        <artifactId>Parent</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <relativePath>../Parent/pom.xml</relativePath>
    </parent>
        <artifactId>yourApp</artifactId>
        <packaging>war</packaging>
        
        <name>${project.artifactId}</name>
        
        <properties>
               <mainclass>your.app.Application</mainclass>
        </properties>
 
        <build>
               <finalName>${project.artifactId}</finalName>
               <sourceDirectory>Sources</sourceDirectory>
 
               <resources>
                       <resource>
                               <targetPath>Resources</targetPath>
                               <directory>${basedir}/Resources</directory>
                               <!-- The archetype created project uses filtering in the Info.plist, you may wish to change this -->
                               <filtering>true</filtering>
                       </resource>
                       <resource>
                               <targetPath>Resources</targetPath>
                               <directory>${basedir}/Components</directory>
                       </resource>
                       <resource>
                               <targetPath>WebServerResources</targetPath>
                               <directory>${basedir}/WebServerResources
                               </directory>
                       </resource>
               </resources>
               <plugins>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <archiveClasses>true</archiveClasses>
                    <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
                    <!--suppress MavenModelInspection -->
                    <outputFileNameMapping>@{artifactId}@.@{extension}@</outputFileNameMapping>
                </configuration>
            </plugin>
           </plugins>
        </build>
        <dependencies>
        <dependency>
            <groupId>wonder.core</groupId>
            <artifactId>ERExtensions</artifactId>
        </dependency>
        <dependency>
            <groupId>wonder.core</groupId>
            <artifactId>ERServlet</artifactId>
            <scope>runtime</scope>
        </dependency>
    </dependencies>
</project>

 

INFO.PLIST:

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

                <key>CFBundleDevelopmentRegion</key>

                <string>English</string>

                <key>CFBundleExecutable</key>

                <string>${project.artifactId}</string>

                <key>CFBundleIconFile</key>

                <string>WOAfile.icns</string>

                <key>CFBundleIdentifier</key>

                <string>${project.artifactId}</string>

                <key>CFBundleInfoDictionaryVersion</key>

                <string>6.0</string>

                <key>CFBundleName</key>

                <string>WOA</string>

                <key>CFBundlePackageType</key>

                <string>APPL</string>

                <key>CFBundleShortVersionString</key>

                <string>${project.version}</string>

                <key>CFBundleVersion</key>

                <string>${project.version}</string>

                <key>CFBundleSignature</key>

                <string>webo</string>

                <key>CFBundleVersion</key>

                <string>5.4</string>

                <key>Has_WOComponents</key>

                <true/>

                <key>Java</key>

                <dict>

                                <key>JVMVersion</key>

                                <string>${jvmtarget}+</string>

                </dict>

                <key>NSExecutable</key>

                <string>${project.artifactId}</string>

                <key>NSJavaClientRoot</key>

                <string>WebServerResources/Java</string>

                <key>NSJavaNeeded</key>

                <true/>

                <key>NSJavaPath</key>

                <array>

                                <string>${project.artifactId}.jar</string>

                </array>

                <key>NSJavaPathClient</key>

                <string>${project.artifactId}.jar</string>

                <key>NSJavaRoot</key>

                <string>Resources/Java</string>

                <key>NSPrincipalClass</key>

                <string>${mainclass}</string>

</dict>

</plist>

 

From: webobjects-dev-bounces+michael.walters=email@hidden [mailto:webobjects-dev-bounces+michael.walters=email@hidden] On Behalf Of John Huss
Sent: Friday, October 04, 2013 10:11 AM
To: Gintautas Sulskus
Cc: WebObjects-Dev Mailing List List
Subject: Re: Bulding a true war

 

The default build.xml file (non-maven) you get with a new Wonder Application contains a war target.  It should just work.

 

On Thu, Oct 3, 2013 at 10:13 PM, Gintautas Sulskus <email@hidden> wrote:

Hello all,

 

I am trying to build a true WebObjects WAR. Unfortunately, no luck so far.

 

Is this tutorial is still valid?

http://wiki.wocommunity.org/display/WOL/Packaging+WO+Applications+as+true+WAR+with+Maven

 

So now I have a maven project that builds my app.jar and packages it into a war (including ALL libraries).

 

Initial project was created with archetype plugin as woapplication with true war support.

 

Please, could you provide me with any hints what may went wrong. I would really appreciate more documentation on this.


I followed the steps closely and bumped into a few exception while deploying on JBOSS AS 1.7:

 

03:59:22,894 INFO  [stdout] (MSC service thread 1-7) MainBundle will be set to projext_X

03:59:23,005 ERROR [stderr] (MSC service thread 1-7) [2013-10-4 3:59:23 BST] <MSC service thread 1-7> Couldn't load properties file: /Users/user/WebObjects.properties at path: /Users/user

03:59:23,009 ERROR [stderr] (MSC service thread 1-7) java.lang.reflect.InvocationTargetException

03:59:23,010 ERROR [stderr] (MSC service thread 1-7) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

03:59:23,010 ERROR [stderr] (MSC service thread 1-7) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

03:59:23,010 ERROR [stderr] (MSC service thread 1-7) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

03:59:23,011 ERROR [stderr] (MSC service thread 1-7) at java.lang.reflect.Method.invoke(Method.java:597)

03:59:23,016 ERROR [stderr] (MSC service thread 1-7) Caused by: java.lang.NullPointerException

03:59:23,016 ERROR [stderr] (MSC service thread 1-7) at com.webobjects.appserver.WOApplication.primeApplication(WOApplication.java:618)

03:59:23,017 ERROR [stderr] (MSC service thread 1-7) at com.webobjects.appserver.WOApplication.primeApplication(WOApplication.java:675)

03:59:23,017 ERROR [stderr] (MSC service thread 1-7) ... 19 more

 

03:59:23,017 INFO  [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/project_X]] (MSC service thread 1-7) Marking servlet WOServletAdaptor as unavailable

03:59:23,018 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/project_X]] (MSC service thread 1-7) Servlet /project_X threw load() exception: javax.servlet.UnavailableException: Error initializing servlet adaptor: null

at com.webobjects.jspservlet.WOServletAdaptor._applicationInit(WOServletAdaptor.java:442) [JavaWOJSPServlet-5.4.3.jar:5.4.1]

 

Best Regards,
Gintautas Sulskus


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

 




--
Best Regards,
Gintautas Sulskus
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Bulding a true war
      • From: Gintautas Sulskus <email@hidden>
References: 
 >Bulding a true war (From: Gintautas Sulskus <email@hidden>)
 >Re: Bulding a true war (From: John Huss <email@hidden>)
 >RE: Bulding a true war (From: email@hidden)

  • Prev by Date: Re: AjaxModalDialog not going away
  • Next by Date: Re: AjaxModalDialog not going away
  • Previous by thread: RE: Bulding a true war
  • Next by thread: Re: Bulding a true war
  • Index(es):
    • Date
    • Thread