I am using maven and NetBeans. I was able to deploy and run my application. But now it throws an error:
Error occurred during deployment: Exception while deploying the app [portal-ear-1.4-SNAPSHOT] : Could not find sub module [portal-service-ejb-1.4-SNAPSHOT.jar] as defined in application.xml.
When I go to target/portal-ear-1.4-SNAPSHOT I can see portal-service-ejb-1.4-SNAPSHOT.jar But still it throws me this error.
My application.xml :
<?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">
<display-name>e2e-portal-ear</display-name>
<module>
<web>
<web-uri>portal-war-1.4-SNAPSHOT.war</web-uri>
<context-root>/portal</context-root>
</web>
</module>
<module>
<ejb>portal-repository-ejb-1.4-SNAPSHOT.jar</ejb>
</module>
<module>
<ejb>portal-service-ejb-1.4-SNAPSHOT.jar</ejb>
</module>
<library-directory>lib</library-directory>
</application>
Finally I resolved this bug.
So it was a file in C:\Program Files\glassfish-3.1.2\glassfish\domains\domain1\applications\portal-ear-1.4-SNAPSHOT
There was a file here. Which I think it saves the state of the application or something. I just removed it and everything now works fine.