Can deploy the app from Netbeans but not from the Glassfish AdminConsole - java

I have an Enterprise project with an EJB module and a Web module.
I am trying to deploy these modules separately on Glassfish server (local) on my machine.
If I right click and deploy these projects from Netbeans, they get deployed and run good.
But if I try to deploy them from the Glassfish AminConsole,
the ejb module gets deployed successfully without any problem.
but the web module deployment fails.
The ClassDefinitionNotFoundException is thrown for all the EJBs in the ejb module.
But the ejb module jar is in the war file (in the WEB-INF/lib folder).
I am using Netbeans7.0 and Glassfish 3.1.
What's the right way to handle this problem?
Thank you.

It was actually the Netbeans that did not include the ejb-jar inside my war when build the application as ear. And the fix was to build them (jar and war) individually.

Related

deploying WAR and EJB-jar files separately

I have an application which I am deploying on GlassFish. It has an EJB-tier with (JPA) Entites and EJBs to get access and write to the database and it has 3 (independent) web apps. Everything is built with Maven.
ServerApplication
|
+-ServerApplication-ear
+-ServerApplication-ejb
|
+-GrumpyCat (war)
+-HummingBird (war)
+-Koala (war)
All three war projects depend on the ejb project. When compiling/building the ear, it copies the war files to the ear project and then I can deploy the ear file on GlassFish.
This works fine, all 4 modules (the ejb, and the 3 war) get deployed without problems and I can access the 3 war projects like:
myServer.com/GrumpyCat
myServer.com/HummingBird
myServer.com/Koala
My problem is, that I can't deploy a single war project on its own. For example when I change something in the koala project, I would like to be able to build only the koala.war and deploy it on the server, without having to upload and deploy the complete ear file.
But when deploying, GlassFish tells me either :
there is already a project deployed on Koala (true, it was deployed together with the ear)
or (when I change the build-version) it doesn't "know" the ejbs and I get a number of ClassNotFound Exceptions.
Is there a way to deploy the modules of the application one by one?
Your second approach is the way to go if you really want to deploy them individually. However, you are seeing a ClassNotFound exception because the WARs are individual projects and as such don't have access to the EAR's class path.
To make that work, you have to add the public API of your application to your WAR's classpath. The public API consists of at least the EJB's remote interfaces of the EJBS that you would like to access from the WAR and any DTOs used in your API.
The easiest way is to create a separate package (such as com.example.api) and let a build tools such as ant or Maven bundle that api package together with your EJBs and your WARs, or you create a myapp-api.jar and include it in the respective class-paths.
Then you can remove the WARs from the EAR and deploy them as separate projects.

Glassfish4 cannot create singelton exception

I have a system consist of ear project and some related EJB and JSF projects. I was using glassfish3.1.2, the EJB projects were exported into EJB jar and added to the deployment assembly of the EAR project. Everything was ok until i tried to upgrade the application server into glassfish4. when i run the EAR project in glassfish 4 an error indicate that cannot create singleton session bean pop up from eclipse for every bean i have in the ejb jars . but if i add the EJB project instead of ejb jar to the deployment assembly of the EAR project the EAR will deploy normally.
so is there a problem of adding ejb .jar files to the deployment assembly of Ear projects in glassfish 4. note that my ear project run well in glassfish 3.1.2 but i need glassfish4 in order to use jpa 2.1 .

Difference in EAR Deployed in Websphere Application server. (war to ear )

I have a web application(Myapp) configured in eclipse.
So in order to Deploy it in Websphere v5.1 I have to export it to EAR.
Scenario 1: In eclipse--> new --> Enterprise Application Project
-->Named as MyappEAR--> Selected Existing Module(Myapp)--> Finish. Now I got MyappEAR in Project Explorer. Right click on MyappEAR export to
EAR. Done. Got MyappEAR.ear file with Myapp.war inside it.(Includes
META-INF and xml)
Deployed MyappEAR.ear in Websphere, Deployed Successfully. But when i
tried to start MyappEAR it ends up with this error SRVE0054E: An error
occurred while loading Web application (No more information found).
Scenario 2: Eclipse--> right click on Myapp export to war--> Got
Myapp.war--> Deleted existing myapp from Project explorer.
File-->Import-->WAR--> enabled Add project to an EAR and named it as
MyappEAR-->finish Right click on MyappEAR-->export to EAR. Done . Got
MyappEAR.ear with same stuff as above.
Deloplyed and Started working fine.
Now my question is What's the difference in both ways causing that error? (even checked with beyond compare, everything is same).
Websphere app server v5.1,
Java 1.4,
Eclipse Indigo.
We have a Maven project and it builds the EAR after we run mvn clean install.Then I take EAR from target folder and deploy it in server.
In local setup,Just add the project in server and start the server.Normally it works.

Maven embedded tomcat deploy war file

I'm using maven and the embedded tomcat through the tomcat-maven-plugin to run my Spring MVC project. Now I've got a another war file which I also want to run on this tomcat. Is there a way to achieve this? It doesn't seem to work, when I put the war file in the webapps folder of the embedded tomcat.
support of this feature is in snapshot version of the plugin see https://issues.apache.org/jira/browse/MTOMCAT-169

Netbeans does not package class library jar to ear file when deploying Enterprise Application

I build a java enteprise application in netbeans 7.1 which consists of two EJB modules. One of the EJB modules has a reference to another class library project, lets call it MyUtilities. When i deploy the application, its ear file does not contain MyUtilities.jar file. When i add to the other EJB module libraries MyUtilites project, although its not necessary, the ear file is built correctly and under its lib folder, MyUtilities.jar exists.
Anyone with the same issue?
Thanks
Did you check the setting of the checkbox "Package required JARs in EJB jar" in the Build | Packaing dialog?
This is a new option which I found after upgrading a NetBeans 6.5.1 EJBModule project which had also no longer the references JARs bundled in the EJB jar.

Categories