This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSF and the fly likes JSF Error- Maven Project on Weblogic: Application was not properly initialized at startup, could not Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF Error- Maven Project on Weblogic: Application was not properly initialized at startup, could not" Watch "JSF Error- Maven Project on Weblogic: Application was not properly initialized at startup, could not" New topic
Author

JSF Error- Maven Project on Weblogic: Application was not properly initialized at startup, could not

Rajiv Girotra
Greenhorn

Joined: Feb 28, 2013
Posts: 3
Hi

I created a dynamic web project using "Oracle Enterprise Pack for Eclipse". It uses shared weblogic library jsf-myfaces 1.1. When deployed on weblogic 10.3.3. It works fine. So far so good.

Problem starts when I convert the project to a Maven project as foolows:
1) Open the dynamic web project using Springsource (STS3.1)
2) Convert to Maven project using RightClickOnProject->configure->convert to maven project.
3) move the source (.java) folders to /main/java/
4) move the web-inf from webcontent to main/java/webapp/
5) add the pom file with dependencies in it.

Now maven prepares the war project successfully but when I publish this war file on my local weblogic server, it throws the following error on the console window.

28-Feb-2013 10:32:59 org.springframework.orm.jpa.AbstractEntityManagerFactoryBea
n destroy
INFO: Closing JPA EntityManagerFactory for persistence unit 'prsMaven'
28-Feb-2013 10:32:59 com.sun.faces.config.ConfigureListener contextDestroyed
SEVERE: Unexpected exception when attempting to tear down the Mojarra runtime
java.lang.IllegalStateException: Application was not properly initialized at sta
rtup, could not find Factory: javax.faces.application.ApplicationFactory
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.jav
a:800)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:302)
at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext
.java:104)
at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureList
ener.java:312)
at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run
(EventsManager.java:482)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
121)
at weblogic.servlet.internal.EventsManager.notifyContextDestroyedEvent(E
ventsManager.java:200)
at weblogic.servlet.internal.WebAppServletContext.destroy(WebAppServletC
ontext.java:3197)
at weblogic.servlet.internal.ServletContextManager.destroyContext(Servle
tContextManager.java:241)
at weblogic.servlet.internal.HttpServer.unloadWebApp(HttpServer.java:461
)
at weblogic.servlet.internal.WebAppModule.destroyContexts(WebAppModule.j
ava:1540)
at weblogic.servlet.internal.WebAppModule.deactivate(WebAppModule.java:5
13)
at weblogic.application.internal.flow.ModuleStateDriver$2.previous(Modul
eStateDriver.java:389)
at weblogic.application.utils.StateMachineDriver.previousState(StateMach
ineDriver.java:167)
at weblogic.application.utils.StateMachineDriver.previousState(StateMach
ineDriver.java:160)
at weblogic.application.internal.flow.ModuleStateDriver.deactivate(Modul
eStateDriver.java:141)
at weblogic.application.internal.flow.ScopedModuleDriver.deactivate(Scop
edModuleDriver.java:207)
at weblogic.application.internal.flow.ModuleListenerInvoker.deactivate(M
oduleListenerInvoker.java:261)
at weblogic.application.internal.flow.DeploymentCallbackFlow$2.previous(
DeploymentCallbackFlow.java:538)
at weblogic.application.utils.StateMachineDriver.previousState(StateMach
ineDriver.java:167)
at weblogic.application.utils.StateMachineDriver.previousState(StateMach
ineDriver.java:160)
at weblogic.application.internal.flow.DeploymentCallbackFlow.deactivate(
DeploymentCallbackFlow.java:182)
at weblogic.application.internal.flow.DeploymentCallbackFlow.deactivate(
DeploymentCallbackFlow.java:175)
at weblogic.application.internal.BaseDeployment$2.previous(BaseDeploymen
t.java:1281)
at weblogic.application.utils.StateMachineDriver.previousState(StateMach
ineDriver.java:167)
at weblogic.application.utils.StateMachineDriver.previousState(StateMach
ineDriver.java:160)
at weblogic.application.internal.BaseDeployment.deactivate(BaseDeploymen
t.java:453)
at weblogic.application.internal.SingleModuleDeployment.deactivate(Singl
eModuleDeployment.java:43)
at weblogic.application.internal.DeploymentStateChecker.deactivate(Deplo
ymentStateChecker.java:199)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.deactivate(
AppContainerInvoker.java:98)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.si
lentDeactivate(AbstractOperation.java:679)
at weblogic.deploy.internal.targetserver.operations.RedeployOperation.un
prepareDeployment(RedeployOperation.java:191)
at weblogic.deploy.internal.targetserver.operations.RedeployOperation.do
Prepare(RedeployOperation.java:114)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.pr
epare(AbstractOperation.java:217)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploym
entPrepare(DeploymentManager.java:749)
at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploy
mentList(DeploymentManager.java:1216)
at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare
(DeploymentManager.java:250)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.pre
pare(DeploymentServiceDispatcher.java:160)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallb
ackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:171)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallb
ackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallb
ackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:47)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTunin
gWorkManagerImpl.java:528)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

Any help in this regard will be highly appreciated.

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" 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_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>oepe-jpa-tutorial</display-name>
- <welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
- <context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/config/faces-config.xml, /WEB-INF/faces-config-1.xml</param-value>
</context-param>
- <context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
- <context-param>
<param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
<param-value>true</param-value>
</context-param>
- <context-param>
<param-name>org.apache.myfaces.PRETTY_HTML</param-name>
<param-value>true</param-value>
</context-param>
- <context-param>
<param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
<param-value>false</param-value>
</context-param>
- <!-- <context-param>
-->
- <!-- <param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name>
-->
- <!-- <param-value>false</param-value>
-->
- <!-- </context-param>
-->
- <!-- <context-param>
-->
- <!-- <param-name>org.apache.myfaces.DISABLE_TOMAHAWK_FACES_CONTEXT_WRAPPER</param-name>
-->
- <!-- <param-value>true</param-value>
-->
- <!-- </context-param>
-->
- <context-param>
<param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
<param-value>true</param-value>
</context-param>
- <context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
- <context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
- <listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
- <listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
- <filter>
<filter-name>MyFacesExtensionsFilter</filter-name>
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
- <init-param>
<param-name>uploadMaxFileSize</param-name>
<param-value>20m</param-value>
</init-param>
</filter>
- <!-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.)
-->
- <filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
- <!-- servlet-name must match the name of your javax.faces.webapp.FacesServlet entry
-->
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
- <!-- <filter-mapping>
-->
- <!-- <filter-name>MyFacesExtensionsFilter</filter-name>
-->
- <!-- <url-pattern>*.jsf</url-pattern>
-->
- <!-- </filter-mapping>
-->
- <!-- <filter-mapping>
-->
- <!-- <filter-name>MyFacesExtensionsFilter</filter-name>
-->
- <!-- <url-pattern>/faces/*</url-pattern>
-->
- <!-- </filter-mapping>
-->
- <filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
</filter-mapping>
- <servlet>
<servlet-name>faces</servlet-name>
<servlet-class>org.apache.myfaces.webapp.MyFacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
- <servlet-mapping>
<servlet-name>faces</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
- <servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
- <servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
- <welcome-file-list>
<welcome-file>searchCustomer.jsf</welcome-file>
</welcome-file-list>
</web-app>

--------------------------------------------------------------------------
WEBLOGIC.XML

<?xml version="1.0" encoding="UTF-8" ?>
- <wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" 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-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.1/weblogic-web-app.xsd">
<wls:weblogic-version>10.3.3</wls:weblogic-version>
<wls:context-root>prsMaven</wls:context-root>
- <!-- <wls:library-ref>
-->
- <!-- <wls:library-name>jsf-myfaces</wls:library-name>
-->
- <!-- <wls:specification-version>1.1</wls:specification-version>
-->
- <!-- <wls:exact-match>true</wls:exact-match>
-->
- <!-- </wls:library-ref>
-->
</wls:weblogic-web-app>

------------------------------------------------------------------
faces-config.xml

<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">

<!--
=========== FULL CONFIGURATION FILE ==================================
-->

<faces-config>

<application>
<message-bundle>resources.application</message-bundle>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
</application>
<managed-bean>
<managed-bean-name>customer</managed-bean-name>
<managed-bean-class>beans.Customer</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>customerManagedBean</managed-bean-name>
<managed-bean-class>beans.SpringCustomerManagedBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>customer</property-name>
<value>#{customer}</value>
</managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>customerListManagedBean</managed-bean-name>
<managed-bean-class>beans.SpringCustomerListManagedBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/pages/searchCustomer.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/pages/viewAllCustomers.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/pages/viewAllCustomers.jsp</from-view-id>
<navigation-case>
<from-outcome>historicalPoliciesList</from-outcome>
<to-view-id>/pages/viewSummary.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
-------------------------------------------------------
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>
- <parent>
<artifactId>si-applications</artifactId>
<groupId>com.lv.hps</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>com.lv.hps</groupId>
<artifactId>prsMaven</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
- <dependencies>
- <dependency>
<groupId>org.apache.myfaces.tomahawk</groupId>
<artifactId>tomahawk</artifactId>
<version>1.1.7</version>
</dependency>
- <dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.3</version>
<scope>compile</scope>
</dependency>
- <dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.0.3</version>
<scope>compile</scope>
</dependency>
- <!-- <dependency>
-->
- <!-- <groupId>javax.faces</groupId>
-->
- <!-- <artifactId>jsf-api</artifactId>
-->
- <!-- <version>2.0.2-FCS</version>
-->
- <!-- </dependency>
-->
- <dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>1.1.5</version>
</dependency>
- <dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>1.1.5</version>
</dependency>
- <!-- <dependency>
-->
- <!-- <groupId>com.sun.faces</groupId>
-->
- <!-- <artifactId>jsf-impl</artifactId>
-->
- <!-- <version>2.0.3</version>
-->
- <!-- <scope>compile</scope>
-->
- <!-- </dependency>
-->
- <dependency>
<groupId>javax.persistence</groupId>
<artifactId>com.springsource.javax.persistence</artifactId>
<version>1.0.0</version>
</dependency>
- <dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.2.0</version>
</dependency>
- <dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.orm</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
- <!-- <dependency>
-->
- <!-- <groupId>org.springframework</groupId>
-->
- <!-- <artifactId>spring-jpa</artifactId>
-->
- <!-- <version>2.0-m2</version>
-->
- <!-- </dependency>
-->
- <!-- Spring 3
-->
- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
- <!-- Spring Security
-->
- <dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
- <dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
- <dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
- <!-- JSTL Dependancy
-->
- <dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
- <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
- <!-- for database connectivity
-->
- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
- <dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0</version>
</dependency>
- <dependency>
<groupId>com.lv.hps</groupId>
<artifactId>hps</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
- <configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
- <!-- <plugin>
-->
- <!-- <groupId>org.apache.maven.plugins</groupId>
-->
- <!-- <artifactId>maven-war-plugin</artifactId>
-->
- <!-- <version>2.2</version>
-->
- <!-- <configuration>
-->
- <!-- <warSourceDirectory>WebContent</warSourceDirectory>
-->
- <!-- <failOnMissingWebXml>false</failOnMissingWebXml>
-->
- <!-- </configuration>
-->
- <!-- </plugin>
-->
- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
- <configuration>
<webXml>src\main\webapp\WEB-INF\web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
</project>



Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

Welcome to the JavaRanch, Rajiv! You can use the "Code" button to add tags to your message that will display formatted constructs such as Java code and XML in a more readable way.

I'm going to make a wild guess and assume that you have included a WebLogic server module into your webapp when the actual module is part of the server itself. In other words, it shouldn't be in the WEB-INF/lib, because WebLogic already has it.

Maven has a special scope for artefacts that need to be referenced for compiling whilst not actually being included as part of the build. In your dependency declaration, include a "<scope>provided</scope>".


Customer surveys are for companies who didn't pay proper attention to begin with.
Rajiv Girotra
Greenhorn

Joined: Feb 28, 2013
Posts: 3
Thankyou very much Tim for the quick response. I shall take care that I use code button in future.

Yes your assumption is correct. When I was creating the JPA project using "Oracle enterprise pack for eclipse", at one point it gave me an option to choose JSF implementation Library (Myfaces) i.e. jsf-myfaces version 1.1. When I deploy my module to weblogic via elipse tool, it automatically deploys this library on weblogic.

I will try including your advice in the pom file so that it uses those libraries just for compiling and the original module uses the above library in weblogic. I will try this in a couple of days.

I was curious if it was possible to get rid of the above said weblogic module by inlcuding some maven dependencies.

Once again, thankyou for your time.

Warm Regard,
Rajiv
Rajiv Girotra
Greenhorn

Joined: Feb 28, 2013
Posts: 3
Thanks Tom. Adding compilation scope in POM helped but was still using the shared library. I got rid of the shared library by adding the following dependencies in POM.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF Error- Maven Project on Weblogic: Application was not properly initialized at startup, could not