Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Code setup to use WebSphere APIs  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to write some code using WebSphere APIs
specifically trying to get a list of application Servers.
I believe I have not set things up correctly in WSAD as I am
getting an exception in the first line of code. Any ideas on what I
need to do to get this code to work. Thanks.

/*
* Created on Apr 9, 2004
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
/**
* @author shasan
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
import com.ibm.websphere.management.application.AppManagement;
import com.ibm.websphere.management.application.AppManagementProxy;
import com.ibm.websphere.management.application.AppConstants;
import com.ibm.websphere.management.application.AppManagementProxy;
import java.util.Vector;
import java.util.Hashtable;
import java.util.Locale;
public class CRoot {
private AppManagement appMgmt = null;

public CRoot()
{
try{
appMgmt = AppManagementProxy.getLocalProxy ();
}
catch(Throwable t)
{
System.out.println(t.getMessage());
}/*
catch(Exception e)
{
System.out.println(e.getMessage());
}*/
}

public Vector getInstalledApplications()
{
Vector appsList = null;
try
{
Hashtable prefs = new Hashtable();
prefs.put(AppConstants.APPDEPL_LOCALE, Locale.getDefault());
appsList = appMgmt.listApplications(prefs, null);
}
catch(Exception e)
{
System.out.println("Problem Admin");
}
return appsList;
}
public static void main(String [] args)
{
try
{
CRoot root = new CRoot();
System.out.println(root.getInstalledApplications().toString());
}
catch(Exception e)
{
System.out.println("Wassup" + e.getMessage());
}
}
}

Any help will be much appreciated.
Ali Hasan
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!