Andrea Catania

Greenhorn
+ Follow
since Dec 05, 2014
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Andrea Catania

I have a Stateless bean where I want to allow access only to the client that I authorize.

The bean:



I know that anyone can access to this bean over the network..

How can I block all connections not trusted?

I using Wildfly.

Thanks in advance Andrea.
The question is that if I build a web app with EE technology the price for a server with WildFly on is too expensive?

I seen services offered by OpenShift but I haven't understood how he calculate the price for gears.
As says the OpenShift site there are 3 type of plans which one is totally free. If I purchase the bronze plan I have three gears free and the additional gears must be paid or must be paid all used gears? Can I mix small/medium/large gears for a single application or will be converted all gears for my app and I have to pay (0.05 x 24hour x 365day) for each gear?
How can I calculate how much gears I need for my application? I will use WildFly AS, with Mysql.
Thanks in advance
0 down vote favorite


I have made a simple project to test the EJB3 implementation.

Using maven I created into the project 3 modules respectively "MyEjb" the EJB, "MyWeb" the war, "MyWeb2" another war. The war module are the client of the EJB.

The problem is that when I deploy the EAR, the console says that there are 3 EJB context created one for each modules. The EJB context of the module MyEjb is not shared between the wars moduls, each of it take the data from each own MyEjb dependency.

I have to create the EJB interfaces in a separate JAR? I use Jboss as application server.

Here the full project: https://github.com/AndreaCatania/EjbTest

Here the console:
After some research I found that if i set into the POM the dependency like written below, maven get only the interfaces.

So I made a simple test.

I added new WAR module called "MyWeb2" that have a servlet that modify (using EJB) the text of a static variable; when I try to take the text of this varible using EJB from the module "MyWeb" I get the initial text servlet...

So i'm sure that there are more than 1 context from this static varible...
ohhh,Thanks to you all now working ( new repository: https://github.com/AndreaCatania/EjbTest)

But last thing.. To avoid the exception of "java.lang.NoClassDefFoundError" I added the dependecy on the pom of MyWeb module like written below.

The pom of MyWeb: https://github.com/AndreaCatania/EjbTest/blob/master/MyWeb/pom.xml


But I notice that there are two equal EJB running on the server, one for "MyWeb" and the other for "MyEjbs". I think it's absolutly wrong!
What is the correct way?


I have deployed both the EAR, WAR, EJB; and not only the EAR because when I deploy only the EAR the other modules are not deployed.
Thanks a lot for the support.

Jeanne Boyarsky wrote:I've added this to our Maven forum since I think you are having build problems (and not just EJB problems.)

Does the Maven project in github build for you? The POM references two modules:


Only the second is in github. And the parent pom is of packaging type pom. I'm trying to find two things in your project:
1) The pom.xml that generates an ejb
2) The pom.xml that generates a war

Knowing where these live will confirm you have something consistent. Also, why are you deploying the ejb separately than the war? At least when beginning, it is good to use a local ejb call. In which case the EJB project is a dependency for the WAR project and not something that gets deployed separately.



I explain what I have to do, let me know if I miss something.
I have to build a projects that look like this:


I will have 3 pom, 1 for the "MyProject" that contains the reference to modules WEB and CORE
The WEB module has a pom that generate a WAR, and CORE module has a pom that generate a EJB.

When I have to choose what I have to deploy into the server I have to select only "MyProject" because his POM will generate automatically the module (WEB, CORE).

If All it's right, which artifact should I use during the creation of "MyProject"?
Very very thanks for the feedback and your response.
Now I have created another project using your advices; Now the WAR file contains the EJB that's called "myejbs".

The entire projects is here: https://github.com/AndreaCatania/ejbtest

The problem remain, i know the cause but i don't know how to resolve it.
The interface "NamerRemote" used into the servlet Test.java is not found when the class is compiled becouse it's into the "myejb" module (here).
I remind you that I get this error during deployment, I deploy for first the "myejb" module than the WAR file.

I miss something to understand...

The new stack trace
Hi all, I'm trying to learn EJB technology. I have made a simple project to test the stateless EJB3 following some tutorial.
Using Jboss eap 6.2 as server, and Maven to create a project that is my EJB, under this project i created a module "myweb" that is the client which shows, using a servlet, the EJB datas.

The entire projects is here: https://github.com/AndreaCatania/ejb2

During the deployment i receive this:


The full stack is that:


What's wrong?
If you need more infos, please let me know.
Thanks for your time in advance
Oh.. Simply clear.

You know where can I read how it works in depth, and how it can be implemented?

At last, if I can ask for an advice, the architecture as explained above is it correct, or can be improved?

You helped me a lot... Thanks!!
Hi and thanks for response,

To simplify my understanding I focus only to EJB.
There are some articles that explain the EJB but I can't find one that explain correctly.
The servlet is used for http communication (like client <--> server), the EJB is used in other architecture (maybe server <-> server)
Some articles describe the EJB like a bean that can be sent over the network.. other articles describe like a class that provides methods, over the network, using particular protocols..
Obviously I'm confused about that, can you explain what is EJB, and when must be used please?

(PS. this is why I can't understand the difference between application server and servlet container).
Hello everyone,

From several days I'm trying to understand the real differences between Tomcat and Glassfish, I state that up to now I have always used php and Java + Tomcat and I think that this limits the way I see the web app, but could change with the understanding of Application server working.
From what I read GlassFish is an application server, and not a simple servlet container.

Using Tomcat I structured my app using the MVC pattern, and in a single WAR file I will put the client side code (such as html,js,css) and the business code (such as Java classes).
The app is divided in 2:
1. The former contain the engine that generates the html pages which client can request, and the APIs used like a bridge between the client side interface and business code into server.
2. While the latter is the business code of application.

The APIs are developed extending the HttpServlet class, and works as:

For developing a real enterprise application this architecture is well formed?

If the answer is yes, then what is the real difference between application server and servlet container (EE) considering the fact that you can import all EE libraries into the application and can be run on tomcat in the same way of Glassfish or other application server.
Why an application server is better than servlet container?

Thank you all, I hope that I been enough clear, thanks again for your time bye.