I am trying to migrate an application from JBoss 4.0.5 to JBoss 6.1.0. I use ant for deployment. This is my application.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<application 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/application_6.xsd"
version="6">
<application-name>Fantana</application-name>
<module>
<ejb>fantana.jar</ejb>
</module>
<module>
<web>
<web-uri>fantantaWeb.war</web-uri>
<context-root>/</context-root>
</web>
</module>
<module>
<web>
<web-uri>fantanaTerm.war</web-uri>
<context-root>/</context-root>
</web>
</module>
</application>
When I deploy I have the following files generated in the "deploy" folder of the server.
fantana.jar
fantana.war
fantanaWeb.war
fantanaTerm.war
When runnning the server I get the following issue:
15:34:29,296 WARN [Digester] Empty stack (returning null)
15:34:29,319 INFO [TomcatDeployment] deploy, ctxPath=/crud
15:34:29,364 ERROR [AbstractKernelController] Error installing to Real: name=vfs:///D:/abujdei/develop/jboss-6.1.0.Final/server/brendolan/deploy/fantana.war state=PreReal mode=Manual requiredState=Real: org.jboss.deployers.spi.DeploymentException: Error deploying: jboss.naming:application=fantana
Caused by: java.lang.IllegalStateException: jboss.naming:application=fantana is already installed.
I know this issue has been adressed before but I am unable to understand why this happends.
If necessary I can provide more information. Thank you.
#ionutab
So ok. I have renamed the file
fantana.war
into
fantanaCore.war
I have read in several posts over the internet that somehow necause fantana.jar and fantana.war have the same name it is not ok.
I have renamed it in the ant task, not in the filesystem. (VERY IMPORTANT)
If you come upon something like this write me here. Maybe I can help.
I found the link here very useful. Thanks.
Related
I am using JBoss EAP 7 and want to deploy an EAR file in standalone mode (using standalone-ha.xml).
I went through almost everything available on StackOverflow/JBoss forums but couldn't make my deployment to work (correctly). I have followed the docs to the best of my abilities but still the deployment of EAR gives Exception on console because the jar files inside WAR/WEB-INF/lib are not able to see the jar files present int EAR/lib folder. I can't figure out what I am doing wrong.
Structure
myEAR.ear
|- lib (contains a.jar)
|- META-INF
|--- maven (folder with pom)
|--- application.xml
|--- jboss-deployment-structure.xml
|--- MANIFEST.MF
|- myWar.war
|--- WEB-INF
|----- lib (contains b.jar)
|----- jboss-deployment-structure.xml (which should be ignored per the docs)
|----- (WEB-INF contains other files/folders such as classes,jsp etc
EAR- application.xml:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_7.xsd" version="7">
<display-name>myear</display-name>
<module>
<web>
<web-uri>myWAR.war</web-uri>
<context-root>/mywar</context-root>
</web>
</module>
<library-directory>lib</library-directory>
</application>
EAR- jboss-deployment-structure.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<deployment>
<dependencies>
<module name="com.organization.global" export="true" />
</dependencies>
</deployment>
<!-- Having/Not having below sub-deployment has no effect -->
<sub-deployment name="myWAR.war">
<dependencies/>
</sub-deployment>
</jboss-deployment-structure>
Deployment succeeds if I copy a.jar inside WAR/WEB-INF/lib/ folder, otherwise gives an exception: Caused by: java.lang.NoClassDefFoundError related to a class specific to a.jar. I want my WAR to be able to get access to all the jars put together inside EAR/lib.
I read in one of the forums that the jar/classes in lib folder should be available to all modules within the EAR but sometimes they are not added automatically but I couldn't find the solution on how to add them.
Any guidance would be appreciated. Thanks in advance!
In JBoss EAP 7, to access lib files present in ear inside war you could try by adding a context param in your war's web.xml.
To create env variable try below in terminal:
export JAR_HOME=../jboss-eap-7.1/standalone/deployments/example.ear(Please add value equivalent to your environment and ear's path)
export PATH=$PATH:$JAR_HOME
Add this variable to web.xml as file:${JAR_HOME}/lib/example.jar
Read this context param inside your classes present inside war.
If I have an EJB packaged in a WAR because it is exposed as a REST web service, according to this link, I need to have the ejb-*.xml files at the root of the WEB-INF directory. My current environment is Websphere 8.5 and EJB 3.1
If I later add multiple EJBs ( in separate EJB projects ) in the same application and define its deployment descriptors in the respective projects, those seem to be ignored. It appears that ALL of my descriptors should be defined in the descriptors in the WEB-INF directory - or in other words, it seems that I should augment the descriptors in WEB-INF directory even for EJBs that are defined as separate projects.
Is this how it needs to be or am I missing something that is forcing me to do this? I could not find any documentation explaining this part.
More Details:
This is how my application.xml looks like
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_7.xsd"
version="7">
<display-name>MyApp</display-name>
<module id="Module_1395346343165">
<web>
<web-uri>MyWeb.war</web-uri>
<context-root>myapp</context-root>
</web>
</module>
<module id="Module_1395346304194">
<ejb>ejb1.jar</ejb>
</module>
<module id="Module_1424684968934">
<ejb>ejb2.jar</ejb>
</module>
<module id="Module_1431010943758">
<ejb>ejb3.jar</ejb>
</module>
</application>
The ejb1 is the one that will live in the webapp. The other two, ejb2 and ejb3 are separate ejb projects that are supposed to be in EAR's root.
For EJBs in a WAR module, the files go in WEB-INF, so .ear!/MyWeb.war!/ejb-jar.xml, .ear!/MyWeb.war!/ibm-ejb-jar-bnd.xml, etc.
For EJBs in separator EJB modules outside a WAR, the files go in META-INF. So, .ear!/ejb1.jar!/META-INF/ejb-jar.xml, .ear!/ejb1.jar!/META-INF/ibm-ejb-jar-bnd.xml, etc.
I already made some research on Google and SO but could not find a solution.
I am writing a java ee 7 Web application including Omnifaces and Primefaces using Eclipse. When deploying the application to Glassfish 4, I get the following error:
javax.naming.NamingException: Lookup failed for 'java:comp/BeanManager'
The longer part of the stacktrace is
java.lang.IllegalStateException: javax.naming.NamingException: Lookup failed for 'java:comp/BeanManager' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: Error retrieving java:comp/BeanManager [Root exception is java.lang.IllegalStateException: Cannot resolve bean manager]]
at org.omnifaces.util.JNDI.lookup(JNDI.java:87)
at org.omnifaces.config.BeanManager.init(BeanManager.java:76)
at org.omnifaces.config.BeanManager.getReference(BeanManager.java:115)
at org.omnifaces.application.OmniApplication.createConverter(OmniApplication.java:86)
at javax.faces.application.ApplicationWrapper.createConverter(ApplicationWrapper.java:403)
at org.primefaces.config.ConfigContainer.initConfig(ConfigContainer.java:69)
But I highly doubt that the problem is related to Omnifaces, it's more to state that I didn't do any messy call to cause this.
There is a beans.xml in WEB-INF, it's not completely empty.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
bean-discovery-mode="all">
<interceptors>
<class>x.y.z.security.SecurityInterceptor</class>
</interceptors>
</beans>
For the discovery-mode=all, I know it is not recommended, but this is due to an issue I found here: https://java.net/jira/browse/GLASSFISH-20667
If you need more information, facets config or the like, I am happy to post it - but as I've run out of ideas where to locate the problem I don't want to post the everything like complete POM, Glassfish, Eclipse, Maven config or all the code.
edit 2014-01-27:
Ok, after I had written my below comment (the one in comments), I got an idea. Can someone maybe check it out/confirm easily? I was able to load the application to GF after recreating a new database. Can eclipselink cause the above? I am using MS SQL Server 2012, and of course I get SQLExceptions and warnings that tables+fks already exist when redploying, but warnings should not fail my application deployment, should they?
<persistence-unit name="xyzPersistenceUnit" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/xyzDS</jta-data-source>
<properties>
<property name="eclipselink.ddl-generation" value="create-tables"/>
</properties>
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!
Here is my setup
SDK: Eclipse Ganymede (3.4.2)
App Server: jBoss 4.2.3GA
I got three projects:
MYAPP, which is the main project, with only libraries and log4j configurations. This is where application.xml and jboss-app.xml resides.
MYAPPEJB, which is my business logic project in which I have my entity beans, sessions beans.
MYAPPWeb, which is my client logic project in which I have my Struts Forms, Struts Actions, JSPs and Jasperreports reports.
When I publish my project to my jBoss server on my laptop, I got the following EAR file name: MYAPP.ear, which make sense.
I would like to define a different custom name for the final EAR, let's say ACCOUNTMANAGER.ear
Here is my application.xml file
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd" id="Application_ID" version="5">
<display-name>MYAPP</display-name>
<module>
<ejb>MYAPPEJB.jar</ejb>
</module>
<module>
<web>
<web-uri>MYAPPWeb.war</web-uri>
<context-root>/manager/myapp</context-root>
</web>
</module>
<library-directory>/lib</library-directory>
</application>
Any idea?
Thank you
Charles
You can specify your ear file name in application.xml file under web -> web-uri tag. Please check this link for your reference. web-uri
You can specify in application.xml file. It will pick up this name instead of ear file name.
MyEarName