JSF configuration problem - jsf

I am trying to configure JSF with the help of this blog http://balusc.blogspot.com/2008/01/jsf-tutorial-with-eclipse-and-tomcat.html
I cant see preferences-> web -> JSF Tools -> libraries
I need to include mojjaira but i didnt see library option here
help me where can i see this option

You seem to be using Eclipse 3.6. That tutorial was targeted on Eclipse 3.5 and the location of that preference has been changed in Eclipse 3.6. It's now available by a generic preference: Java > Build Path > User Libraries. But you can also just skip the step altogether and specify it during the Dynamic Web Project wizard. Or even better, head to the JSF 2.0 tutorial, it's targeted on Eclipse 3.6.

Just include JK-Faces maven dependency:
<dependencies>
<dependency>
<groupId>com.jalalkiswani</groupId>
<artifactId>jk-faces</artifactId>
<version>0.0.9-1</version>
</dependency>
</dependencies>
, and it will configure everything for you. Give it a try

Related

How to exclude package from the jar which is native?

I'm using avro-tools 1.9.2 in my project and due to some reason can't even update it. I see that avro-tools 1.9.2 using the old log4 1.x API natively (its not a transitive dependency instead its included natively in the jar itself), Is there any way to exclude package when using the jar file at runtime? I know its very unfair/weird questions. But I really need get going.
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro-tools</artifactId>
<version>1.9.2</version>
</dependency>

Some issues with using DeepLearning4J dlls

I am working with DeepLearning4J working with the 1.0.0-beta7 release. I am getting two errors at run time.
jnind4jcpu.dll unsupported jni version 0xffffffff
no nd4jcpu in java.library.path
I setup a path to the to a folder where I have a few other dlls for this effort. I am using java jvm 1.8.
So what version of the jvm should I use for question #1 and where in the dn4j maven project can I find the second one? I tried the uber jar for nd4j and still the same errors.
Thanks for any help!
Your issue doesn't have anything to do with the java version. Make sure you're not mixing versions of dl4j.
You don't really need to dig in to the internals or deal with any of the manual workarounds that you normally see in the jni based libraries.
All you need to do is include nd4j-native-platform in your classpath:
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-native-platform</artifactId>
<version>1.0.0-beta7</version>
</dependency>
Nd4j/dl4j is based on javacpp and takes care of all of that for you.
To give you even more targeted advice, I would have to know more about your environment (ideally reproducible on github)

Using com.sun.faces with Jakarta EE

I'm trying to upgrade a legacy Java EE application to Jakarta EE 8 on a Wildfly server. Most of the upgrade has gone smoothly since 8 doesn't swap the package names to jakarta yet. However, some of our code is using classes from Oracle's com.sun.faces package. These classes appear to be included in the Jakarta EE Faces API specification, but they are not included in our project when I use the following Maven dependency:
<dependency>
<groupId>jakarta.faces</groupId>
<artifactId>jakarta.faces-api</artifactId>
<version>2.3.2</version>
<scope>provided</scope>
</dependency>
To get these in the classpath, I have to use the Oracle dependency:
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.20</version>
<scope>provided</scope>
</dependency>
Obviously, we want to ditch using this package altogether at some point, but I was hoping there was a way to include this in our Jakarta migration.
The com.sun.faces.* is not part of Jakarta EE API. It's part of the Jakarta EE implementation. More precisely, it's the actual JSF implementation. Its name is "Mojarra".
You should indeed not need to have a dependency on it in your pom.xml in order to be JEE-implementation-independent (i.e. in order to be able to deploy your webapp to any JEE-compatible server without any code changes). If the code however doesn't compile when you remove it, then you apparently have somewhere a hard dependency on it, e.g. a hardcoded import or superclass referring to com.sun.faces.* package. This is indeed usually not correct.
The solution should be straight forward:
Remove that Mojarra dependency
Find all compilation errors
Fix them one by one by using the standard JSF API approach
If no one could be found, research or ask on Stack Overflow

Cannot find #ManagedBean annotation in IBM RSA Portlet Project

I've created portlet project in RSA, and set target runtime as WebSphere Portal 7 which I use. But now I want to create managed bean, to use JSF. But I cant import annotation. What I've missed?
If you are using maven you need to include this dependency to get the code to compile:
<dependency>
<groupId>javax.faces</groupId>
<artifactId javax.faces-api</artifactId>
</dependency>
Otherwise download the jar from maven central at http://search.maven.org/#search|ga|1|javax.faces.api and it to your project's build classpath in RSA.

Is it possible (and viable) to use Oracle ADF alongside JSF2 with Facelets?

I am searching the web for information regarding the usage of Oracle ADF as a component suite (and not as a development framework), alongside vanilla JSF (2.0).
I am working with a client that insists the solution uses the Oracle ADF UI components. The rest of the Fusion Middleware, however, can be completely skipped for all he cares. Therefore, I'd like to stay as close to the Java EE-JSF2 blueprints as possible, and only resort to ADF as a UI component library, as one would with PrimeFaces, for example.
So, the question - is it possible? Does ADF imposes limitations/dependencies that would prevent this scenario? Can we use it solely as a component library, or must we depend on its heavyweight framework to make them work?
It does not work; at least, not as one would expect. In short: ADF does indeed support JSF2 and Facelets, and they coexist nicely in a single application. As long as you don't mix them together.
I intended to use ADF as a component library, in a way similar to how one uses PrimeFaces or RichFaces: you add the correct dependencies, config what needs to be configured, and you're good to go. When Oracle says that ADF supports JSF2 and Facelets, this is the scenario that one would assume.
To start, you cannot use ADF components outside of a <af:document /> tag (or trinidad's counterpart); which means that content outside this tag is ignored, reducing the ability to use Facelets to a minimum. So, you'll hardly have any Facelets code on the same page where ADF components reside.
JSF + CDI integration is only available through the Mojarra implementation. Using MyFaces (the base for the current ADF version), one might make it work through updating the MyFaces jars and adding CODI, but it does not work out-of-the-box and I did not take the time to investigate it further.
To add to that, for layout management, you're stuck with the ADF way (through pageTemplateDef and pageTemplate tags), since mixing in Facelets is difficult due to the dependency on the document tag. So you see, Facelets support is there, "standard" JSF2 pages can exist in a ADF application - but to use ADF's components, you need to be in an ADF page.
To anyone that might be interested, once you populate your local maven repository using JDeveloper (as per the techniques suggested on the comments in the original question), the minimal dependencies to have ADF UI components in a web application (war) that can be run on WebLogic 12c or Glassfish with ADF essentials, are the following:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle.adf</groupId>
<artifactId>trinidad-api</artifactId>
<version>12.1.2-0-0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle.adf</groupId>
<artifactId>trinidad-impl</artifactId>
<version>12.1.2-0-0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle.adf</groupId>
<artifactId>adf-richclient-api-11</artifactId>
<version>12.1.2.0.40.66.34</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oracle.adf</groupId>
<artifactId>adf-richclient-impl-11</artifactId>
<version>12.1.2.0.40.66.34</version>
<scope>provided</scope>
</dependency>
You'll also need to add several other configuration files:
WEB-INF/adfc-config.xml
META-INF/adf-config.xml
META-INF/connections.xml
META-INF/wsm-assembly.xml
Along with further ADF boilerplate configuration on faces-config.xml and web.xml files.
So, the answer so far is:
Is it possible (to use ADF as a component library)? Yes.
Are there any limitations? There's no CDI (out of the box), and limited Facelets support. JSF2 ajax capabilities cannot be used within a ADF document - you must resort to the ADF partial page rendering, but JSF2 custom components and any ClientBehavior you may code work fine.
Is it worth the hassle? No.
Couple of months ago, Oracle ADF was supporting only JSF 1.2.
But with the release of JDeveloper 12c there are lots of new features and improvements over the IDE and over the Oracle ADF, for which there is JSF 2.0 Support now.
So, to answer your question - yes, you can use Oracle ADF with JSF2/Facelets.
If you just want a WAR through Maven do this (In JDeveloper 12c):
New Application -> Custom Application
Add the ADF Faces technology (shuttle to the right).
In the last step of the wizard choose "Use Maven".

Resources