Hot questions for Using GlassFish in deployment

Question:

I am trying to deploy my first rest application using jersey 2.17.

I am using Maven, GlassFish 3.1.2.2 for deployment.

Application runs in eclipse (tomcat), but gives following error when deploying through glassfish admin console.

Error occurred during deployment: Exception while loading the app :
  java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException:
  java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map;. 
Please see server.log for more details.

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>JerseyExample</groupId>
    <artifactId>JerseyExample</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <build>
        <sourceDirectory>src</sourceDirectory>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <warSourceDirectory>WebContent</warSourceDirectory>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.glassfish.jersey.containers</groupId>
            <artifactId>jersey-container-servlet-core</artifactId>
            <version>2.17</version>
        </dependency>
    </dependencies>
</project>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    id="WebApp_ID" version="3.0">
    <display-name>JerseyExample</display-name>
    <servlet>
        <servlet-name>MyJerseyExample</servlet-name>
        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
        <init-param>
            <param-name>jersey.config.server.provider.packages</param-name>
            <param-value>jerseyExample.resource</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>MyJerseyExample</servlet-name>
        <url-pattern>/example/*</url-pattern>
    </servlet-mapping>
</web-app>

Answer:

Ok looked at your issue. The External Glassfish v 3.1.2.2 that you are using is JAVA-EE 6 compatible. And the one through which you are running your app in eclipse is JAVA-EE 7 compatible.

Have a look at both the java docs:

Application class Java Doc for EE6

Application class Java Doc for EE7

You will see that the getProperties method got introduced in JAVA-EE 7.

Simply upgrade to glassfish version-4.x that is compatible with JAVA-EE 7. Assuming nothing else breaks should be good.

Question:

When trying to deploy I get this errors, and cant find the answer.

I was still running smoothly yesterday, without delete or modify anything. Today turn on and have this error.

     Artifact name:ejb exploded: Error during artifact deployment. See server log for details.
 Artifact name:ejb exploded: java.io.IOException: com.sun.enterprise.admin.remote.RemoteFailureException: Error occurred during deployment: Exception while deploying the app [name_ejb_exploded]. Please see server.log for more details.
 Artifact name:war exploded: Error during artifact deployment. See server log for details.
Artifact name:war exploded: java.io.IOException: com.sun.enterprise.admin.remote.RemoteFailureException: Error occurred during deployment: Exception while deploying the app [name_war_exploded]. Please see server.log for more details.

error logs:

    [2017-07-17T21:51:36.752+0900] [Payara 4.1] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=49 _ThreadName=admin-listener(4)] [timeMillis: 1500295896752] [levelValue: 1000] [[
  Exception while deploying the app [Book_ejb_exploded]]]

[2017-07-17T21:51:36.753+0900] [Payara 4.1] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=49 _ThreadName=admin-listener(4)] [timeMillis: 1500295896753] [levelValue: 1000] [[
  Exception during lifecycle processing
java.lang.NullPointerException
    at java.util.Hashtable.put(Hashtable.java:459)
    at com.sun.enterprise.deployment.PersistenceUnitDescriptor.addProperty(PersistenceUnitDescriptor.java:187)
    at com.sun.enterprise.deployment.node.PersistenceUnitNode.startElement(PersistenceUnitNode.java:90)
    at com.sun.enterprise.deployment.node.SaxParserHandler.startElement(SaxParserHandler.java:502)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
    at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:357)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2787)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:118)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
    at com.sun.enterprise.deployment.io.DeploymentDescriptorFile.read(DeploymentDescriptorFile.java:318)
    at com.sun.enterprise.deployment.archivist.ExtensionsArchivist.open(ExtensionsArchivist.java:179)
    at com.sun.enterprise.deployment.archivist.PersistenceArchivist.readPersistenceDeploymentDescriptor(PersistenceArchivist.java:143)
    at com.sun.enterprise.deployment.archivist.PersistenceArchivist.open(PersistenceArchivist.java:103)
    at com.sun.enterprise.deployment.archivist.Archivist.readRestDeploymentDescriptors(Archivist.java:405)
    at com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:396)
    at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:271)
    at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:280)
    at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:241)
    at com.sun.enterprise.deployment.archivist.ApplicationFactory.openArchive(ApplicationFactory.java:161)
    at org.glassfish.javaee.core.deployment.DolProvider.processDOL(DolProvider.java:203)
    at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:227)
    at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:96)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:882)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:822)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:378)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:220)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:487)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:360)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:360)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
    at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
    at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:526)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
    at java.lang.Thread.run(Thread.java:745)
]]


[2017-07-17T21:51:38.842+0900] [Payara 4.1] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=48 _ThreadName=admin-listener(3)] [timeMillis: 1500295898842] [levelValue: 1000] [[
  Exception while deploying the app [Book_war_exploded]]]

[2017-07-17T21:51:38.843+0900] [Payara 4.1] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=48 _ThreadName=admin-listener(3)] [timeMillis: 1500295898843] [levelValue: 1000] [[
  Exception during lifecycle processing
java.lang.NullPointerException
    at java.util.Hashtable.put(Hashtable.java:459)
    at com.sun.enterprise.deployment.PersistenceUnitDescriptor.addProperty(PersistenceUnitDescriptor.java:187)
    at com.sun.enterprise.deployment.node.PersistenceUnitNode.startElement(PersistenceUnitNode.java:90)
    at com.sun.enterprise.deployment.node.SaxParserHandler.startElement(SaxParserHandler.java:502)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
    at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:357)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2787)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:118)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
    at com.sun.enterprise.deployment.io.DeploymentDescriptorFile.read(DeploymentDescriptorFile.java:318)
    at com.sun.enterprise.deployment.archivist.ExtensionsArchivist.open(ExtensionsArchivist.java:179)
    at com.sun.enterprise.deployment.archivist.PersistenceArchivist.readPersistenceDeploymentDescriptor(PersistenceArchivist.java:143)
    at com.sun.enterprise.deployment.archivist.WarPersistenceArchivist.open(WarPersistenceArchivist.java:93)
    at com.sun.enterprise.deployment.archivist.Archivist.readRestDeploymentDescriptors(Archivist.java:405)
    at com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:396)
    at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:271)
    at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:280)
    at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:241)
    at com.sun.enterprise.deployment.archivist.ApplicationFactory.openArchive(ApplicationFactory.java:161)
    at org.glassfish.javaee.core.deployment.DolProvider.processDOL(DolProvider.java:203)
    at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:227)
    at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:96)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:882)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:822)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:378)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:220)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:487)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:360)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:360)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
    at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
    at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:526)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
    at java.lang.Thread.run(Thread.java:745)
]]

[2017-07-17T21:51:39.057+0900] [Payara 4.1] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=48 _ThreadName=admin-listener(3)] [timeMillis: 1500295899057] [levelValue: 1000] [[
  Exception while deploying the app [Book_war_exploded]]]

[2017-07-17T21:51:41.183+0900] [Payara 4.1] [INFO] [jsf.config.listener.version] [javax.enterprise.resource.webcontainer.jsf.config] [tid: _ThreadID=81 _ThreadName=Thread-19] [timeMillis: 1500295901183] [levelValue: 800] [[
Initializing Mojarra 2.2.13 ( 20160203-1910 unable to get svn info) for context '']]

what could be a possible problem? thank you


Answer:

There is a problem with your persistence.xml.

It's a NullPointerException coming from the PersistenceUnitNode.startElement() method on line 90 where it is trying to add a property, as you can see in the first 3 lines of the exception stack:

[2017-07-17T21:51:38.843+0900] [Payara 4.1] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=48 _ThreadName=admin-listener(3)] [timeMillis: 1500295898843] [levelValue: 1000] [[
  Exception during lifecycle processing
java.lang.NullPointerException
    at java.util.Hashtable.put(Hashtable.java:459)
    at com.sun.enterprise.deployment.PersistenceUnitDescriptor.addProperty(PersistenceUnitDescriptor.java:187)
    at com.sun.enterprise.deployment.node.PersistenceUnitNode.startElement(PersistenceUnitNode.java:90)

I expect there is a value or something missing in your persistence.xml, but there's no way to tell from this, you will need to look and see what's wrong.

Question:

We are using Struts1.2 and Hibernate for our ERP. Suppose there is a Java class which is having an attribute called deploymentDate into which I have to store the date in which WAR file has been deployed, what should we do? We are using Glassfish 2.1 server.


Answer:

ServletContextListener

What do you mean by "deployed" exactly?

If you mean when the servlet container is, at runtime, creating the context for your web app, before the first request has been handled by your servlet(s), use the standard hook for your code to be called at that moment.

Create a class that implements ServletContextListener, with a required method contextInitialized. Annotate with @WebListener to signal this class during deployment. Search Stack Overflow for many existing Questions & Answers on this topic, including some longer Answers by me.

In that method, capture the current moment as an Instant, a moment on the timeline in UTC with a resolution of nanoseconds.

Instant instant = Instant.now() ;

Example code.

@WebListener
public class MyServletContextListener implements ServletContextListener {

    public void contextInitialized( ServletContextEvent sce ) {
        Instant instant = Instant.now() ;  // Capture current moment in UTC.
        // By default `toString` generates string in standard ISO 8601 format. 
        // Easy to parse: Instant.parse( "2017-01-23T01:23:45.123456789Z" );
        String instantIso8601 = instant.toString() ;  

        // Remember the launch time as an attribute on the context.
        sce.getServletContext().setAttribute( "launch_instant" , instantIso8601 ) ;
        // Or save your moment in some class variable mentioned in Question.
        someObjectOfSomeClass.setLaunchInstant( instant );
    }

    public void contextDestroyed( ServletContextEvent sce ) {
        …
    }

}

Question:

while deploying to a remote Glassfish 4.1 Server from Netbeans 8.0.1, i get a Timeout.

I configured the Glassfish Server by adding a new Server Instance and that seemed to work. I can see the applications running on the server and i am able to undeploy a application (directly from netbeans). But when i try to deploy my application to the remote Server, i get a timeout Exception.

(i used enable-secure-admin to gain remote access from netbeans to the server)

What confuses me is, that when i enabled secure admin, i expected to see a https:// url in netbeans. But this url starts with http:// and i cant find an option to change this.

Server Attributes:

Host: [remote-ip]
DAS Port: 4848
Domain: domain1 (same as on the remote server)
Target: empty
Username PW : as set on the remote server

"Enable JDBC Driver Deployment" and "Preserve Sessions Across Redeployment" are checked


Answer:

Could you please attach the logs.

most probably its issue with the grizzly jar. Please try the patched grizzly jar and see if it works for you.

Checkout : https://java.net/jira/browse/GRIZZLY-1713 for the same

Question:

I'm new to Java. Having some trouble deploying a web app.

I have an EJB project which I deploy on Glassfish (4.1). I also have a second, JSF WEB application that I deploy to the same server. Though I am making it with the consideration that it will be deployed to a separate server, so it creates it's own InitialContext and so on to access the EJBs.

The web application depends on the EJB project. The dependency is declared in the pom of the web app. When deploying the web app it also tries to deploy the EJBs from the other project for some reason. That fails with errors like javax.naming.NameAlreadyBoundException because the EJBs are already deployed separately on this server.

How can this be fixed, so the EJB dependencies from the WEB app wouldn't be attempted to be deployed?

Update: the solution needed refactoring, so the EJBs wouldn't be depended on.

            Original        

   Project A                 WEB app
 ________________         ____________
| + EJBs         |<------| WEB stuff  |
| + Domain cl.   |        ------------
| + Remote intf. |
 ----------------

===========================================
            Refactored

  _______        ____________
 |  EJBs |----->| Domain cl. |
  -------        ------------
     |                  ^
     |                  |
     |                  |
     v                  |   WEB app
  ______________       ____________
 | Remote intf. | <---| Web stuff  |
  --------------       ------------

Answer:

You could give the dependency a scope of provided:

<dependency>
    <groupId>group.id</groupId>
    <artifactId>artifact.some.id</artifactId>
    <version>1.0</version>
    <type>ear</type>
    <scope>provided</scope>
</dependency>

This means that at runtime, the dependency will be provided by the container.

see maven doc:

This is much like compile, but indicates you expect the JDK or a container to provide the dependency at runtime. For example, when building a web application for the Java Enterprise Edition, you would set the dependency on the Servlet API and related Java EE APIs to scope provided because the web container provides those classes. This scope is only available on the compilation and test classpath, and is not transitive.

Question:

I've been working quiet some time on this project without any issues. Recently, i tried to start the application but nothing happened.

Litteraly, nothing happened.

NetBeans starts the glassfish server, and starts deploying the application. But that's it. It just hangs there, deploying the project until eternity.

I don't get any errors, the glassfish server just starts up succesfully, the application deploys succesfully (i guess?)

So sorry, i dont have any error message to show...

This issue only occurs on this particular project. I've tried other projects and they work fine.

So, I tried to revert my project to an older version of the application, where it worked just fine. But even after this revert, nothing happened.

I've reinstalled NetBeans (8.2), together with GlassFish 4.1.1, still no succes.

Other group members working on this same project dont have this issue. They are able to work on this project without any issues.

This is a picture of the processes running

This is my application's output:

Deploying on GlassFish Server 4.1.1
    profile mode: false
    debug mode: false
    force redeploy: true
Starting GlassFish Server 4.1.1
GlassFish Server 4.1.1 is running.
In-place deployment at C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\target\S44VolksBank-0.1

This is the glassfish server output:

Launching GlassFish on Felix platform
mei 08, 2017 3:13:49 PM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner createBundleProvisioner
INFO: Create bundle provisioner class = class com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner.
mei 08, 2017 3:13:49 PM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner$DefaultCustomizer getLocations
WARNING: Skipping entry  because it is not an absolute URI.
mei 08, 2017 3:13:49 PM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner$DefaultCustomizer getLocations
WARNING: Skipping entry  because it is not an absolute URI.
mei 08, 2017 3:13:49 PM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner startBundles
WARNING: Can not start bundle file:/C:/GlassFish/glassfish-4.1.1/glassfish/modules/core.jar because it is not contained in the list of installed bundles.
Registered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishRuntime@7cf38c0 in service registry.
#!## LogManagerService.postConstruct : rootFolder=C:\GlassFish\glassfish-4.1.1\glassfish
#!## LogManagerService.postConstruct : templateDir=C:\GlassFish\glassfish-4.1.1\glassfish\lib\templates
#!## LogManagerService.postConstruct : src=C:\GlassFish\glassfish-4.1.1\glassfish\lib\templates\logging.properties
#!## LogManagerService.postConstruct : dest=C:\GlassFish\glassfish-4.1.1\glassfish\domains\domain1\config\logging.properties
Info:   Running GlassFish Version: GlassFish Server Open Source Edition  4.1.1  (build 1)
Info:   Server log file is using Formatter class: com.sun.enterprise.server.logging.ODLLogFormatter
Info:   Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
Info:   Realm [file] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
Info:   Realm [certificate] of classtype [com.sun.enterprise.security.auth.realm.certificate.CertificateRealm] successfully created.
Info:   Authorization Service has successfully initialized.
Info:   Registered org.glassfish.ha.store.adapter.cache.ShoalBackingStoreProxy for persistence-type = replicated in BackingStoreFactoryRegistry
Info:   JTS5014: Recoverable JTS instance, serverId = [100]
Warning:   Instance could not be initialized. Class=interface org.glassfish.grizzly.http.server.AddOn, name=http-listener-1, realClassName=org.glassfish.grizzly.http2.Http2AddOn
Info:   Grizzly Framework 2.3.23 started in: 25ms - bound to [/0.0.0.0:8080]
Warning:   Instance could not be initialized. Class=interface org.glassfish.grizzly.http.server.AddOn, name=http-listener-2, realClassName=org.glassfish.grizzly.http2.Http2AddOn
Info:   Grizzly Framework 2.3.23 started in: 3ms - bound to [/0.0.0.0:8181]
Warning:   Instance could not be initialized. Class=interface org.glassfish.grizzly.http.server.AddOn, name=admin-listener, realClassName=org.glassfish.grizzly.http2.Http2AddOn
Info:   Grizzly Framework 2.3.23 started in: 3ms - bound to [/0.0.0.0:4848]
Info:   Grizzly Framework 2.3.23 started in: 4ms - bound to [/0.0.0.0:3700]
Info:   visiting unvisited references
Info:   Java security manager is disabled.
Info:   Entering Security Startup Service.
Info:   Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper.
Info:   Security Service(s) started successfully.
Info:   Created HTTP listener http-listener-1 on host/port 0.0.0.0:8080
Info:   Created HTTP listener http-listener-2 on host/port 0.0.0.0:8181
Info:   Created HTTP listener admin-listener on host/port 0.0.0.0:4848
Info:   Created virtual server server
Info:   Created virtual server __asadmin
Info:   Setting JAAS app name glassfish-web
Info:   Virtual server server loaded default web module 
Info:   visiting unvisited references
Info:   visiting unvisited references
Warning:   Unable to load class org.springframework.web.jsf.DelegatingPhaseListenerMulticaster, reason: java.lang.ClassNotFoundException: org.springframework.web.jsf.DelegatingPhaseListenerMulticaster
Info:   Loading application [target] at [/target]
Info:   Loading application target done in 3.518 ms
Info:   GlassFish Server Open Source Edition  4.1.1  (1) startup time : Felix (13.973ms), startup services(4.118ms), total(18.091ms)
Info:   HV000001: Hibernate Validator 5.1.2.Final
Info:   Grizzly Framework 2.3.23 started in: 4ms - bound to [/0.0.0.0:7676]
Warning:   Instance could not be initialized. Class=interface org.glassfish.grizzly.http.server.AddOn, name=http-listener-2, realClassName=org.glassfish.grizzly.http2.Http2AddOn
Info:   Created HTTP listener http-listener-2 on host/port 0.0.0.0:8181
Info:   Grizzly Framework 2.3.23 started in: 3ms - bound to [/0.0.0.0:8181]
Warning:   Instance could not be initialized. Class=interface org.glassfish.grizzly.http.server.AddOn, name=http-listener-1, realClassName=org.glassfish.grizzly.http2.Http2AddOn
Info:   Created HTTP listener http-listener-1 on host/port 0.0.0.0:8080
Info:   Grizzly Framework 2.3.23 started in: 17ms - bound to [/0.0.0.0:8080]
Info:   JMXStartupService has started JMXConnector on JMXService URL service:jmx:rmi://WillemLT:8686/jndi/rmi://WillemLT:8686/jmxrmi
Info:   Listening to REST requests at context: /management/domain.
Info:   Registered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishImpl@78830d9a as OSGi service registration: org.apache.felix.framework.ServiceRegistrationImpl@3fae596.
Info:   visiting unvisited references
Info:   visiting unvisited references
Info:   visiting unvisited references
Info:   visiting unvisited references
Info:   Initializing Mojarra 2.2.12 ( 20150720-0848 https://svn.java.net/svn/mojarra~svn/tags/2.2.12@14885) for context ''
Info:   Loading application [__admingui] at [/]
Info:   Loading application __admingui done in 3.790 ms

And finally my IDE log:

Compiler: HotSpot 64-Bit Tiered Compilers
Heap memory usage: initial 32.0MB maximum 910.5MB
Non heap memory usage: initial 2.4MB maximum -1b
Garbage collector: PS Scavenge (Collections=23 Total time spent=0s)
Garbage collector: PS MarkSweep (Collections=4 Total time spent=0s)
Classes: loaded=12231 total loaded=12234 unloaded 3
INFO [org.netbeans.core.ui.warmup.DiagnosticTask]: Total memory 8,497,946,624
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Resolving dependencies took: 892 ms
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 40 binary roots took: 503 ms
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\testest\src\test\java took: 1 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\main\webapp took: 426 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 1 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\testest\src\main\resources took: 1 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\testest\src\main\java took: 180 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\test\resources took: 0 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\main\java took: 96 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\main\resources took: 92 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\test\java took: 63 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\testest\src\test\resources took: 0 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\testest\src\main\webapp took: 45 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 10 source roots took: 904 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 1 ms]
WARNING [org.openide.util.WeakListenerImpl]: Can't remove java.beans.PropertyChangeListener using method org.netbeans.modules.editor.NbEditorDocument.removePropertyChangeListener from org.netbeans.modules.editor.NbEditorDocument@5ed2c03c, mimeType='text/x-java', kitClass=null, length=3926, version=1, file=null
INFO [org.netbeans.modules.autoupdate.updateprovider.AutoupdateCatalogParser]: Unpaired license 00000008 without any module.
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Resolving dependencies took: 250 ms
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 0 binary roots took: 1 ms
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\main\webapp took: 0 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\test\java took: 1 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\main\java took: 0 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\main\resources took: 0 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 4 source roots took: 1 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Resolving dependencies took: 151 ms
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 1 binary roots took: 59 ms
log4j:WARN No appenders could be found for logger (nu.validator.source.LocationRecorder).
log4j:WARN Please initialize the log4j system properly.
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\main\webapp took: 8,877 ms (New or modified files: 64, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\main\java took: 1,871 ms (New or modified files: 48, Deleted files: 3) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\main\resources took: 94 ms (New or modified files: 1, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\test\java took: 568 ms (New or modified files: 11, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 4 source roots took: 11,410 ms (New or modified files: 124, Deleted files: 3) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Resolving dependencies took: 18 ms
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 0 binary roots took: 0 ms
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\NetBeans\NetBeans 8.2\webcommon\jsstubs\reststubs.zip took: 61 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\NetBeans\NetBeans 8.2\webcommon\jsstubs\domstubs.zip took: 44 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\main\java took: 32 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\main\resources took: 18 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\test\java took: 23 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\NetBeans\NetBeans 8.2\webcommon\jsstubs\corestubs.zip took: 39 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 6 source roots took: 217 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.bugtracking.BugtrackingManager]: Loading stored repositories took 337 millis.
INFO [org.netbeans.modules.parsing.impl.TaskProcessor]: Task: org.netbeans.modules.java.editor.semantic.SemanticHighlighter@617cf3b5 : class org.netbeans.modules.java.editor.semantic.SemanticHighlighter ignored cancel for 95 ms.
INFO [org.netbeans.modules.parsing.impl.TaskProcessor]: Task: CancelableTaskWrapper[task: org.netbeans.modules.java.hints.spiimpl.hints.HintsTask@5b636577, phase: RESOLVED, priority: 500] : class org.netbeans.modules.java.source.JavaSourceAccessor$CancelableTaskWrapper ignored cancel for 72 ms.
INFO [org.netbeans.modules.parsing.impl.TaskProcessor]: Task: CancelableTaskWrapper[task: org.netbeans.modules.java.hints.spiimpl.hints.HintsTask@5198ee46, phase: RESOLVED, priority: 500] : class org.netbeans.modules.java.source.JavaSourceAccessor$CancelableTaskWrapper ignored cancel for 63 ms.
WARNING [org.openide.util.WeakListenerImpl]: Can't remove java.beans.PropertyChangeListener using method org.netbeans.modules.editor.NbEditorDocument.removePropertyChangeListener from org.netbeans.modules.editor.NbEditorDocument@7843cd4, mimeType='text/x-java', kitClass=null, length=1944, version=71, file=org.netbeans.modules.java.JavaDataObject@2544252b[C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\test\java\Models\SearchTest.java@6f647245:32c476ce]
WARNING [org.openide.util.WeakListenerImpl]: Can't remove java.beans.PropertyChangeListener using method org.netbeans.modules.editor.NbEditorDocument.removePropertyChangeListener from org.netbeans.modules.editor.NbEditorDocument@764e0553, mimeType='text/x-java', kitClass=null, length=2320, version=78, file=org.netbeans.modules.java.JavaDataObject@362b1420[C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\test\java\Models\TaskTest.java@b3173d86:1256bb55]
WARNING [org.openide.util.WeakListenerImpl]: Can't remove java.beans.PropertyChangeListener using method org.netbeans.modules.editor.NbEditorDocument.removePropertyChangeListener from org.netbeans.modules.editor.NbEditorDocument@3b58c6ce, mimeType='text/x-java', kitClass=null, length=9059, version=259, file=org.netbeans.modules.java.JavaDataObject@5d43d791[C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\test\java\database\FilterValueRepoTest.java@f7918e55:246c412c]
WARNING [org.openide.util.WeakListenerImpl]: Can't remove java.beans.PropertyChangeListener using method org.netbeans.modules.editor.NbEditorDocument.removePropertyChangeListener from org.netbeans.modules.editor.NbEditorDocument@1396fedb, mimeType='text/x-java', kitClass=null, length=6060, version=173, file=org.netbeans.modules.java.JavaDataObject@38592f89[C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\test\java\database\FunctionRepoTest.java@f46cf7d2:1376e702]
WARNING [org.openide.util.WeakListenerImpl]: Can't remove java.beans.PropertyChangeListener using method org.netbeans.modules.editor.NbEditorDocument.removePropertyChangeListener from org.netbeans.modules.editor.NbEditorDocument@655e315f, mimeType='text/x-java', kitClass=null, length=3533, version=117, file=org.netbeans.modules.java.JavaDataObject@1d9376fc[C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\test\java\database\TaskRepoTest.java@ea2214a7:445a0b7d]
WARNING [org.openide.util.WeakListenerImpl]: Can't remove java.beans.PropertyChangeListener using method org.netbeans.modules.editor.NbEditorDocument.removePropertyChangeListener from org.netbeans.modules.editor.NbEditorDocument@50e9f6de, mimeType='text/x-java', kitClass=null, length=2831, version=91, file=org.netbeans.modules.java.JavaDataObject@1dac9dc7[C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\test\java\Models\LogInTest.java@ab0067e6:3c962a0a]
WARNING [org.openide.util.WeakListenerImpl]: Can't remove java.beans.PropertyChangeListener using method org.netbeans.modules.editor.NbEditorDocument.removePropertyChangeListener from org.netbeans.modules.editor.NbEditorDocument@2ffa3817, mimeType='text/x-java', kitClass=null, length=3392, version=118, file=org.netbeans.modules.java.JavaDataObject@23cbf57f[C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\test\java\Models\JobOfferTest.java@532df68c:2f250bb5]
WARNING [org.openide.util.WeakListenerImpl]: Can't remove java.beans.PropertyChangeListener using method org.netbeans.modules.editor.NbEditorDocument.removePropertyChangeListener from org.netbeans.modules.editor.NbEditorDocument@1f21d9b0, mimeType='text/x-java', kitClass=null, length=2178, version=85, file=org.netbeans.modules.java.JavaDataObject@3e7c01cb[C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\test\java\Models\FunctionTest.java@1bfc3db5:597f39aa]
WARNING [org.openide.util.WeakListenerImpl]: Can't remove java.beans.PropertyChangeListener using method org.netbeans.modules.editor.NbEditorDocument.removePropertyChangeListener from org.netbeans.modules.editor.NbEditorDocument@d2325ca, mimeType='text/x-java', kitClass=null, length=1926, version=79, file=org.netbeans.modules.java.JavaDataObject@1d19a8eb[C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\test\java\Models\AccountTest.java@30755e22:1ea20fd1]
WARNING [org.openide.util.WeakListenerImpl]: Can't remove java.beans.PropertyChangeListener using method org.netbeans.modules.editor.NbEditorDocument.removePropertyChangeListener from org.netbeans.modules.editor.NbEditorDocument@59c06d1c, mimeType='text/x-java', kitClass=null, length=1627, version=80, file=org.netbeans.modules.java.JavaDataObject@2e6ba21e[C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\test\java\database\DatabaseTest.java@938fcf23:7a8f17ba]
WARNING [org.netbeans.modules.options.keymap.LayersBridge]: Invalid shortcut: org.openide.loaders.BrokenDataShadow@fff7e04[MultiFileObject@6da756e7[Keymaps/NetBeans/D-BACK_QUOTE.shadow]]
WARNING [null]: Last record repeated again.
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Resolving dependencies took: 24 ms
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 0 binary roots took: 0 ms
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\main\webapp took: 163 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\main\java took: 2,717 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\main\resources took: 53 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\Willem\Documents\NetBeansProjects\PTS4\S44Volksbank\S44VolksBank\src\test\java took: 129 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 4 source roots took: 3,062 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [glassfish]: GlassFish configuration file C:\GlassFish\glassfish-4.1.1\glassfish\domains\domain1\config\domain.xml was modified, updating server configuration.

Answer:

I've finally found a solution after 3 days of searching....

For some reason, i had to install Git on my PC.

Weird, because it used to work without any problems without git installed.

Question:

So I am deploying my REST webservice... Normally I always had it locally hosted on my own computer, but now I am done with the application so I want to host it for real, yet I am stuck deploying it, it keeps on saying: deploying...

So locally it works, but now I've added a remote server and I've tested it with a blanco webservice, and that does work.

Does anyone know what is going on? Because there is no error at all...

BTW I have tested to deploy it with the admin site thing, the [website]:4848 > application > deploy > [add war] --- but that crashes as well... after like 30 seconds of nothing, the webpage says: The connection was reset.


Answer:

No clue what it is, but if anyone else sees this in the future, where they cannot deploy their webservice, because it takes forever, here's the solution:

  1. Copy your .war that you have build onto the server
  2. ./asadmin deploy (For glassfish 4.1, this is located in the [main directory]/bin)
  3. Fill in all information needed
  4. That's it :) I don't like it either, but at least it's a way to deploy!

Question:

My application deploys normally on a remote server, and the clean and build works, but i'm getting the following error when i'm trying to deploy locally :

Grave:   Exception during lifecycle processing
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.RuntimeException: com.sun.faces.mgbean.ManagedBeanCreationException: Erreur lors de l’injection de ressources dans le bean géré «main»
    at com.sun.enterprise.web.WebApplication.start(WebApplication.java:168)
    at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
    at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
    at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:500)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:356)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:356)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
    at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
    at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
    at java.lang.Thread.run(Thread.java:744)

Grave:   Exception while loading the app
Grave:   Undeployment failed for context /Inoa
Infos:   file:/C:/Users/CodeMaster/Documents/NetBeansProjects/Inoa3/Indev/dist/gfdeploy/Inoa/Inoa-ejb_jar/_Inoa-ejbPU logout successful
Grave:   Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.RuntimeException: com.sun.faces.mgbean.ManagedBeanCreationException: Erreur lors de l’injection de ressources dans le bean géré «main»

Thinking the problem came from my code, I tried to revert to an older version of my code wich I had no problem with, and the exact same error occurs. I also tried reinstalling Netbeans(8.0.2) and glassfish(4.1) and it changed nothing.

PS : This is a project started by another developper that I've been working on with no problems during the last 6 mounth. I'm now thinking the problem might come from a configuration error in netbeans or glassfish as i'm getting the same error with any previously working version of my code.


Answer:

This error came from a lack of heapspace on the local server.

The real problem was not visible in the stackTrace because the managed bean "main" is instanciated during deployment : @ManagedBean(name = "main", eager = true)

Removing the eager=true parameter allowed me to see the underlying error.

Question:

I'm trying to set up a basic deployment pipeline using Maven, Glassfish, and the Maven-Glassfish-plugin. I want to make a remote deployment of a .war on a remote glassfish server that I own.

I'm following this tutorial : https://programmaticponderings.wordpress.com/2013/11/04/continuous-integration-and-deployment-using-git-maven-jenkins-and-glassfish/

I'm stuck at a step when I have to run a a Maven's goal with the following Goals :

properties:read-project-properties clean install glassfish:redeploy -e

with the following properties :

glassfish.properties.file.argument=testing

The pom.xml looks like this :

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.blogpost</groupId>
    <artifactId>HelloGlassFishMaven</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>HelloGlassFishMaven</name>

    <properties>
        <!-- Input Parameter - GlassFish properties file -->
        <glassfish.properties.file.argument></glassfish.properties.file.argument>
        <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-servlet</artifactId>
            <version>1.19</version>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <compilerArguments>
                        <endorseddirs>${endorsed.dir}</endorseddirs>
                    </compilerArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
                    <webresources>
                        <resource>
                            <directory>${basedir}/src/main/webapp/WEB-INF</directory>
                            <filtering>true</filtering>
                            <targetpath>WEB-INF</targetpath>
                            <includes>
                                <include>**/glassfish-web.xml</include>
                            </includes>
                        </resource>
                    </webresources>
                </configuration>            
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.10</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${endorsed.dir}</outputDirectory>
                            <silent>true</silent>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>javax</groupId>
                                    <artifactId>javaee-endorsed-api</artifactId>
                                    <version>7.0</version>
                                    <type>jar</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>properties-maven-plugin</artifactId>
                <version>1.0-alpha-2</version>
                <configuration>
                    <files>
                        <file>${basedir}/properties/${glassfish.properties.file.argument}.properties</file>
                    </files>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.glassfish.maven.plugin</groupId>
                <artifactId>maven-glassfish-plugin</artifactId>
                <version>2.1</version>
                <configuration>
                        <glassfishDirectory>D:\CreepyStation\Work\Virtual environment\GlassFishInpuJavaEE\glassfish</glassfishDirectory>
                    <user>${glassfish.user}</user>
                    <passwordFile>${basedir}/passwords/${glassfish.pwdfile}</passwordFile>
                    <echo>true</echo>
                    <debug>true</debug>
                    <terse>true</terse>
                    <domain>
                        <name>${glassfish.domain}</name>
                        <host>${glassfish.host}</host>
                        <adminPort>${glassfish.adminport}</adminPort>
                        <httpPort>6061</httpPort>
                    </domain>
                    <components>
                        <component>
                            <name>${project.artifactId}</name>
                            <artifact>${project.build.directory}/${project.build.finalName}.war</artifact>
                        </component>
                    </components>
                </configuration>  
            </plugin>
        </plugins>
    </build>

</project>

It use a .properties file with the following parameters (To my remote Glassfish domain)

# GlassFish 4 testing domain properties
glassfish.domain=testing
glassfish.host=XX.XX.XX.XX
glassfish.adminport=6060
glassfish.user=admin
glassfish.pwdfile=pwdfile_testing

As far as my understanding :

  • It properly connect to my remote Glassfishserver (If I change the password on the properties file, it warn me that the user/password is incorrect)
  • I have properly configured my remote Glassfishserver with a domain called "testing", and enable-secure-admin is actived, I can access my server with the Glassfish admin GUI.
  • If I deploy the .war on the Glassfish admin GUI, it's working.

It hangs for a few minute and give me an error, here's the error log (Lots of line as I have actived debug, the error is at the end of the file) :

http://pastebin.com/Fv6LvWkk

This is driving me crazy, I've spend countless hours trying to figure that out, no luck so far.

Thanks a lot !


Answer:

Not really a fix, but I used the Cargo plugin instead of the Maven-To-Glassfish plugin, it's working fine now.

Question:

I know this question has bee ansked a bunch of times, however non of the answeres seemed to work for me.

I use Spring 4.1.4 /Hibernate 4.3.8

my application context lloks as follows

 <context:component-scan base-package="com.redast"/>

<!-- Use annotation for configuration-->
<context:annotation-config/>
<context:spring-configured/>

<!-- Data Source Declaration -->
<bean name="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
    <property name="url" value="jdbc:mysql://localhost:3306/redast" />
    <property name="username" value="xxxxxx" />
    <property name="password" value="xxxxxx" />
</bean>

<!-- Session Factory Declaration -->
<bean id="SessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="packagesToScan">
        <list>
            <value>com.redast.model</value>
            <value>com.redast.service</value>
            <value>com.redast.dao</value>
        </list>
    </property>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
            <prop key="hibernate.show_sql">true</prop>
        </props>
    </property>
</bean>

I use the SessionFactory in all my DAO as:

@Autowired
private SessionFactory sessionFactory;

However when i try to deploy my app i get the error:

Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'announcementDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.redast.dao.AnnouncementDAO.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SessionFactory' defined in ServletContext resource [/WEB-INF/application-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException

where

Could not autowire field: private org.hibernate.SessionFactory com.redast.dao.AnnouncementDAO.sessionFactory;

"AnnouncementDAO" is only the first occurence of @Autowire. if I remove it the error comes up in the next DAO.

Thanks for the help (been trying to figure this out for 2 days now).

@Edit: Added Stacktrace:

Schwerwiegend:   Exception during lifecycle processing
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'announcementDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.redast.dao.AnnouncementDAO.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/application-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
    at com.sun.enterprise.web.WebApplication.start(WebApplication.java:168)
        at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
    at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:500)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:745)

Schwerwiegend:   Exception while loading the app
Schwerwiegend:   Undeployment failed for context /redast
Warnung:   The web application [/redast] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 
Schwerwiegend:   Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'announcementDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.redast.dao.AnnouncementDAO.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/application-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException

The DAO:

import com.redast.model.Announcement;
import java.util.List;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class AnnouncementDAO {

@Autowired
private SessionFactory sessionFactory;


public SessionFactory getSessionFactory() {
    return sessionFactory;
}

public void setSessionFactory(SessionFactory sessionFactory) {
    this.sessionFactory = sessionFactory;
}

public void addAnnouncement(Announcement announcement) {
    getSessionFactory().getCurrentSession().save(announcement);
} 

public void deleteAnnouncement(Announcement announcement) {
    getSessionFactory().getCurrentSession().delete(announcement);
}

public void updateAnnouncement(Announcement announcement) {
    getSessionFactory().getCurrentSession().update(announcement);
}

public Announcement getAnnouncementById(int id) {
    List list = getSessionFactory().getCurrentSession().createQuery("from Announcement where id=?").setParameter(0, id).list();
    return (Announcement)list.get(0);
}

public List<Announcement> getAnnouncement() {
    List list = getSessionFactory().getCurrentSession().createQuery("from Announcement order by postDate DESC").list();
    return list;
}

}

@Second Edit Server.log:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/application-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1566)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1127)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1051)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:949)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)
... 67 more
Caused by: java.lang.NullPointerException
at org.hibernate.cfg.annotations.CollectionBinder.bindManytoManyInverseFk(CollectionBinder.java:1513)
at org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:1422)
at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:793)
at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:728)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:70)
at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1697)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1426)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1846)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1930)
at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:372)
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:454)
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:439)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1625)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1562)
... 77 more

Answer:

Ok I found what was causing my SessionFactory init to fail:

I had:

@ManyToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="pk.fragment")
private Set<AssetFragment> fragmentAssets = new HashSet<>();

Changed it to:

@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="pk.fragment")
private Set<AssetFragment> fragmentAssets = new HashSet<>();

Atleast it now depolys. will have to look in to manyToMany relations. Thanks for the help.

Question:

I've installed Glassfish 4 to use with a java web project I developed so far using Tomcat 7.

The problem is I am getting this exception after the initialization of the logger and primefaces. This is how the message starts:

[2014-08-31T02:08:44.335+0300] [glassfish 4.0] [INFO] [] [javax.enterprise.web] [tid: _ThreadID=36 _ThreadName=admin-listener(5)] [timeMillis: 1409440124335] [levelValue: 800] [[
  WebModule[null] ServletContext.log():Marking servlet loader as unavailable]]

[2014-08-31T02:08:44.336+0300] [glassfish 4.0] [SEVERE] [] [javax.enterprise.web] [tid: _ThreadID=36 _ThreadName=admin-listener(5)] [timeMillis: 1409440124336] [levelValue: 1000] [[
  WebModule[]Error loading WebappClassLoader (delegate=true; repositories=WEB-INF/classes/) org.classpathopenejb.loader.LoaderServlet
java.lang.ClassNotFoundException: org.classpathopenejb.loader.LoaderServlet

The exceptions trace printed below with a root cause is here.

What is the problem?

I've tried adding this:

<dependency>
     <groupId>org.apache.openejb</groupId>
     <artifactId>openejb-loader</artifactId>
     <version>4.6.0.2</version>
     <scope>runtime</scope>
</dependency>

to my pom.xml, and no success.

What can I do?


Answer:

Turns out I had left the a servlet mapping at the deployment descriptor in an attempt to integrate OpenEJB with Tomcat 7.

Removed that and now it works fine.

Question:

I created a J2EE web application (war + EJB module) and I tryed to setup JMS resources for Oracle Glassfish 3.1.2.2; the project links on github (web application and EJB module) are: J2EE web application EJB module I want to setup the JMS resources (JMS factory and JMS destination) on Oracle Glassfish with Java/Glassfish deployment descriptor files. The following exception is thrown by Oracle Glassfish during deployment:

[#|2014-07-29T09:23:24.298+0200|WARNING|oracle-glassfish3.1.2|org.apache.catalina.connector.Request|_ThreadID=84;_ThreadName=Thread-2;|PWC4011: Unable to set request character encoding to UTF-8 from context , because request parameters have already been read, or ServletRequest.getReader() has already been called|#]

[#|2014-07-29T09:23:24.361+0200|INFO|oracle-glassfish3.1.2|org.glassfish.admingui|_ThreadID=84;_ThreadName=Thread-2;|GUI deployment: uploadToTempfile|#]

[#|2014-07-29T09:23:24.362+0200|INFO|oracle-glassfish3.1.2|org.glassfish.admingui|_ThreadID=84;_ThreadName=Thread-2;|uploadFileName=SampleGlassfishApp01-1.0-SNAPSHOT.war|#]

[#|2014-07-29T09:23:24.436+0200|WARNING|oracle-glassfish3.1.2|javax.enterprise.system.tools.deployment.org.glassfish.deployment.common|_ThreadID=75;_ThreadName=Thread-2;|DPL8007: Unsupported deployment descriptors element message-destination value null|#]

[#|2014-07-29T09:23:24.470+0200|SEVERE|oracle-glassfish3.1.2|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=75;_ThreadName=Thread-2;|Exception while invoking class org.glassfish.ejb.startup.EjbDeployer load method

java.lang.RuntimeException: Exception registering ejb bundle level resources
at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:302)
at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:108)
at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:186)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:264)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:214)
at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:207)
at org.glassfish.admin.rest.resources.TemplateListOfResource.createResource(TemplateListOfResource.java:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer._service(GrizzlyContainer.java:182)
at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer.service(GrizzlyContainer.java:147)
at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:148)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: [null] is not an allowed property value type
at com.sun.enterprise.deployment.ResourceReferenceDescriptor.checkType(ResourceReferenceDescriptor.java:505)
at com.sun.enterprise.container.common.impl.ComponentEnvManagerImpl.addResourceReferences(ComponentEnvManagerImpl.java:444)
at com.sun.enterprise.container.common.impl.ComponentEnvManagerImpl.addJNDIBindings(ComponentEnvManagerImpl.java:542)
at com.sun.enterprise.container.common.impl.ComponentEnvManagerImpl.bindToComponentNamespace(ComponentEnvManagerImpl.java:193)
at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:298)
... 55 more
|#]

[#|2014-07-29T09:23:24.471+0200|SEVERE|oracle-glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=75;_ThreadName=Thread-2;|Exception while loading the app|#]

[#|2014-07-29T09:23:24.473+0200|SEVERE|oracle-glassfish3.1.2|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=75;_ThreadName=Thread-2;|Exception while loading the app : Exception registering ejb bundle level resources
java.lang.IllegalArgumentException: [null] is not an allowed property value type
at com.sun.enterprise.deployment.ResourceReferenceDescriptor.checkType(ResourceReferenceDescriptor.java:505)
at com.sun.enterprise.container.common.impl.ComponentEnvManagerImpl.addResourceReferences(ComponentEnvManagerImpl.java:444)
at com.sun.enterprise.container.common.impl.ComponentEnvManagerImpl.addJNDIBindings(ComponentEnvManagerImpl.java:542)
at com.sun.enterprise.container.common.impl.ComponentEnvManagerImpl.bindToComponentNamespace(ComponentEnvManagerImpl.java:193)
at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:298)
at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:108)
at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:186)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:264)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:214)
at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:207)
at org.glassfish.admin.rest.resources.TemplateListOfResource.createResource(TemplateListOfResource.java:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer._service(GrizzlyContainer.java:182)
at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer.service(GrizzlyContainer.java:147)
at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:148)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:745)
|#]

[#|2014-07-29T09:23:24.477+0200|INFO|oracle-glassfish3.1.2|org.glassfish.admingui|_ThreadID=84;_ThreadName=Thread-2;|Exception Occurred :Error occurred during deployment: Exception while loading the app : Exception registering ejb bundle level resources. Please see server.log for more details.|#]

The deployment descriptors WEB-INF/web.xml, WEB-INF/glassfish-resources.xml and META-INF/glassfish-ejb-jar.xml do not correctly setup JMS resources and "Unsupported deployment descriptors element message-destination value null" exception is thrown. How can I solve this problem ? Best wishes Edit Resolved with WEB-INF/glassfish-web.xml deploymenrt descriptor, see github updated applications.


Answer:

I assume that you have created JMS resources on Glassfish, right?

Add ejb-jar.xml into EJB module (src/main/resources/META-INF) with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<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_1.xsd"
    version="3.1">
    <display-name>SampleGlassfishApp01EjbModule</display-name>
    <enterprise-beans>
    <session>
            <ejb-name>OldJmsMessageConsumer</ejb-name>
            <local-bean />
            <ejb-class>it.glassfish.examples.sampleproject.ejb</ejb-class>
            <session-type>Stateless</session-type>
            <transaction-type>Container</transaction-type>
            <resource-ref>
                <description />
                <res-ref-name>jms/EM2Factory</res-ref-name>
                <res-type>javax.jms.QueueConnectionFactory</res-type>
                <res-auth>Container</res-auth>
                <res-sharing-scope>Shareable</res-sharing-scope>
            </resource-ref>
            <resource-ref>
                <description />
                <res-ref-name>jms/SimpleQueue</res-ref-name>
                <res-type>javax.jms.Queue</res-type>
                <res-auth>Container</res-auth>
                <res-sharing-scope>Shareable</res-sharing-scope>
            </resource-ref>
        </session>
    </enterprise-beans>
</ejb-jar>

Question:

I have finished my Java EE project. The thing is I don't know to deploy it to a web server. The thing is the code is adapted to the GlassFish server Data Pool. Will this be a problem when deploying and how to deploy it? Using eclipse in Ubuntu 14.04.03. Java 1.8.0_66.


Answer:

see the documentation: Deploying and Undeploying Applications

to undeploy you need use command undeploy

glassfish/bin/asadmin undeploy Test

to deploy, usually you need copy your war file into autodeploy folder

here's my script to deploy test.war file

set gfver=4.1

del "E:\Program Files\glassfish-%gfver%\glassfish\domains\domain1\autodeploy\Test.war_deployed"
del "E:\Program Files\glassfish-%gfver%\glassfish\domains\domain1\autodeploy\Test.war"
del "E:\Program Files\glassfish-%gfver%\glassfish\domains\domain1\autodeploy\.autodeploystatus\Test.war"

del "E:\Program Files\glassfish-%gfver%\glassfish\domains\domain1\applications\Test\.glassfishStaleFiles"

copy "E:\workspace\TestProject\dist\Test.war" "E:\Program Files\glassfish-%gfver%\glassfish\domains\domain1\autodeploy"