cancel
Showing results for 
Search instead for 
Did you mean: 

adding servlet entry in web.xml of j2ee engine

Former Member
0 Kudos

Hi ,

I want a servlet to be loaded on startup of the j2ee engine SAP WAS which is basically flex based (MessageBrokerServlet).

The init param for the servlet is not accessible or cannot be initialized in init method of the servlet using the servletconfig object.

This is when the servlet is used as a portal component of type servlet.

So as to load the servlet and the servlet being able to access the init param i would be changing the web.xml of the sap j2ee engine (NW CE 7.1). are there any other effects of the same or is it fine if i just add this param in the web.xml

<servlet>

<servlet-name>MessageBrokerServlet</servlet-name>

<display-name>MessageBrokerServlet</display-name>

<servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>

<init-param>

<param-name>services.configuration.file</param-name>

<param-value>/WEB-INF/flex/services-config.xml</param-value>

</init-param>

<load-on-startup>1</load-on-startup>

</servlet>

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I don't think that we have that feature in portal app,

Try in this way

create 2 app 1 for web app and 2 one for portal app

Web app 1>declare the init para in the context in place of config, and try to get the init param in the Web App

Portal App2> call the init param through context by creating context object in the portal application servlet.

creating context obj config.getServletContext().

I think this works if you deploy the both app in same WebAS

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Srikumar,

In case if u want to get the config parameters in Portal Application,

Please add servlet.jar file to your portal app and get the config parameters through request obj like servlet programming.

what ever the web.xml u wrote is correct, it invoke the servlet at server start up.

Thanks,

Sreeni.

Former Member
0 Kudos

Hi ,

When we create Portal Component or rather a portal application there is no web.xml so how do we specify those init parameters to get the servlet config.

The deployment descriptor is in form of Portapp.xml. So basically my question when creating a portal application where do i specifiy the init parameters that we normally mention in the web.xml for a servlet and access it using servletconfig object in the init method.

Regards

Srikumar

Former Member
0 Kudos

Hello there,

To initialise a servlet on startup the web.xml of you webapplication should have the parameters has shown by you.

There is no need to edit the web.xml of the J2EE Server to start the application.

The only point you need to take care is that when init is called, incase there is an exception, it need to logged carefully and taken care so that when you call the servlet it should be clear that initilzation was failed.

HTH

-Vivek

Former Member
0 Kudos

Hi ,

Vivek in case my servlet is part of the Portal Application as PortalComponent how do i define init parameters that can be accessed in the servlet.

The config file would be accessed in the init method of the servlet how do i do that when the servlet is added as PortalComponent in PortalApplication. The servlet config file needs to accessed in t he init method.

The load on startup thing would be taken care of by setting parameter startup = true of application properties.

Regards

Srikumar V