Liferay dxp 7.3: how to add third party jars for global sharing? - jar

how can add 3rd party jars for global sharing?
in 6.1, it just need to add those jar files into tomcat's lib/ext folder. but after upgrade to 7.3, those jars seems not loading and cannot reference in portlets.
please help!
thx.

Liferay 7 replaced its whole foundation and switched to OSGi -- you'll need to provide your third-party jars in an OSGi bundle.
(This basically was the answer. Any elaboration would be too much for this site or would need a more specific question. As Liferays documentation is always in flux, search for "liferay include third-party jars in module" for more info. At the time of writing, this link is a relevant search result.)

Related

How can I know what bundles I should not include in a Karaf features file?

In a Karaf features file if I include certain bundles then Karaf stops working correctly.
How can I know what bundles I should not include in a features file? for example, if I added these bundles in the features file in Karaf on Windows, Karaf is not happy and acts strange. I assume its because Karaf already provides Java interfaces for these bundles.
<bundle>mvn:org.osgi/org.osgi.core/4.3.1</bundle>
<bundle>mvn:org.osgi/org.osgi.compendium/5.0.0</bundle>
Also is there a programmatic way to determine this?
Is there a list of bundles which I should not include?
I understand that Karaf uses pax-logging rather than those slf4j.
In more detail, my SBT project compiles a list of dependent bundles for my bundle, in my list that I get back from my code I get the org.osgi.core and org.osgi.compendium. They are dependents of my osgi bundle which is my main project. Now, the problem is, how can I know that Karaf does not want this installed as part of my features?
Thou' shall not install other framework packages besides the framework ;)
This is an absolut NOGO!
As Karaf already provides everything you need, in that case the Framework.
So don't even think about adding the std. framework packages to your OSGi env, they are already all there.
If you want to have certain compendium packages.
Make sure you Install the implementing bundle, as you already pointed out, the pax-logging bundles already provide everything needed for the osgi logging compendium services.
Same is true for Pax-Web and the OSGi HttpService packages.
You'll find a lot of already pre-registered OSGi compendium services with Karaf,
if you need more, install the implementation, not the spec bundle.
edit
nop programmatic or Karaf internal way can tell you about to not include those bundles. It's just something commonly known.
An implementing bundle always also will bring you the needed osgi packages.

Where can I get symfony third party bundles with full configuration and explanation?

I am new to symfony framework so I don't have idea about bundles so I want to use third party bundles.
To get third party bundles as per my functionality I refer this and this links but I can't get full explanation about bundles like how to use , after install third party bundles where I need to change , which and where I need to configuration ?
So can anyone from symfony community guide me to how to use third party bundles ? and how to configure ? and where I need to configure ? configure mean routing.yml , config.yml file changes.
for ex : I need to install page building Bundle (CMS) for static pages (like about us , privacy and policy etc.) I install 3 different bundles using composer from git hub but none of are working. At last I install BeelabSimplePageBundle bundle and it install successfully in my vendor folder but on github there is not so much explanation about routing , configuration. may be some pro symfony developer can understand that explanation but newbie like me can't understand it because there is not step by step explanation.
so if there is any pro symfony developer please explain BeelabSimplePageBundle step by step and full explaination for install and for any third party bundle.so next time when I need to add any third party bundle I can do it myself and if needed I can explain to some newbie developer in future.
Thanks in advance.
Third party bundles usually comes with it's own documentation. If it doesn't you should avoid using it because it is going to make the development process harder and make your code buggy.
Only choose well documented and reputed bundles
Use the original documentation that comes with the bundle
In case you are needing a good place to search for symfony bundles, knpbundles.com has a large collection of symfony bundles

How to / where to find info on JBoss client dependencies? Any documentation?

It may be pretty basic question. But no luck Googling.
I was going through this URL. Because I had an issue accessing EJBs deployed on JBoss. After following this, it worked. Mainly this line.
jboss-ejb3-client.jar, jboss-aop-jdk50-client.jar, jboss-aspect-jdk50-client.jar and jbossall-client.jar -
all these .jar files are found in client folder of JBoss installation directory
But for a newbie of EJBs like me, this is following the steps without understanding the dependencies. So my question, can we find documentation like this somewhere? How do we know the jars we need to copy to client application classpath?
jbossall-client.jar for JBoss 4.X is enough - it contains all needed libraries.
For JBoss 5.X the story is more difficult - you need to reference in your project only jbossall-client.jar, but inside this JAR there are no actual classes, only MANIFEST file, which lists needed dependencies.
So, on JBoss 5, you need to have jbossall-client.jar added to classpath of your client plus all listed JARs lying next to it. Crazy, isnt't it?
JBoss 7 has sane approach. There is bin\client\jboss-client.jar that contains all dependencies needed by clients.

How to share jar within multiple portlets?

I'm using several jars in my portlets, for instance c3p0. Now I want to avoid to put the jars in every of my portlets lib folders. How can I share one jar file within multiple portlets? And how should I integrate them in the Eclipse IDE? Add an external jar or put them in one dedicated project and include them from there?
Another solution would be to put them under ../liferay-portal-<version>/tomcat-<version>/webapps/ROOT/WEB-INF/lib
If you place them here you can add the JAR as a dependency for your portlet in the portlets liferay-plugin-package.properties (if you're using Liferay Developer Studio or Liferay IDE then there's a nice GUI for this).
Then on deployment Liferay will copy the required JARS from ROOT/WEB-INF/lib to your portlets WEB-INF/lib
This I believe is the Liferay support mechanism for doing it, and doesn't require a restart because the JARs are copied to the portlets classpath on deployment.
One way I can think off is to put all of them in the global path.
For e.g. in Tomcat you could place them at ../liferay-portal-<version>/tomcat-<version>/lib/ext and then when you configure the server-runtime library in eclipse you will have these jars in your build-path.
This link may also help you decide, but it speaks for *-service.jar but I am not sure it would work other jars in any one portlet.

Received a main jar file with other jar files that need to be in the classpath. Whats the best way to include this main jar in my maven project?

So i received a java api from a client and the main code is in main.jar. But the instructions he gave me require me to add these other jars (a.jar, b.jar, etc..) into the classpath whenever I want to use main.jar. These other supporting jars are things like Xerces, jakarta-oro, and a few other publicly available libraries. The problem is i don't know what versions they are, so i'm not sure if there would be issues if i just update the pom.xml file in my app to depend on main.jar and also have dependencies to these other jars as well with the latest versions of them.
Whats the best strategy for using main.jar in my maven application? I'm planning on adding main.jar to our internal maven repository, but what should i do about the xerces, jakarta-oro, and other jars when i dont know what versions they are?
Thanks
If you are lucky the file /META-INF/MANIFEST.MF inside a.jar, b.jar etc. contains an entry "Implementation-Version" or some other useful information which tell you what version they are. If not, you can download the latest release(s) from the project web site and check if they have the same file size as your bundled dependencies.
You may also come to the idea to bundle the dependencies with the main.jar in one big jar, but this may become funny, when you have the dependencies twice in your classpath at some point in the future...
What about just asking the client what version numbers this dependencies have?
If you don't have any information about these third-party libraries, just add them to src/resources/META-INF/lib and commit to SVN. That's the best way, if we're talking about black box approach.

Resources