Hello again,
i took some time to create a reproducable project to demonstrate the issue.
Deploy two CDI-enabled JSF apps on embedded GF 3.1.2 and prior. Call the
first app before deployment of the second. After the second app is deployed,
the first stop working.
I've attached an eclipse project, but here is the code too:
[code]
package test.de.abraxas;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import org.glassfish.embeddable.Deployer;
import org.glassfish.embeddable.GlassFish;
import org.glassfish.embeddable.GlassFishProperties;
import org.glassfish.embeddable.GlassFishRuntime;
import org.glassfish.embeddable.archive.ScatteredArchive;
public class EGFTest {
public static void main(String[] args) throws Exception {
GlassFishProperties props = new GlassFishProperties();
props.setPort("http-listener", 8080);
GlassFishRuntime gfruntime =GlassFishRuntime.bootstrap();
GlassFish gf = gfruntime.newGlassFish(props);
gf.start();
Deployer deployer = gf.getDeployer();
ScatteredArchive archive = new ScatteredArchive("jsf",
ScatteredArchive.Type.WAR,new File("WebContent/"));
deployer.deploy(archive.toURI(),"--name", "jsf",
"--contextroot=app1");
String urlApp1 =
"
http://localhost:8080/app1/faces/index.xhtml";
String urlApp2 =
"
http://localhost:8080/app2/faces/index.xhtml";
// comment this out to get both apps working
printPage(urlApp1);
try {
System.out.println(urlApp1+" will stop working in 15
seconds");
Thread.sleep(15000);
} catch (InterruptedException e) {
e.printStackTrace();
}
deployer.deploy(archive.toURI(),"--name", "jsf2",
"--contextroot=app2");
// app1 is damaged
printPage(urlApp1);
//app2 still working
printPage(urlApp2);
}
private static void printPage(String urlStr) throws Exception{
try {
URL url = new URL(urlStr);
URLConnection conn = url.openConnection();
String line;
BufferedReader reader =new BufferedReader(new
InputStreamReader(conn.getInputStream()));
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
reader.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
[/code]
WebContent/index.xhtml
[code]
<!DOCTYPE html>
<html lang="en"
xmlns="
http://www.w3.org/1999/xhtml"
xmlns:f="
http://java.sun.com/jsf/core"
xmlns:h="
http://java.sun.com/jsf/html"
xmlns:ui="
http://java.sun.com/jsf/facelets">
<h:head>
<title>XHTML page</title>
</h:head>
<h:body>
<h:outputText value="hello world"/>
</h:body>
</html>
[/code]
WebContent/WEB-INF/web.xml
[code]
<?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"
xmlns:web="
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
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>JsfTest</display-name>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
</web-app>
[/code]
WebContent/WEB-INF/faces-config.xml
[code]
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
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/web-facesconfig_2_0.xsd"
version="2.0">
</faces-config>
[/code]
WebContent/WEB-INF/beans.xml
[code]
<?xml version="1.0" encoding="UTF-8"?>
<beans 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/beans_1_0.xsd">
</beans>
[/code]
Running the test gives this output:
[code]
11.03.2012 18:47:22 com.sun.enterprise.v3.server.CommonClassLoaderServiceImpl
findDerbyClient
INFO: Cannot find javadb client jar file, derby jdbc driver will not be
available by default.
11.03.2012 18:47:22 org.hibernate.validator.util.Version <clinit>
INFO: Hibernate Validator 4.2.0.Final
11.03.2012 18:47:23 com.sun.enterprise.v3.services.impl.GrizzlyService
createNetworkProxy
INFO: Network listener https-listener on port 0 disabled per domain.xml
11.03.2012 18:47:23 com.sun.enterprise.v3.services.impl.GrizzlyProxy$2$1
onReady
INFO: Grizzly Framework 1.9.46 started in: 44ms - bound to [0.0.0.0:8080]
11.03.2012 18:47:23 com.sun.enterprise.v3.server.AppServerStartup run
INFO: GlassFish Server Open Source Edition 3.1.2 (java_re-private) startup
time : Embedded (612ms), startup services(467ms), total(1.079ms)
11.03.2012 18:47:23
org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread
run
INFO: JMX006: JMXStartupService had disabled JMXConnector system
11.03.2012 18:47:23 com.sun.enterprise.security.SecurityLifecycle <init>
INFO: SEC1002: Security Manager is OFF.
11.03.2012 18:47:23 com.sun.enterprise.security.SecurityLifecycle
onInitialization
INFO: SEC1010: Entering Security Startup Service
11.03.2012 18:47:23 com.sun.enterprise.security.PolicyLoader loadPolicy
INFO: SEC1143: Loading policy provider
com.sun.enterprise.security.jacc.provider.SimplePolicyProvider.
11.03.2012 18:47:23 com.sun.enterprise.security.auth.realm.Realm
doInstantiate
INFO: SEC1115: Realm [admin-realm] of classtype
[com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
11.03.2012 18:47:23 com.sun.enterprise.security.auth.realm.Realm
doInstantiate
INFO: SEC1115: Realm [file] of classtype
[com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
11.03.2012 18:47:23 com.sun.enterprise.security.auth.realm.Realm
doInstantiate
INFO: SEC1115: Realm [certificate] of classtype
[com.sun.enterprise.security.auth.realm.certificate.CertificateRealm]
successfully created.
11.03.2012 18:47:23 com.sun.enterprise.security.SecurityLifecycle
onInitialization
INFO: SEC1011: Security Service(s) Started Successfully
11.03.2012 18:47:24 com.sun.enterprise.web.WebContainer createHttpListener
INFO: WEB0169: Created HTTP listener [http-listener] on host/port
[0.0.0.0:8080]
11.03.2012 18:47:24 com.sun.enterprise.web.WebContainer createHosts
INFO: WEB0171: Created virtual server [server]
11.03.2012 18:47:24 com.sun.enterprise.web.WebContainer
loadSystemDefaultWebModules
INFO: WEB0172: Virtual server [server] loaded default web module []
classLoader = WebappClassLoader (delegate=true;
repositories=WEB-INF/classes/)
SharedSecrets.getJavaNetAccess()=java.net.URLClassLoader$7_at_1f2412a
11.03.2012 18:47:25 org.jboss.weld.bootstrap.WeldBootstrap <clinit>
INFO: WELD-000900 SNAPSHOT
11.03.2012 18:47:26 com.sun.faces.config.ConfigureListener contextInitialized
INFO: Mojarra 2.1.6 (SNAPSHOT 20111206) für Kontext '/app1' wird
initialisiert.
11.03.2012 18:47:27 com.sun.enterprise.web.WebApplication start
INFO: WEB0671: Loading application [jsf] at [/app1]
11.03.2012 18:47:27 org.glassfish.deployment.admin.DeployCommand execute
INFO: jsf was successfully deployed in 3.754 milliseconds.
<!DOCTYPE html>
<html lang="en" xmlns="
http://www.w3.org/1999/xhtml"><head>
<title>XHTML page</title></head><body>hello world</body>
</html>
http://localhost:8080/app1/faces/index.xhtml will stop working in 15 seconds
classLoader = WebappClassLoader (delegate=true;
repositories=WEB-INF/classes/)
SharedSecrets.getJavaNetAccess()=java.net.URLClassLoader$7_at_1f2412a
11.03.2012 18:47:43 com.sun.faces.config.ConfigureListener contextInitialized
INFO: Mojarra 2.1.6 (SNAPSHOT 20111206) für Kontext '/app2' wird
initialisiert.
11.03.2012 18:47:43 com.sun.enterprise.web.WebApplication start
INFO: WEB0671: Loading application [jsf2] at [/app2]
11.03.2012 18:47:43 org.glassfish.deployment.admin.DeployCommand execute
INFO: jsf2 was successfully deployed in 670 milliseconds.
11.03.2012 18:47:43 com.sun.enterprise.web.VirtualServer$1 log
WARNUNG: StandardWrapperValve[FacesServlet]: PWC1406: Servlet.service() for
servlet FacesServlet threw exception
java.lang.IllegalStateException: Must call associate() before calling
activate()
at
org.jboss.weld.context.AbstractConversationContext.activate(AbstractConversationContext.java:200)
at
org.jboss.weld.jsf.WeldPhaseListener.activateConversations(WeldPhaseListener.java:108)
at
org.jboss.weld.jsf.WeldPhaseListener.beforePhase(WeldPhaseListener.java:85)
at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99)
at
com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
at
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
at
org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1542)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at
org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at
com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
at
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
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(Unknown Source)
java.io.IOException: Server returned HTTP response code: 500 for URL:
http://localhost:8080/app1/faces/index.xhtml
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
Source)
at test.de.abraxas.EGFTest.printPage(EGFTest.java:56)
at test.de.abraxas.EGFTest.main(EGFTest.java:46)
<!DOCTYPE html>
<html lang="en" xmlns="
http://www.w3.org/1999/xhtml"><head>
<title>XHTML page</title></head><body>hello world</body>
</html>
[/code]
I hope someone is looking in this.
Many thanks,
Daniel
--
[Message sent by forum member 'dansg']
View Post: http://forums.java.net/node/883735