Ajay Xavier

Ranch Hand
+ Follow
since Jan 03, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ajay Xavier

Hi,
I am trying to create a custom admin client for a stand alone websphere server (running on windows XP). Security is turned on for my server.

Websphere Version -> RAD 7.0
Security -> Local OS

Admin console is secured and it prompts for password. it accepts the windows administrator password. i am trying to use SOAP connector port available at 8881.

i am able to get the admin client when security is turned off in my server. Am i missing something?

here is the my code
{
Properties connectProps = new Properties();
connectProps.setProperty(AdminClient.CONNECTOR_TYPE,
AdminClient.CONNECTOR_TYPE_SOAP);
connectProps.setProperty(AdminClient.CONNECTOR_HOST, "localhost");
connectProps.setProperty(AdminClient.CONNECTOR_PORT, "8881");
connectProps.setProperty(AdminClient.CONNECTOR_SECURITY_ENABLED, "true");
connectProps.setProperty(AdminClient.CONNECTOR_SOAP_CONFIG, "file//C:\\Program files\\IBM\\SDP70\\runtimes\\base_v6\\profiles\\AjayProfile\\properties\\soap.client.props");

AdminClient adminClient = null;
try
{
adminClient = AdminClientFactory.createAdminClient(connectProps);
}
catch (ConnectorException e)
{
e.printStackTrace();
System.out.println("Exception creating admin client: " + e);
}

System.out.println("Created admin client: " + adminClient);
}


i am getting the following exception

om.ibm.websphere.management.exception.ConnectorException: ADMC0053E: Could not create SOAP Connector to connect to host localhost at port 8881 with SOAP Connector security enabled.
at com.ibm.websphere.management.AdminClientFactory.createAdminClient(AdminClientFactory.java:359)
at Test.main(Test.java:32)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:67)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:521)
at com.ibm.websphere.management.AdminClientFactory.createAdminClient(AdminClientFactory.java:300)
... 1 more
Caused by: com.ibm.websphere.management.exception.ConnectorNotAvailableException
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.reconnect(SOAPConnectorClient.java:253)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.<init>(SOAPConnectorClient.java:186)
... 6 more
Caused by: [SOAPException: faultCode=SOAP-ENV:Client; msg=Error opening socket: java.net.SocketException: Cannot find the specified class java.security.PrivilegedActionException: java.lang.ClassNotFoundException: com.ibm.websphere.ssl.protocol.SSLSocketFactory; targetException=java.lang.IllegalArgumentException: Error opening socket: java.net.SocketException: Cannot find the specified class java.security.PrivilegedActionException: java.lang.ClassNotFoundException: com.ibm.websphere.ssl.protocol.SSLSocketFactory]
at org.apache.soap.transport.http.SOAPHTTPConnection.send(Unknown Source)
at org.apache.soap.rpc.Call.invoke(Unknown Source)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient$2.run(SOAPConnectorClient.java:236)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:111)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.reconnect(SOAPConnectorClient.java:233)
... 7 more
---- Begin backtrace for nested exception
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:67)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:521)
at com.ibm.websphere.management.AdminClientFactory.createAdminClient(AdminClientFactory.java:300)
at Test.main(Test.java:32)
Caused by: com.ibm.websphere.management.exception.ConnectorNotAvailableException
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.reconnect(SOAPConnectorClient.java:253)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.<init>(SOAPConnectorClient.java:186)
... 6 more
Caused by: [SOAPException: faultCode=SOAP-ENV:Client; msg=Error opening socket: java.net.SocketException: Cannot find the specified class java.security.PrivilegedActionException: java.lang.ClassNotFoundException: com.ibm.websphere.ssl.protocol.SSLSocketFactory; targetException=java.lang.IllegalArgumentException: Error opening socket: java.net.SocketException: Cannot find the specified class java.security.PrivilegedActionException: java.lang.ClassNotFoundException: com.ibm.websphere.ssl.protocol.SSLSocketFactory]
at org.apache.soap.transport.http.SOAPHTTPConnection.send(Unknown Source)
at org.apache.soap.rpc.Call.invoke(Unknown Source)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient$2.run(SOAPConnectorClient.java:236)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:111)
at com.ibm.ws.management.connector.soap.SOAPConnectorClient.reconnect(SOAPConnectorClient.java:233)
... 7 more
Exception creating admin client: com.ibm.websphere.management.exception.ConnectorException: ADMC0053E: Could not create SOAP Connector to connect to host localhost at port 8881 with SOAP Connector security enabled.
Created admin client: null
16 years ago
Hi Nina,

The execute method of the Action class is provided with an single ActionForm parameter which is the form attribute specified in struts-config.xml for the given Action.

I think you can do something like this,

Create an value object which holds the data received from ActionForm1 i.e PackageForm. Place this value object in the session after calling its corresponding setter methods. In the subsequent action class you can get this value object from the session and populate the ActionForm2 i.e ServiceForm accordingly.

I think this is the best way of doing it.

Regards,
Ajay.
16 years ago
Hi,

I need to enable security in the application server. For that, I chose "Local OS" as my user registry. I had entered the "ServerID" and "Password" same as what I have used to logon to the machine running the application server. When I tried to enable the security and save the changes it throws an error message saying "Validation failed for user [userID]. Please try again."

Credential used for login to the machine running the application server:
UserID: ajay
Passoword: Xavier
Domain: MYTECH

how to resolve this issue?

Regards,
Ajay.
16 years ago
Hi,

I have an DispatchAction subclass which can forward to multiple JSP's based on a prameter.

My action entries in the sturts config.xml looks like


In my Action form i have a validate method which validate the form details (For the action class mentioned above there is a single form bean OrderForm). My requriement is

1. If the user has validation errors in personalDetails.jsp, he should be redirected again to personalDetails.jsp
2. if the user has validation errors in cardDetails.jsp he should be redirected to cardDetails.jsp

and so on.

My question is

if i use the formbean's validate() method to acheive the above quoted requirement, it redirects always to the personalDetails.jsp irrespective of the page which failed the validation. (even if cardDetails.jsp validation fails it redirects to personalDetails.jsp) How to overcome this and redirect to the specified page?

Thanks,
Xavier.
17 years ago
Hi,

Do you want to convert the ActionForm from request to session scope?

If so, it depends on the design of your application. If the data entered by the user (across several JSP's) has to be maintained across the requests, then instead of maintaining all the action forms (releated with sll the JSP's) in session, they might be populated to a single Value object whcih can be stored in the session.

Thanks,
Ajay.
17 years ago
Thanks Paul,

It would be more helpful, if you are able to provide me some sample code or articles which better explains it.

Thanks,
Ajay.
Hi,

Is there any direct way(like API or utilities) to compare two xml files(which are created from the same schema)?

Regards,
Ajay.
How about using a custom request processor to solve your purpose? Override the processPreprocess which performs session handling and that can be used for all the requests.

Regards,
Ajay.
17 years ago
Thanks Merill,

Is there any other option than switching the action form scope? because that will be like reengineering my whole project ?

Regards,
Ajay.
17 years ago
Hi Siva,

I belive specifying the datasource in struts-config.xml is not an efficient way. Try to put the database access details (like lookup, connection handling) in a utility class. Call a delegte class form your Action class which in turn uses the utility class for executing the operations against the database.

Regards,
Ajay.
17 years ago
Thanks Merrill for you immediate response,

I do adopt the same thing(giving a different form name in both the modules) but the problem is reusing the JSP's. In my JSP's i had used JSTL tags which creates a strong coupling betweeen the JSP's and config.xml (since they define the form names i have to use the same names in my JSP). Is there any ways i can reuse my JSP's?

Thanks,
Ajay.
17 years ago
Hi,

I have a struts web application which has several sub applicaitons. Sub application 1 has a flow specified in it own config.xml like

Config1.xml

<action name="/actionA.do".......>
<forward name="ForwardA" path="a.jsp/>
<forward name="ForwardB" path="/actionB.do?action=prepare"/>
</action>

<action name="/actionB.do".......>
<forward name="ForwardB" path="b.jsp/>
<forward name="ForwardC" path="/actionC.do?action=prepare"/>
</action>

The same flow with a slight modification is required in another sub application.

Can i use the same action classes, action forms and JSP's defined in sub application1? More over the JSP pages uses JSTL tags which in turn uses form names for referring attributes like

<c:if test="${empty formA.name}"/>

and the form has been set in session scope. This forces me to define the same form names and action names in config.xml of sub application 2.

My questions are

1. Is there any way to reuse the same action classes, forms and JSP in the sub application2?
2. If same form names are used in both the config.xml how to differentiate the form beans in session among the sub applicaitons?

Thanks,
Ajay.
17 years ago
Thanks Brent and Merrill,

I do understand the difficulty in inheritance. Lets say we try that using interfaces, i am planning to proceed it in the following way

1. Define an interface for each function which needs to be tiled.
2. Create a delegate method which peforms the functionality required.
3. Implement the interface in child classes and call the delegate to perform the action.

Is that right?


Thanks,
Ajay.
17 years ago
Thanks Meril,

And date is just a single instance i explained to you. There are some other scenarios which require database proecssings. for eg. The products provided by the specific company. it will be available in the database.


If i doesnt extends these classes, it requires me to rewrite this same code in the new classes. How do you suggest now?

Thanks,
Ajay.
17 years ago
Thanks Merrill,

But i do have a JSP page which contains only the above discussed date functionality. This required a ActionForm and Action class to be defined (which acts as base classes). Let me try to explain my scenarion more clearly

something like this


If any JSP page which will display the date option doesnt extend form commondateform it requires the same getter and setter methods to be rewritten in that class (which is not a best practice) and similarly the Action class has some generic code which needs to be executed when this generic functionality is used.

How do you suggest me to proceed in this scenario?

Thanks,
Ajay.
17 years ago