Error when publishing application in WebSphere Commerce Developer after migration

When publishing your migrated application in WebSphere Commerce Developer, publishing fails with an exception.

Problem

An exception similar to the following example occurs:
[1/7/10 14:32:31:125 PST] 00000064 CommerceSrvr A WcsApp initPolicyManager CMN0007S: Initialization has started for "Policy Manager".
[1/7/10 14:35:50:734 PST] 0000006f SystemErr R Exception in thread "LT=0:P=910359:O=0:port=9100" 
java.lang.OutOfMemoryError

[1/7/10 14:36:21:156 PST] 0000006f SystemErr R at java.net.PlainSocketImpl.socketAccept(Native Method)
[1/7/10 14:36:23:187 PST] 0000006f SystemErr R at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:414)
[1/7/10 14:36:26:281 PST] 0000006f SystemErr R at java.net.ServerSocket.implAccept(ServerSocket.java:464)
[1/7/10 14:36:35:015 PST] 00000064 CommerceSrvr E PolicyManagerProvider getInstance CMN0409E: The following error occurred during processing: "java.lang.reflect.InvocationTargetException".
[1/7/10 14:36:37:000 PST] 00000064 CommerceSrvr E WcsApp initPolicyManager CMN0112E: The following error has been detected while initializing "Instance/PolicyManagerClassName": java.lang.reflect.InvocationTargetException.java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:599)
at com.ibm.commerce.accesscontrol.policymanager.PolicyManagerProvider.getInstance(PolicyManagerProvider.java:79)
at com.ibm.commerce.server.WcsApp.initPolicyManager(WcsApp.java:506)
at com.ibm.commerce.server.WcsApp.access$0(WcsApp.java:501)
at com.ibm.commerce.server.WcsApp$1.run(WcsApp.java:959)
at com.ibm.commerce.server.WcsApp.configInit(WcsApp.java:1013)
at com.ibm.commerce.server.WcsApp.initialize(WcsApp.java:435)
at com.ibm.commerce.server.WebApp.init(WebApp.java:374)
at com.ibm.commerce.struts.InitActionServlet.init(InitActionServlet.java:64)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:326)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:165)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.initialize(ServletWrapper.java:1600)
at com.ibm.wsspi.webcontainer.extension.WebExtensionProcessor.createServletWrapper(WebExtensionProcessor.java:98)
at com.ibm.ws.webcontainer.webapp.WebApp.getServletWrapper(WebApp.java:939)
at com.ibm.ws.webcontainer.webapp.WebApp.getServletWrapper(WebApp.java:860)
at com.ibm.ws.webcontainer.webapp.WebApp.initializeTargetMappings(WebApp.java:541)
at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:363)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:293)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:100)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:166)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:728)

Solution

The key error in the stack trace is the java.lang.OutOfMemoryError exception. The initial max heap size is 512 megabytes, but if your application is very large, and it needs to use more than the default 512 megabyte heap size, this error occurs. Increase the max heap size:
  1. Start your test server.
  2. Log on to the WebSphere Administration Console.
  3. Select Servers > Server Types > WebSphere application servers > server1 > Java and Process Management > Process definition > Java Virtual Machine
  4. Change the value of the Maximum heap size field. For example, change the value from 512 to 1024.
  5. Save your changes, then restart your test server.
  6. Republish the application.