Websphere 8.5 overlapping jars between project and default server jars - websphere-8

I have a project deployed on websphere 8.5. However, there are certain classes that are creating conflict due to jar version errors in project and the ones provided by websphere default.
Can anyone help to point mechanism to resolve conflict.
I have done something similar in weblogic which provides option in welogic.xml to exclude / include jars from project.

This is the use case for the "isolated shared libraries" feature in the WebSphere server. For any technologies for which you need to bring your own version rather than use the version provided with the server, place the necessary jars into some directory outside the application, create a shared library pointing to that location, select the "use an isolated class loader" option in the library configuration, and associate the library with the application(s) that require it. The application will search the isolated library class loader before delegating to its parent loaders, and classes there will be found instead of server-provided versions.
A few cautions: This should ONLY be used for technologies that you are 100% certain that you need your own version rather than the server's. The "parent last" style of class loading used by isolated shared libraries includes some risk of conflicts between class loaders, and avoiding it (by using APIs provided by the server) is generally the safer option.
Note, too, that not everything can be overridden. The Servlet, EJB, and JPA APIs, for example, will break application startup if included in an isolated shared library, because the server containers require consistent versions of the API classes when processing application objects. Also, you cannot bring an API of any technology without an associated implementation - doing that is usually a recipe for a VerifyError or LinkageError caused by duplicate visibility to multiple versions of the API.

Related

How to use .NET 6-windows and .NET 6 targets in one library

I've segregated my WinUI 3 application into different layers: Application, Infrastructure, Presentation etc.
And all the projects have targets: net6.0-windows and I want to move it to the Uno Platform.
So, I've added a new target: net6.0
And at this moment the problem arises:
Type [WinUI] component already defines a member, called InitializeComponent or some problems with binding.
Is it possible to make such type of library with targets to net6-windows and net6.0?
For the Windows app project itself, you need to use net6-windows, as that provides additional dependencies specific to Windows app projects. All other libraries (non-app projects) can then use net6.0.
Regarding the specific error message, you are getting, the reason might be the generated files have some kind of conflict - you can try deleting the obj and bin folders and rebuild.
The easiest way to make existing Windows app support Uno would probably be to create a blank Uno solution and then migrate the code there (as the solution has already the required setup for platform-specific projects prepared and you can then just add your code.
Uno also provides templates for cross-targeted libraries, so you might be able to use similar approach. The one linked is for "UWP" solution however, so to make it WinUI, you would need to switch from uap10.0.18362 to net6-windows.

A way to configure WebSphere 8.5 Liberty Profile programmatically?

I'm moving from IBM RAD 8 / WAS 7.0 to IBM RAD 9 / WAS 8.5. Liberty Profile. There's a plenty of configuration things such as URLs and namespace bindings.
I've found an information that WSADMIN is not working for Liberty Profile. I haven't found, however, the information, how to access similar functionality as in wsadmin/jython, for example for creating URLs, namespace bindings, etc.?
How to script such things under WebSphere Liberty Profile?
I'll try to address a few things that are implied by your use of wsadmin. I may be overshooting, but I hope this helps:
WSADMIN applies only to the full WebSphere Application Server. jython scripting for the Liberty profile is possible, though you're basically performing JMX operations on a server. Here is something to get started with: https://www.ibmdw.net/wasdev/docs/creating-remote-jmx-connections-with-jython/
There is no way to reconfigure a Liberty profile server via a JMX operation, however. All server configuration (or reconfiguration) is done by editing the server configuration file (either manually with an editor of your choice, via the eclipse tools, or with a script that modifies your XML).
The Liberty profile does not support CORBA or CORBA namespaces (corbaloc or corbaname), or remote EJBs. Liberty profile servers also are not part of the cell/node topology of full profile servers. Instead, Liberty profile servers form collectives, as described here:
http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/topic/com.ibm.websphere.wlp.core.doc/ae/cwlp_collective_arch.html
You can add strings to JNDI using the jndiEntry element in your server configuration as described here: http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/topic/com.ibm.websphere.wlp.core.doc/ae/twlp_dep_jndi.html
Information about configuring datasources (I am guessing at what you might need URLs and namespace bindings for) is here (see also the subtopics): http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/topic/com.ibm.websphere.wlp.core.doc/ae/twlp_dep_configuring_ds.html.
The easiest way is to edit the XML directly or using a script in the language of your choice. The idea is that the config is simple enough wsadmin is no longer needed - it's intended to be human readable and human maintainable. You can import XML snippets if you have repeated config elements you want to share similar elements across multiple servers, or create the same config elements multiple times.

External classes/jar in OSGi

My application supports running on many dbms and it requires user to configure dbms connection setting and also provide the jdbc jar file.
Now the application is to be packaged as OSGi bundle. There will be another main jar which lanches OSGi server and starts the application as bundle.
Can you please suggest how can I package the application as bundle and let user provide the jdbc jar file.
Will it require something like the main launcher jar specifying JDBC driver classes as FRAMEWORK_SYSTEMPACKAGES property?
Thanks in advance,
Aman
There are two ways of doing this:
1) Adding the driver.jar to the classpath of the main launcher and, like you say, expose its packages via the framework by specifying that property (or actually you can use the FRAMEWORK_SYSTEMPACKAGES_EXTRA property to just specify additional packages, instead of specifying all of them).
2) Manually wrapping the driver.jar as a bundle, or doing it dynamically at runtime. For example, you could try to wrap bundles that are copied to a certain folder (similar to what Apache Felix File Install does) by using Pax URL or some other tool that can create a bundle out of an ordinary jar file for you (see http://team.ops4j.org/wiki/display/paxurl/Pax+URL).

What does regsvr32 filename.ax actually do?

regsvr32 filename.ax
I just see it said something installed successfully,but what's the whole story?
COM that is widely used in Windows relies on registration. A component will provide type libraries, interfaces and classes. Each of these are defined by a GUID to uniquely name them. COM components can also defined ProgID's that are kind of shortcuts to the unwieldy GUID's.
All this information is stored in a special registry hive on the computer named HKEY_CLASSES_ROOT. Use RegEdit.exe to view it. In particular you can find type libraries in HKEY_CLASSES_ROOT\TypeLib, interfaces in HKEY_CLASSES_ROOT\Interface and classes in HKEY_CLASSES_ROOT\CLSID. Some of the information in the registry will contain the path of the actual DLL with the component allowing Windows to locate and load the component when it is requested.
When you install a COM component it is necessary to create the correct registry information. By convention the DLL can provide two exported functions:
DllRegisterServer
DllUnregisterServer
When you execute RegSvr32.exe MyComponent.dll the RegSvr32.exe executable will attempt to call DllRegisterServer in MyComponent.dll. The DLL is then supposed to create all the necessary registry entries to allow the component to be used.
In a similar way you can use RegSvr32.exe /u MyComponent.dll to unregister the component. That will remove all the information previously added to the registry.
Windows relies heavily on COM and it is very important that COM registrations are up to date. Unfortunately there is nothing that blocks you from deleting an already registered COM component. This will leave dangling pointers in the registry pointing to the no longer existing DLL. You can't even unregister it since it no longer exists.
Another problem is when two different applications requires different versions of the same component. The registry can only point to one of the two versions, and this may cause one of the applications to fail.
Microsoft has created fixes for these problems. It is much better to provide an installer for the COM component that is able to repair and uninstall the component if it has been deleted. You are also able to create side-by-side installation of the same component in different versions.
It basically calls into your dll (named filename.ax in this case) and call its "DllRegisterServer" method.
In the case of directshow filters, it might "register" those filters in the windows registry so that directshow knows about them.
ex: https://github.com/rdp/directshow-demo-audio-input-open-source/blob/master/acam/virt_audio_all.cpp#L698 calls
https://github.com/rdp/directshow-demo-audio-input-open-source/blob/master/acam/virt_audio_all.cpp#L631
Though there are more simple versions out there.
regsvr32 registers DLL's and EXEs into the Windows Registry (usually COM Type Libraries, Class IDs, Interface IDs etc). You can use regedit to navigate the registry.

Remote Objects not working with Modules

We have some Modules which have their own remote objects configured in remoting-config.xml. Each is packaged and deployed as separate web archives (WAR). For ex. Module1.war, Module2.war.
We are trying to integrate them in a flex application which is deployed in a separate web app. For ex. MainApp.war.
The remote objects work fine when invoked from within Module1.war and Module2.war. But the java remote objects are not getting invoked when called from the main flex application MainApp.war.
I have looked at Flex Developers guide and flexcoders Yahoo group.
How are you configuring your remote objects? Are you passing the path to services-config.xml in the "-services" compiler flag? If you are, I would avoid doing this, since it doesn't give you much flexibility in the location of your services endpoints.
Christophe Coenraets has a great article on best practices for configuring RemoteObject and other data access classes in Flex. The general idea is to externalize the URLs into an XML configuration file, load that with an HTTPService when the application starts up, then use the URLs to configure your Channel/ChannelSet which are binded into the RemoteObject. Full article is here:
http://coenraets.org/blog/2009/03/externalizing-service-configuration-using-blazeds-and-lcds/

Resources