Websphere v8.0.0.6 WASX7017E, ADMA0209E Application exception while Deployment of EJB 2.0 EAR - deployment

I have the following problem with WebSphere 8.0.0.6 and no solution is found on the web. I hope anyone can help with this and this will help someone else with this problem.
Error Description:
Error #1 (while installing application):
WASX7017E: Exception received while running file /tmp/wsant3816346180883063201jacl;
exception information:com.ibm.websphere.management.application.client.AppDeploymentException:
com.ibm.websphere.management.application.client.AppDeploymentException
Following Error:
ADMA0209E: Enterprise JavaBeans (EJB) module ServerEJB.jar contains the following
container-managed persistence (CMP) or bean-managed persistence (BMP) :
... (list of all entities)
Explanation:
I generate an EAR with an EJB 2.0 component/project. Up to now I have deployed this EAR within WAS 6.1 successfully, but with WAS 8 it doesn't deploy anymore.
I have the necessary bind-ejbjar.xmi, even in the new format - converted with the script from IBM.
Questions:
WAS 8 still seems to know that there exists a EJB 3 component in the EAR - the question is WHY?
What is the minimum requirement for a EAR/EJB-Module to deploy in WAS 8 - there must be big changes?
Are there more bind-files to be included?
Thanks for help
UPDATE:
So obviously there are prerequisites to declare a package as EJB2.x.
See IBM-HelpCenter:
IBM WebSphere info for developers DE
But I fullfill all of this two prerequisites.
How do I have to package the jar for Websphere 8 to make it acceptable as an EJB2.x?
http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/index.jsp?topic=%2Fcom.ibm.websphere.zseries.doc%2Fae%2Frejb_consid.html&lang%3Dde

The solution was achieved by upgrading to version 2.1 ejb, because there the "version" attribute is allowed and this is required by WebSphere to recognize a non-EJB 3.0 version.
This means that an EJB 2.0 version can not work, since the above tag is not allowed in the ejb-jar_2_0.dtd. Maybe a
<cmp-version>2.x</cmp-version>
could help here, but I didn't tested it.
The conversion of the header of ejbjar.xml brought success:
from 2.0 (ejb-jar_2_0.dtd):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
"http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<!-- EJB-jar file declaration -->
<ejb-jar id="EJBJar" version="2.0">
<display-name>Overall Bean Definition</display-name>
<enterprise-beans>
<entity id="Dcnotetext">
...
to 2.1 (ejb-jar_2_1.xsd - you need namespaces! ):
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar id="EJBJar"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.1"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
<!-- EJB-jar file declaration -->
<display-name>Overall Bean Definition</display-name>
<enterprise-beans>
<entity id="Dcnotetext">
...
No further changes to XMI or XML files were necessary!
Thanks for help!

Related

Class name is wrong or classpath is not set ERROR in Netbeans with Glassfish 5 server and JPAs

I have a Web Application in Netbeans 11 (with JDK 8 installed), I have added the dependencies for mysql-connector-java-8.0.15.jar and I have generated the JPAs from my DB.
No error while building it.
But when I try to run it, the Glassfish server give me these errors (pastebin link).
This is my persistence.xml, that I set accordingly, is:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="InvoicesPU" transaction-type="JTA">
<jta-data-source>java:app/Invoices</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties/>
</persistence-unit>
</persistence>
And in my java class I call it by:
#Stateless
public class InvoiceEJB implements InvoiceEJBLocal {
#PersistenceContext(unitName = "InvoicesPU")
EntityManager em;
...
em.someMethod();
For completeness, I have no error during the compilation phase!
Anyone know how to solve it?
After some research I solved it in this way:
taking inspiration from a similar problem, I created the Connection Pool and the Resource in the Glassfish Admin Console as suggested by devmind following this.
I removed as dependency the mysql-connector-java-8.x.x.jar and I added the mysql-connector-java-5.x.x.jar
In the persistence.xml I set the JNDI name for the tag jta-data-source
And everything goes as expected!
I don't know how to make everything work with the latest version of the MySQL Connector but, at least, in this way my Web Application works.
EDIT: for latests versions of mysql-connector, as devmind has suggest you should set MysqlDataSource: from com.mysql.jdbc.jdbc2.optional.MysqlDataSource to com.mysql.cj.jdbc.MysqlDataSource as reported here.
I hope it's useful to someone else.
Try to put your JDBC driver jar to Glassfish domain's lib folder. I usually store them in lib/ext.
I do not remember if I got this info from some other post or from the Glassfish user manual but it solves the issue mentioned for me, i.e.: Class name is wrong or classpath is not set ERROR with Glassfish 5 or Payara server. I'm using Payara Server 5.2022.3 currently.
Add the latest connector j to your server/your_domain; in my case it is domain1 and this is the script after I cd to /bin:
C:\Program Files\payara-web-5.2022.3\payara5\bin>asadmin add-library --type app "C:\Program Files (x86)\MySQL\Connector J 8.0\mysql-connector-j-8.0.31.jar"
Where quoted string is the path where I keep my connector j.

Persistence unit missing dependencies migrating from JBoss EAP 6.4 to 7.0

I have an application that must run on both JBoss EAP 6.4 and 7.0. The application uses EJB entity beans which are no longer supported on JBoss EAP 7 so the entity beans are being migrated to use JPA entities as described in the JBoss migration guide. The application deploys and works fine on 6.4 but fails to deploy with "missing dependencies" error on 7.0. I've seen alot of issues where the missing dependency was the datasource but that doesn't seem to be the case here. The datasource isn't mentioned at all in the missing dependencies error. I can see in the logs the persistence.xml file is being parsed and the jndi bindings added for the session beans before the deployment fails.
I have an EAR file that contains multiple war and ejb jar files. The application I'm having an issue with consists of an ejbModule.jar which contains the persistence.xml file and entity classes, and a webModule.war file with taglib classes that reference the entity classes contained in ejbModule.jar.
The structure of the EAR file is outlined below:
MyEAR.ear
- ejbJar.jar
- webApp1.war
- webApp2.war
- ejbModule.jar (contains persistence.xml and entity classes)
-- META-INF/persistence.xml
- webModule.jar (taglib classes have dependency on entity classes from ejbModule.jar)
- META-INF
persistence.xml: (replaced class names, datasource name, persistence-unit name)
<persistence version="2.0" xmlns:per="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="myPU">
<class>org.MyEntity1</class>
<class>org.MyEntity2</class>
<jta-data-source>java:/MyDataSource</jta-data-source>
<properties>
<property name="jboss.entity.manager.jndi.name" value="java:/myPU"/>
<property name="jboss.entity.manager.factory.jndi.name" value="java:/myPU"/>
</properties>
</persistence-unit>
It's difficult to post the error message as it's got hundreds of lines of "missing dependencies" for class names and application names that I can't share and by the time I replace them all I don't feel it would be of much use. But there are entries like:
"jboss.naming.context.java.comp.MyEAR.ejbModule.MyEntity1.InAppClientContainer is missing [jboss.naming.context.java.comp.MyEAR.ejbModule.MyEntity1]",
However there also entries like:
"jboss.deployment.subunit.\"MyEAR.ear\".\"webApp1.war\".component.\"org.taglib.MyTagLibClass\".START is missing [jboss.persistenceunit.\"MyEAT.ear/ejbModule.jar#myPU\"]"
I can see from the DEBUG logging for org.jboss.as.jpa that JBoss looks to be adding dependencies on the persistence unit for all taglib classes in all war files in the ear. Only the webModule.war needs to use the persistence unit.
2017-12-07 15:37:13,808 DEBUG [org.jboss.as.jpa] (MSC service thread 1-2) Adding dependency on PU service service jboss.persistenceunit."MyEAR.ear#myPU" for component org.taglib.MyTagLibClass
When I move the persistence.xml file to the META-INF directory of the EAR the application deploys and works fine on JBoss EAP 7.0. However, this isn't an ideal solution as the EAR file is built dynamically and could contain custom applications that I have no control over.
I've tried various other structures to try and get this working but haven't found anything else that works.
Any ideas how to get this working on JBoss EAP 7.0?
There are unnecessary entries in your persistence.xml
You just need this
<persistence version="2.0" xmlns:per="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="myPU">
<jta-data-source>java:/MyDataSource</jta-data-source>
</persistence-unit>
Because the entities will be found automatically relative to persistence.xml
Please try this and if doesn't help please post as much of the server.log as you can.
Another idea could be to ask the RedHat support as you use EAP I assume that you have subscriptions containing support.

2.2 versioned Orm.xml marshaling failed in Java EE 8/Glassfish v5/JPA 2.2(EclipseLink 2.7)

I am trying to add a orm.xml to register a EntityListener for all entities.
The following orm.xml will cause marshaling exception in console when deploy to Glassfish v5.
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://xmlns.jcp.org/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence/orm
http://xmlns.jcp.org/xml/ns/persistence/orm_2_2.xsd"
version="2.2">
<persistence-unit-metadata>
<persistence-unit-defaults>
<entity-listeners>
<entity-listener class="com.github.hantsy.ee8sample.support.AuditEntityListener" />
</entity-listeners>
</persistence-unit-defaults>
</persistence-unit-metadata>
</entity-mappings>
But if I change the version to 2.1, the exception will be disappeared.
Is this a EclipseLink specific bug?
Known issue in 2.7.0, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=521954 for details
btw: there is no difference between 2.1 and 2.2 version of the schema other than version number change

Liferay - Eclipse alloy tag library error

I am developing a portlet that runs on Liferay portal (I have currently Liferay+Tomcat7 bundle, it will later run on JBoss). I am using Eclipse Helios with Liferay IDE and Liferay SDK.
In my .jsp files, I use Alloy:
<%# taglib uri="http://liferay.com/tld/aui" prefix="aui" %>
Everything works fine - the portlet gets successfully deployed and is shown correctly.
The only problem is, that Eclipse is marking it as an error:
Description Resource Path Location Type
Can not find the tag library descriptor for "http://liferay.com/tld/aui" edit.jsp /PortletVisual-portlet/docroot line 2 JSP Problem
This is mainly a cosmetic error. Liferay IDE in Eclipse evidently doesnt understand these dependencies, although the project itself works fine. I can live with this "error marker", it doesnt bother me that much. I was just curious if there is a way to fix it.
Thanks for any tips!
EDIT: this is my web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>PortletVisual-portlet</display-name>
<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/portlet_2_0</taglib-uri>
<taglib-location>/WEB-INF/tld/liferay-portlet.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://liferay.com/tld/aui</taglib-uri>
<taglib-location>/WEB-INF/tld/aui.tld
</taglib-location>
</taglib>
</jsp-config>
</web-app>
Try this one:
<taglib>
<taglib-uri>http://liferay.com/tld/aui</taglib-uri>
<taglib-location>/WEB-INF/tld/liferay-aui.tld</taglib-location>
</taglib>
If not working try here
Hope I helped! Good luck!!!!

failed to run wicket examples on tomcat7

I downloaded wicket examples 1.6.0 and built successfully in netbeans7.2. but got errors when I tried to deploy on tomcat 7:
Cannot deploy the module. The context.xml file seems to be broken. Check whether it is well-formed and valid.
The module has not been deployed.
See the server log for details.
at
org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:210)
at
org.netbeans.modules.maven.j2ee.ExecutionChecker.performDeploy(ExecutionChecker.java:178)
at
org.netbeans.modules.maven.j2ee.ExecutionChecker.executionResult(ExecutionChecker.java:130)
at
org.netbeans.modules.maven.execute.MavenCommandLineExecutor.run(MavenCommandLineExecutor.java:212)
at
org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
heres the contents in context.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<!-- <Loader className="org.atmosphere.util.AtmosphereClassloader"/> -->
<Loader delegate="true"/>
</Context>
I prefer to run wicket in eclipse as it negates the requirement to mess around with an external tomcat instance.
If you are comfortable with eclipse and maven i would download wicket 1.6 example archetype via maven, import into eclipse and then in the test directory you can run the run.java class to get an internal jetty server host wicket for you.
this should get you started quickly without having to wrestle with tomcat configurations too.
Not really an answer but an alternative route to the same end point
Add parameter path to context tag, same path that app will be served:
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/application-path-name/">
<!-- <Loader className="org.atmosphere.util.AtmosphereClassloader"/> -->
<Loader delegate="true"/>
</Context>
Answer obtained from this question.