Access ear's classpath from war - weblogic

In weblogic app server I deployed EAR and WAR.
I want to know it WAR can access the jars defined in classpath of EAR (META-INF\Manifest.mf).
*And latter dynamically load them in war, but this is other matter...

Related

How to download JAR from Maven and add to non-Maven IntelliJ WAR project

I need to setup https://github.com/adminfaces but i can't make it work at all. I get errors in wildfly deployment.
I setup intellij project, i select framework support for JSF, and Primefaces which are prerequisites. But than docs say:
Add admin theme to your classpath:
<dependency>
<groupId>com.github.adminfaces</groupId>
<artifactId>admin-theme</artifactId>
<version>1.0.0-RC9</version>
</dependency>
How do i do this if i don't use maven? Can i set it up, via some jar file. Also i don't get it, if i download release from github, what is install.sh?
But even if i added it through maven via Intellij browser it still doesn't work. Can't deploy to Wildfly.
Maven library can be added to non Maven project through Intellij IDEA.
Project structure->Libraries->Add library->From Maven
AdminFaces jars are published to maven central, you can download it there, see here.
Just add admin-template and admin-theme to your classpath.
Also it depends on OmniFaces (2.x) and PrimeFaces (5.1.1 or greater) and also JavaEE apis such as servlet, EJB, CDI, JSF and JPA.
If you are running it outside a JavaEE container such as Tomcat take a look at Admin Starter Tomcat dependencies, you should be able to download them from maven central as well.

Intellij exploded deploy to JBoss EAP

I would like to deploy a maven based multi project to Jboss EAP. According to several article I configured output directory to end with ear, like: C:\project\module-ear\target\module-ear-1.0-SNAPSHOT.ear. Ear project contains a war and jar projects
First deploy works fine, although I'm not able to refresh classes and resources directly. If I modify something in war project, I cannot see deployed.

How to do Class Loading in Tomcat

How to do Class Loading in Tomcat
In my web app folder I have deployed a war and in that war there are some libraries which are clashing with my tomcat lib folder. Also, I don't want to remove any of my libraries.
If you are not ready to remove your libraries you can go on with removing those package with Tomcat AS.But could you be more accurate in your description.What are libraries that leads to conflicts? What are you packging in your war file?

Is it possible to deploy an exploded war file to JBoss 4.2.3?

I'm trying to use IntelliJ to deploy exploded wars to JBoss 4.2.3. I seem to have no problem with doing this with 5.0.1.
But when I switch the server to 4.2.3, IntelliJ tells me that the extension for the exploded war is invalid, which makes very little sense, given that it is an exploded war. It seems to be expecting a .war file extension.
It seems that JBoss 4.2.3 can only take compressed war files, though I haven't found documentation to prove it.
Is there a way to configure JBoss 4.2.3 to accept exploded wars?
JBoss 4.x requires the exploded directory to have .war in the end of its name, adjust IDEA artifact settings and it will work fine.

Is there a Maven plugin to package Entity beans in J2EE app?

I haven't found a Maven plugin or target that will package my app and deploy it to Glassfish without error. I get this exception:
[ERROR] com.sun.enterprise.admin.cli.CommandException: remote failure: Exception while preparing the app : java.lang.RuntimeException: Could not resolve a persistence unit corresponding to the persistence-unit-ref-name [org.us.impl.MyClass/entityManagerFactory] in scope of the module called [man-java-really-stinks-app]. Please verify your application.
This isn't a Spring/Hibernate/EntityManagerFactory/Jpa problem. The app runs fine in the embedded Maven Glassfish container.
I changed packaging to ear in my pom.xml and got this when I deployed to Glassfish
Error during deployment : org.xml.sax.SAXParseException: The content of element type "application" is incomplete, it must match "(icon?,display-name,description?,module+,security-role*)".
IS there a plugin that will take care of the J2EE packaging requirements?
Bonus question: Since the Entities (just POJOS!) and the application need to be packaged differently, is it best to separate these into Maven sub-projects?
I haven't found a Maven plugin or target that will package my app and deploy it to Glassfish without error.
For the packaging, there is everything you need: the maven-jar-plugin for JARs (including JARs packaging JPA entities), the maven-war-plugin for WARs, the maven-ejb-plugin for EJB-JARs, the maven-ear-plugin for EARs, the maven-rar-plugin for resource adapters.
This isn't a Spring/Hibernate/EntityManagerFactory/Jpa problem. The app runs fine in the embedded Maven Glassfish container.
Well, I'm still tempted to say that there is a JPA configuration problem somewhere anyway, the container is clearly failing at finding a (default?) persistence unit. But since I have no idea of the kind of app you're running (I guess it's a webapp but would like to get confirmation), what your persistence.xml looks like, how you inject the EntityManager, how you configured the database access, how you configured Spring, the version of GlassFish you're running, etc, etc, it will be hard to say anything more.
I changed packaging to ear in my pom.xml and got this when I deployed to Glassfish
That's not that easy. Building an EAR typically involves a multi-modules build, and you are expected to provide a special deployment descriptor. But I'm not convinced you need an EAR packaging and if you can avoid it, don't use it.
IS there a plugin that will take care of the J2EE packaging requirements?
As I said, there are plugins for everything you need, from J2EE to Java EE 6. Just provide the details requested above.
Bonus question: Since the Entities (just POJOS!) and the application need to be packaged differently, is it best to separate these into Maven sub-projects?
Entities and the application do NOT (always) need to be packaged differently, you can package entities directly inside a WAR (I'm extrapolating but I suspect this is your case). I just think you have a configuration problem somewhere, even if the application is running in GF Embedded.
By the way, almost Everything is POJO in Java EE (Entities, Session Beans, Message Driven Beans, etc), but there is no direct consequence on packaging, packaging and POJOness are unrelated.
org.us.impl.MyClass had a #PersistenceUnit annotation. The persistince is managed by Spring, but Glassfish takes a sweep of the annotation classes and tries to resolve it itself. You can tell Glassfish to knock it off by adding
metadata-complete="true"
to your web.xml, like so
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
metadata-complete="true">
Further reading: https://glassfish.dev.java.net/issues/show_bug.cgi?id=4204