daniele licitra

Ranch Hand
+ Follow
since Apr 08, 2013
daniele likes ...
Netbeans IDE Java Linux
Merit badge: grant badges
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by daniele licitra

Hi to all and welcome to the authors of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications.

I'am developing EAR applications that runs on Wildfly.
I developed a set of EJB modules (for example GeoDataModule, AuthorizationModule, FinancialModule, ... ) that i put in my current EAR depending on the scope of an application.

Each time I update a module, I need to compile the module and the ear, then deploy the EAR on the server. Sometimes I update a <2Mb ejb module but I need to deploy a 60Mb EAR

In the quoted book, is there something about EJB and "boosting" of the procedure that I've explained?

There is another problem in Wildfly: if my GeoDataModule depends on GeoDataEntity.jar, the entity jar must be in the classpath. At this moment I add the jar to the EAR as a dependency or I put it as a module in Wildfly.
Does this system change in Java 9 with modularity?
6 years ago

Norman Maurer wrote:Netty is general purpose network framework which can be used to implement any network protocol. Netty itself ships with support for many different protocols already, which includes http / web sockets and many more. You can find some examples on how you would use it for this job in the examples or in Netty in Action:


Beside this Netty has a rxtx transport which can be used to talk to serial devices:

Thank you! I will try it!
Hi to all.

I never used Netty in my application, so I would know some things before trying to switch to this tecnology.

1) Netty requires an Application Server or some other tecnologies to works?

2) I want to build a little server which comunicate with a browser (web services) and also with a mobile device or some desktop application, is Netty suitable for this project or is better to use EJB+JAXRS?

3) I need to comunicate with a fiscal printer but there aren't javapos drivers yet. This fiscal printer has a serial port and a ethernet port. Is Netty suitable for sending message to a fiscal printer or does exist an extension for communicating with devices?
Hi to all.

I'am using picketlink in a WAR for checking if user is allowed to do something on a bean.
I'am using the AllowedOperation and RequiresPermission annotations.
The official documentation is at https://docs.jboss.org/picketlink/2/latest/reference/html/Restricting_resource_operations.html

In the quickstart the author put the annotations on the entity class to define operation and then he uses annotation on controllers.

The example works fine.

Now I have multiple entity that extend my StandardEntity. I putted the annotation on this @MappedSuperclass (the operations are all the same for all the entities: create, read, update and delete).
I have also a lot of bean for accessing the entities. All the beans extends an AbstractFacade<T> and use the same methods, so I use annotations on methods.

In this case the permission are not checked, so an user with no permission can read the entities.

Does someone know if it's possible to use annotations on interfaces or superclasses and if it requires additional configurations?

7 years ago
Hi to all.

I have a WAR project were the authentication is made by PicketLink (version 2.7.1-Final).
This WAR app is deployed on Wildfly 9.0.2.Final.

My app is quite equal to the quickstart example "picketlink-angularjs-rest" that you can find on github.

The javascript code in AngularJS call a web service for authentication:

but there isn't no web service under http://-CONTEXTROOT-/rest/private/authced.

Which class manage the request?

I've also changed the url to http://-CONTEXTROOT-/rest/notexist/authced and the system still works.
What is the url that I need to recall?

I moved some class of teh quickstart in an EJB Module called <i>SecurityModule</i> and in a Jar library (for static things, identities and entities). Then I put this class as dependency of war and it still works.

I moved the same libraries in a EAR.
I had some problem with multiple dependency and i solved in this way:

In the pom.xml of EAR i have include Picketlink as dependency management

and in WAR pom.xml i put the dependency as provided:

The application starts but none of picketlink initializer are launched so the security system not works. See the three classes in the example

What does class activate picketlink system?
Null principal problem resolved: it was a configuration error.

In web.xml added LogoutServlet in a security constraint:

But when i logout then enter on a protected page, no login is asked!

EDIT: This is the server log at logout moment:

This is all ok! It's BASIC auth, so when i log out, the system log in again!

Switching to FORM authentication is the solution
Hi Rob.
Following your hint:

If i look at JSESSIONID in cookies, the session ID is different, so the session is new.
If i go, after logout, to a protected url, no password is asked ... i'am still logged in ?

Am I forgetting something?

Partially solved.

Now I can log in the web app.
show the username correctly and if I use an user with bad group, it throw "forbidden" error. OK.

I have a logout servlet:

but at row 14 the principal is null.
the problem is that i need that principal in method flushAutentica for flushing cache from server.

Hi to all.

I want to use LDAP login in my web application. I can login with my Active Directory account but i revice "Forbidden" message page.
So i printed out principal in my index.xhtml (not protected)

but principal is null even if i login and i return on this page (without logout).

(I used "Administrator" user that belong to "Administrators" and "Users" )

- my principal is really null?
- If it is null, why i receive "forbidden" error and not "Unauthorized" page?
- Am I doing some mistakes with roles ?

I have a Windows Server 2012 machine ( working as Domain Controller and a Linux machine with Wildfly.

I've configured the LDAP security domain on Wildfly:

In my jboss-web.xml added <security-domain>RLDAP</security-domain>

In web.xml

Thanks to all.
Removing all dependencies to webservices-rt-2.3.jar, the problem persist.

So, does the problem may be in eclipselink weaving?

Rob Spoor wrote:There's the root of your problem. Is this EntityBase your own class? Does it have a void _persistence_set(String, Object) method?

This method not exists.
EntityBase is a MappedSuperclass that it's used by other entity. The weaver add this method at runtime.
If i deploy the EAR in a running wildfly environment, the application works fine, no problem.
The problem occurs only if the application is deployed automatically at Wildfly's startup

Another hint:
during startup this message appear:
[org.jboss.as.server.deployment] JBAS015960: Class Path entry webservices-extra.jar in webservices-rt-2.3.jar does not point to a valid jar for a Class-Path reference.

If i remove from EAR the module BssStdODan_wss-1.0-SNAPSHOT.jar that contains web services and include webservices-rt-2.3.jar as dependencies, all work good.

Maybe the problem is in webservices-rt-2.3.jar? Or in eclipselink weaving?
Hi to all.

I have an EAR with a lot of modules and library in it.

I use wildfly 8.1.0 and eclipselink 2.5.2 as persistence provider.

Suppose i have wildfly started, then i open the console and deploy the EAR: ok!

I can access web pages, do login with JAAS , read data from DB with EJB+JPA.

Shutdown wildfly and restart it...
2015-09-16 12:40:22,913 INFO [org.jboss.as] (MSC service thread 1-5) JBAS015899: WildFly 8.1.0.Final "Kenny" starting
The server start to autodeploy my EAR
2015-09-16 12:40:25,134 INFO [org.jboss.as.server.deployment] (MSC service thread 1-15) JBAS015876: Starting deployment of "BssWebCore_ear-1.0-SNAPSHOT.ear" (runtime-name: "BssWebCore_ear-1.0-SNAPSHOT.ear")
then it deploies persistence unit, EJB and a soap web service... all ok
After that, it starts javax.ws.rs.core.Application for REST web service and I get the following error:

In my javax.ws.rs.core.Application i read the jndi to start as REST resource from a DB using an EJB.

If i disabled the EAR and re-enable it, all work fine!

Tested also on wildfly 8.2.0.Final with same results

What can be the problem?
I had too a logout button in the template, inside a h:form but i don't remember if i get problem.

You can check:

  • 1) If the web page was shown, open the source code (from browser) and investigate if the form and the link was correctly rendered;
    2) Are there nested forms?
    3) Check if the LoginBean was created: are there problem with the constructor or the postConstructor? For experience, most of times I had that problem because i made error in the constructor of beans. To test it, create a property String test and a getter method and put it in the template and in the included page.

  • Another way, you can simply put the form and the button in a page like _logout.xhtml and use inclusion in template

    This solution provided smaller xhtml pages and focused on a concern... if you want to change logout in a button, you need only to modify _logout.xhtml

    NB: pay attention with primefaces and multiple forms, with prepended id on component ;)
    8 years ago
    Of course!

    This is _resources.xhtml

    The pages start with <ui:composition> and after i wrote the code directly.
    There are problem if you write <h:head> or <h:body> in the included page: if you use h:heador h:body in the resultant page will be 2 body or 2 head, so primefaces have problem to manage components
    8 years ago
    Suppose you have a file "carousel.xhtml",

    Do you want to include it in a template file "template.xhtml" that it's used by the other pages?

    In this case, just use <ui:include> :

    this example include a file in the head with a collection of css and js inclusions and a file in the body containing the header , in you case that file can be "carousel.xhtml"
    8 years ago