Reputation: 2393
I want to deploy a jar on glassfish 4 with the command asadmin deploy testapp-1.0-SNAPSHOT.jar
in the terminal. The complete layout of the jar is
/META-INF/MANIFEST.MF
/META-INF/maven/com.test/testapp/pom.properties
/META-INF/maven/com.test/testapp/pom.xml
/com/test/testapp/*.class
But every time i get the error
remote failure: Archive type of jar was not recognized
Command deploy failed.
I compile and package the jar with maven.
Thanks in advance.
Upvotes: 3
Views: 6802
Reputation: 124
As in this post, replace lambda expressions from your code and try again. Will work, I'm sure.
Upvotes: 0
Reputation: 2393
It seems like individual jar's can only be deployed if they contain Enterprise Java Beans.
There are two options to make a class an Enterprise Java Bean.
Annotate the class with a component defining annotation from the package javax.ejb
(e.g. javax.ejb.Stateless
)
Specify the Enterprise Java Beans in the deployment descriptor ejb-jar.xml
(or glassfish-ejb-jar.xml
if using Glassfish) packaged in the META-INF directory as illustrated in 5.2 Packaging Enterprise Beans
This is a simple example taken from Simple Stateless with Descriptor
<ejb-jar 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/ejb-jar_3_0.xsd"
version="3.0">
<enterprise-beans>
<session>
<ejb-name>CalculatorImpl</ejb-name>
<business-local>org.superbiz.calculator.CalculatorLocal</business-local>
<business-remote>org.superbiz.calculator.CalculatorRemote</business-remote>
<ejb-class>org.superbiz.calculator.CalculatorImpl</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
Upvotes: 6
Reputation: 554
You don't deploy JAR files into a Java EE container. You want to package in a WAR or EAR file, which may have JAR files in its WEB-INF/lib directory.
Upvotes: 2