How to use Primefaces in OSGi-Framework karaf? - java

I want to use Primefaces in karaf. For that i combined the karaf-war-example with pax-web-primefaces-example and get a working karaf-feature which can be found at bitbucket.
The example works fine, but when i want to extend the project with any other primeface-example, like clock, ThemeSwitcher or a Panel, it not works correct.
So far i found out that i need to add javax.annotations as dependency. This compile correct, but shows not the expected results in browser. Maybe the missing views are broken because the javax.annotations is not added to the lib-folder in war. But i added it manually to the war and get no progress.
Rendering is
but should look like
I am not so skilled in osgi and felix that i not understood what is needed. Also i have the problem that no exception occurs, so i have no hint where i should look at.

Related

Why does spring-boot-3 give javax.servlet.http.HttpServletRequest ClassNotFoundException

When I ran spring-boot-2.7, there is no issue. However when I changed code and tailored it to spring-boot-3.0, there is java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest
Could someone help me to download the source code and run on your computer? After run it, and you click "Login using Facebook", you will see the exception.
https://github.com/chuangtc/spring-boot-3.0-security-social-login
I tried adding jarkarta servlet api 6.0, but the exception is still there.
You don't have to add jakarta servlet api 6.0 into the pom.xml.
According to documentation here, it is already included.
In your code whichever is using javax.servlet.http.HttpServletRequest, you need to change the javax to jakarta.
So the whole line will be something like this:
import jakarta.servlet.http.HttpServletRequest
I faced this error before when I upgrade my service as well and I solved it using this way. Maybe you can try it.
[EDIT]
I see that one of your dependency is using the javax.servlet:
https://mvnrepository.com/artifact/org.springframework.social/spring-social-facebook/2.0.3.RELEASE
And following this github, it seems this packages is no longer actively maintained and being archived, so it is likely they do not upgrade for Spring Boot 3.
I would recommend find other ways to work on the social login for Facebook, maybe you can try this way?
https://www.codejava.net/frameworks/spring-boot/social-login-with-facebook-example

Why are URLs not resoliving in jsp view of intellij with struts 2 convention

I have two "errors" with url references that appear when using struts forms in a new project I'm templating out in IntelliJ Idea. It's the strangest thing because neither of them are actual errors. The program builds and deploys as I expect
The first one is this. Now I'm sure that I could extract a copy of the "Struts-Tags" and put it somewhere but why am I getting this <statement> or delimiter error.
The second one is of the same line, it has to do with the zero config project I'm trying to build with convention I think. This one fails to recognize that I'm mapping to an action via the convention plugin without a config.
I'm just getting started on a project that I plan to use as a template for a larger project and I like to keep my projects clean of any errors. If I'm breaking best practices and that's the issue I'd love to hear about it but I was rather fond of building my template framework this way so I'd be disappointed if I was I guess. I'm new to the convention plugin but it seemed like a pretty clean way to set up a business application, more so than my last xml configured struts2 app on 2.3.
Anyway here are some additional references in case there is an issue elsewhere that I am overlooking.
Struts 2 plugin enabled (have tried all 8 combinations of the 3 struts intellij plugins)
Empty struts.xml file
web.xml file (some spring stuff cut off but the removal of all spring dependencies and configs did not affect intellij showing me these errors)
Maven struts dependencies
Action class... don't mind Data, it just generates my getters and setters, again #Component definitely isn't the issue as I have already tried removing all my spring stuff
Package Layout
If it helps you can download the project:
https://github.com/DrakeFramework/DrakeNelson
I was hoping to get my jpa and 3 deployments configured but I just can't stand committing a project and saying "OK" to errors, that's how it grows out of control and before you know it the 10,000 warnings are all just ignored.
The first problem is not reproducible in your sample project:
It could be that you've injected something like SQL into the parameter using Alt+Enter | Inject language or reference context menu. You can repeat this step, but use the Un-inject option.
The second problem is also not reproducible for some reason:

SOAP WebService not loading due to maven dependency issue

I am working on one of many modules in an OSGi based Java/Spring application.
The case I am dealing with is, on the face of it, rather simple - I need to make use of external jars by including a dependency into my local module maven pom file.
The problem I am facing is that as soon as the module is compiled and run, with the new dependencies sucked in, and hot deployed onto a local multi-module supporting Apache Felix server I see no SOAP web services defined within that particular module getting started.
Confusingly, it appears the same dependency used elsewhere (in a similar component, that is) does not bring about any problems and compiles/runs just fine.
Am I missing something fundamental in the way Maven/OSGi works or is it that there is some sort of a more serious issue at play here?
The images below should further illuminate the problem at hand.
It must be noted, though, that the following images have been purposefully modified as it has been assumed the kinds of jars added have no bearing on the way the deployment responds (for what it's worth, it is an external library providing hashing algorithms).
Before adding dependency running localhost:8080/cxf displays
Rerunning after including the above dependency causes it to not show anymore
Any insight would be hugely appreciated!

Methods to see result fo a code change faster

This question came to me when developing using Eclipse.
I use JBoss Application Server and use hot code replacement. But this option requires that the 'build automatically' option to be enabled. This makes Eclipse build the workspace automatically (periodically or when a file is saved?) and for a large code base this takes too much time and processing which makes the machine freeze for a while. Also sometimes an error message is shown saying that hot code replacement failed.
The question that I have is: is there a better way to see the result of a code change?
Currently I have the following two suggestions:
Have unit tests - this will allow to run a single test and see the result of a code change. ( But for a JavaEE application that uses EJBs is it easy to setup unit tests?)
Use OSGi - which allows to add jars to the running system without bringing down the JVM.
Any ideas on above suggestions or any other suggestion or a framework that allows to do this is welcome.
Did you take a look at http://zeroturnaround.com/jrebel/?
I tell you how I work. I hope it is useful. First of all, I disable "Build Automatically". Maybe it is better if you do a simple ANT script to compile and see errors/exceptions. Also, I make jar file with the same script. Afterwards, I use OSGi to check the application. Yo do not need to stop server, only you need to change versions in deployed bundles. Intead of JBoss Server I use Equinox which includes Jetty Web Server.
May you have a nice day!
With JRebel, you wouldn't have to build your project (skip the build totally). Plus, only the changed resources will be reloaded so the update happens instantly. Plus, session is preserved so you do not have re-login to the application after the update was performed.
Even though the question I asked was quite specific to Java, I thought that mentioning using an interpreted programming language that avoids the compilation step is anther way of seeing result of a code change faster.

Filtering warnings in eclipse by filename

We use Eclipse for our Java development, and we've got Maven compiling our JSPs into servlets to be used in our embedded Jetty instance. This means that to run the project from Eclipse, I have to include ./target/jsp-source as a source folder, which works great. The warnings that show up for that generated code are everywhere though, and I want to filter them out.
mainMenu_jsp.java has a warning about a local variable not being used. It's generated code, so I don't care about it, but I can't figure out how to filter out any warnings by filename pattern.
I know I can define a working set, but because I'm always opening,closing, and sometimes adding and deleting projects, I don't want another point of manual bookkeeping that I have to keep up to date. If I add a new project and forget to go in and add it to the working set, I won't get any warnings for it, which with all the other projects, I might not notice. Working sets would only really work if there was a way to set them to dynamically expand to include all projects (not just all right now), and have their filtering automatically apply to each new project as it's added.
Just use a Working Set. Details about how to do it here:
Excluding Unfixables from Eclipse Problem View
And here:
Eclipse Problems view
[Using a Working Set] doesn't work for a lot of situations.
For example, the Android Eclipse plug-in generates code into the same project.
A working set consists of one or more projects, in their entirety, so a working set can't filter out generated warnings that are intra-project.
Edit:
I learned something super-useful: working sets can filter out parts of projects. It's simple to do--click on the project in the left pane of the working-set editor and expand it. Then only add what you want.
A working set works well with multiple projects. I suggest you try using one.

Categories