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?
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