cancel
Showing results for 
Search instead for 
Did you mean: 

Deploying Struts1.1 WAR archive in SAP J2EE Engine for WAS6.20

0 Kudos

Hello,

I am trying to deploy an example Struts 1.1 WAR archive in SAP J2EE Engine Stand Alone server with the Deploy Tool. With Tomcat 4, it's ok.

In the Deploy Tool, I am loading the war file with the "Assembler" Tab,

i make the EAR successfully but when i want to deploy it, i have got this error message :

ID17109: Error can't init Servlet action : java.lang.NullPointerException

ID5005 Could not commit deploy on container : servlet_jsp

The corresponding console error log is:

MessageResourcesFactory - -MessageResourcesFactory.createFactory

(RequestUtils.java:138)

at org.apache.struts.util.MessageResourcesFactory.createFactory(Message

ResourcesFactory.java:192)

at org.apache.struts.util.MessageResources.getMessageResources(MessageR

esources.java:576)

at org.apache.struts.action.ActionServlet.initInternal(ActionServlet.ja

va:1276)

at org.apache.struts.action.ActionServlet.init(ActionServlet.java:459)

at javax.servlet.GenericServlet.init(GenericServlet.java:366)

at com.inqmy.services.servlets_jsp.server.ServletContextFacade.init(Ser

vletContextFacade.java:3083)

at com.inqmy.services.servlets_jsp.server.ServletContextFacade.init(Ser

vletContextFacade.java:2538)

at com.inqmy.services.servlets_jsp.server.ServletsAndJspImpl.deploy(Ser

vletsAndJspImpl.java:458)

at com.inqmy.services.servlets_jsp.server.WebContainer.commitDeploy(Web

Container.java:257)

at com.inqmy.services.deploy.server.DeployServiceImpl.commit(DeployServ

iceImpl.java:2370)

at com.inqmy.services.deploy.server.DeployServiceImpl.deploy1(DeploySer

viceImpl.java:456)

at com.inqmy.services.deploy.server.DeployServiceImpl.deploy(DeployServ

iceImpl.java:131)

at com.inqmy.services.deploy.server.DeployServiceImplp4_Skel.dispatch(D

eployServiceImplp4_Skel.java:184)

at com.inqmy.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:163)

at com.inqmy.services.rmi_p4.server.P4SessionProcessor.request(P4Sessio

nProcessor.java:120)

at com.inqmy.core.service.context.container.session.ApplicationSessionM

essageListener.process(ApplicationSessionMessageListener.java:36)

at com.inqmy.core.cluster.impl3.ParserRunner.run(ParserRunner.java:30)

at com.inqmy.core.thread.impl2.SingleThread.run(SingleThread.java:118)

MessageResourcesFactory - -MessageResourcesFactory.createFactory

(RequestUtils.java:138)

at org.apache.struts.util.MessageResourcesFactory.createFactory(Message

ResourcesFactory.java:192)

at org.apache.struts.util.MessageResources.getMessageResources(MessageR

esources.java:576)

at org.apache.struts.action.ActionServlet.initInternal(ActionServlet.ja

va:1276)

at org.apache.struts.action.ActionServlet.init(ActionServlet.java:459)

at javax.servlet.GenericServlet.init(GenericServlet.java:366)

at com.inqmy.services.servlets_jsp.server.ServletContextFacade.init(Ser

vletContextFacade.java:3083)

at com.inqmy.services.servlets_jsp.server.ServletContextFacade.init(Ser

vletContextFacade.java:2538)

at com.inqmy.services.servlets_jsp.server.ServletsAndJspImpl.deploy(Ser

vletsAndJspImpl.java:458)

at com.inqmy.services.servlets_jsp.server.WebContainer.commitDeploy(Web

Container.java:257)

at com.inqmy.services.deploy.server.DeployServiceImpl.commit(DeployServ

iceImpl.java:2370)

at com.inqmy.services.deploy.server.DeployServiceImpl.deploy1(DeploySer

viceImpl.java:456)

at com.inqmy.services.deploy.server.DeployServiceImpl.deploy(DeployServ

iceImpl.java:131)

at com.inqmy.services.deploy.server.DeployServiceImplp4_Skel.dispatch(D

eployServiceImplp4_Skel.java:184)

at com.inqmy.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:163)

at com.inqmy.services.rmi_p4.server.P4SessionProcessor.request(P4Sessio

nProcessor.java:120)

at com.inqmy.core.service.context.container.session.ApplicationSessionM

essageListener.process(ApplicationSessionMessageListener.java:36)

at com.inqmy.core.cluster.impl3.ParserRunner.run(ParserRunner.java:30)

at com.inqmy.core.thread.impl2.SingleThread.run(SingleThread.java:118)

I don't understand why it doesn't find org.apache.struts.util.PropertyMessageResourcesFactory since it exists in struts.jar, which is present in the WAR archive.

Best regards,

Christophe

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello,

I am trying to deploy an example Struts 1.1 WAR archive in Netweaver Developer Studio(Eclipse) on SAP WAS 6.30. What step I need ?

Rgs,

Rick

iavor_petkov
Explorer
0 Kudos

Hi,

I could not find an easy way to do this from the IDE.

Maybe some sequence of extracting the war, copying files

in the project directories , refreshing and rebuilding would do but I prefer

not to fall into lengthy explanations for a GUI which is most likely not

same as yours (as I am using unreleased version).

If you have a ready version of the struts war file (assuming taken from the struts 1.1 package) you need to :

1. build an ear file from it.

- e.g. have an application.xml file created in META-INF directory with content :

<-DTD here->

add deploy

deploy MyApp630.ear

Hope this helps a bit : Iavor

iavor_petkov
Explorer
0 Kudos

Hi Cristophe,

I tried the struts-example.war from the Struts1.1 bundle and after adding reference to inqmyxml library, it deployed correctly.

Could you tell me the patchlevel of the Engine (<server>/managers/version.txt) and send me your ear file at iavor.petkov@sap.com .

When we find a solution, we can post it here for our fellows to see.

Best Regards : Iavor

former_member183890
Participant
0 Kudos

Dear lavor,

With reference to Ur post can I know where can I add a reference to inqmyxml library. Expecting Ur reply. Thanks in Advance.

Irudayaraj P

former_member183890
Participant
0 Kudos

Hi Lavor,

It did work.

I'd been fighting the whole day with this problem.

Bravo....

It works fine now....

Thanks,

Irudayaraj P

iavor_petkov
Explorer
0 Kudos

Hi,

Please browse to <SAP J2EE HOME>/cluster/server/managers directory (for cluster version)

or <SAP J2EE HOME>/alone/managers (for standalone version).

There must be a file named reference.txt

Insert in it the line :

reference <application name> library:inqmyxml

Then redeploy the application.

Best Regards : Iavor

former_member183890
Participant
0 Kudos

Hi Lavor,

Can U please help me in putting the struts.jar as a global reference in the library.txt. I don't wan't to have the struts.jar to be included in the web-inf directory for all application. Instead I want it to be put at a commanon reference library and all applications to refer it. Thanks in advance.

Regards,

Irudayaraj P

Message was edited by: Irudayaraj Peter

iavor_petkov
Explorer
0 Kudos

Hi,

It is a better approach, you are right.

There is a problem however, that the struts.jar and mainly the ActionServlet which is initialized first and hence first blows in your face with a ClassNotFoundException when you try to deploy the application depends on other classes for its work. These classes are in other libraries, so in order to use them from the struts library, you must provide references between the classloaders which loaded the relevant classes.

So in the following I assume:

- the application I am trying to run is named MyStrutsApp

- the library for the struts.jar is named struts

- the struts.jar file is located in <server>/additional-lib/struts

- the following entry is the library definition of the struts library in library.txt

library struts struts/struts.jar

- the following entry is the reference between the application classloader and the library classloader in reference.txt

reference MyStrutsApp library:struts

Another starting point is that when trying to deploy MyStrutsApp, I am getting the following result :

WARNING 1 - Error can't load Servlet org.apache.struts.action.ActionServlet : ja

va.lang.ClassNotFoundException: Class not found org.apache.struts.action.ActionS

ervlet

                                • Solution *****************************

Again. The problem is that if you only put the struts.jar in a library, the ActionServlet cannot be loaded due to dependency on other classes:

import java.io.IOException;

import java.io.InputStream;

import java.net.MalformedURLException;

import java.net.URL;

import java.sql.SQLException;

import java.util.*;

import javax.servlet.*;

import javax.servlet.http.*;

import javax.sql.DataSource;

import org.apache.commons.beanutils.*;

import org.apache.commons.beanutils.converters.*;

import org.apache.commons.collections.FastHashMap;

import org.apache.commons.digester.Digester;

import org.apache.commons.digester.RuleSet;

import org.apache.commons.logging.Log;

import org.apache.commons.logging.LogFactory;

import org.apache.struts.config.*;

import org.apache.struts.config.impl.ModuleConfigImpl;

import org.apache.struts.util.*;

import org.xml.sax.InputSource;

import org.xml.sax.SAXException;

So we take another approach - we put all Apache project libraries on which the struts.jar depends in the definition of the struts library and put reference to all other libraries (which are not part of apache project)

For these:

import java.io.IOException;

import java.io.InputStream;

import java.net.MalformedURLException;

import java.net.URL;

import java.sql.SQLException;

import java.util.*;

We do not need to do anything - they are from the JDK.

For these:

import javax.servlet.*;

import javax.servlet.http.*;

we define a reference to the servlet library

For this:

import javax.sql.DataSource;

we define a reference to the jdbc library

For these:

import org.apache.commons.beanutils.*;

import org.apache.commons.beanutils.converters.*;

import org.apache.commons.collections.FastHashMap;

import org.apache.commons.digester.Digester;

import org.apache.commons.digester.RuleSet;

import org.apache.commons.logging.Log;

import org.apache.commons.logging.LogFactory;

we put all commons jar files in the struts library definition (to avoid cyclic classloading references between the applications and the library which is a BAD approach).

For these:

import org.apache.struts.config.*;

import org.apache.struts.config.impl.ModuleConfigImpl;

import org.apache.struts.util.*;

we do not do anything - they are in the struts.jar

For these:

import org.xml.sax.InputSource;

import org.xml.sax.SAXException;

we define a reference to the inqmyxml library.

So at the end we have the following entries in library.txt (the library definition is a single line, a long one, delimiter between different jar files (their relative location) is space):

library struts struts/struts.jar struts/commons-beanutils.jar struts/commons-collections.jar struts/commons-digester.jar struts/commons-fileupload.jar struts/commons-lang.jar struts/commons-logging.jar struts/commons-validator.jar

reference struts inqmyxml

reference struts servlet

reference struts jdbc

and the following entry in reference.txt

reference MyStrutsApp library:struts

Now I haven't checked for depedencies all classes - just the ActionServlet. If something else blows, just find where it is located and put a reference for it.

However I was able to start MyStrutsApp and work with it this way :).

IMPORTANT!!! - whatever classes you have in the libraries, you must NOT have in the application, otherwise you will run into ClassCastExceptions and tricky problems...

E.g. if you put the commons-validator.jar in the struts library, you MUST delete it from the WEB-INF/lib directory of the application, do not forget this.

I hope this helps a bit : Iavor.

iavor_petkov
Explorer
0 Kudos

Hi, Peter,

Just sharing with the community the information you found in the struts docs.

!!!!!!!!!!!!!!!!!!

The struts libraries MUST NOT be shared between applications because they use static variables to keep state => applications may interfere. The struts library relies on the fact that it is loaded in the same classloader as the application and that this classloader is not shared with another struts application.

!!!!!!!!!!!!!!!!!!

So although the common library approach may work, it may also NOT work and lead to sticky problems, and is NOT supported by the struts community.

Regards : Iavor