Liberty Profile 8.5 & BIRT - jsf

I'm building a web application running on Liberty profile 8.5 using BIRT. The web application includes all BIRT needed libs in WEB-INF/lib folder, but I have the following exception in birt logs just when I run chart reports (not for text reports):
WARNING: Exception org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Package with uri 'http://www.birt.eclipse.org/ChartModel' not found. (file:///opt/IBM/WLP-8.5.5/usr/servers/IBMWTC/test.chart, 1, 314) at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:77) at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:185) at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:261) at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1518) at org.eclipse.birt.chart.model.impl.SerializerImpl.fromXml(SerializerImpl.java:465) ... ...
Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'http://www.birt.eclipse.org/ChartModel' not found. (file:///opt/IBM/WLP-8.5.5/usr/servers/IBMWTC/test.chart, 1, 314) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(XMLHandler.java:2625) ... ...
The only way to make it working is to set the classloader to 'parentlast' in the server.xml:
<webApplication ...>
<classloader delegation="parentLast"/>
</webApplication>
but this setting makes the application not working with other framework (as jsf 2.0 defined at server level through the related liberty feature).

Related

Liberty profile: birt and jsf integration

I'm building a web application running on Liberty profile 8.5, with JSF 2.0 feature enabled (jsf-2.0 in server.xml) and BIRT integration in the web app.
The web application includes all BIRT needed libs in WEB-INF/lib folder, but the only way to make it working (specially for chart report) is to set the classloader to 'parentlast' in the server.xml:
<webApplication contextRoot="MyApp" id="MyApp" location="MyApp.war" name="MyApp">
<classloader delegation="parentLast"/>
</webApplication>
In this way, I correctly see charts and reports.
But the 'parentlast' setting makes JSF not working, with this exception:
[ERROR ] SRVE0315E: An execption occurred:
com.ibm.ws.webcontainer.webapp.WebAppErrorReport:
javax.servlet.ServletException: SRVE0207E: Uncaught initialization
exception created by servlet at
com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:385)
at [internal classes] Caused by: javax.servlet.ServletException:
SRVE0207E: Uncaught initialization exception created by servlet ... 3
more
Caused by: java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
A typical config looks like this;
<listener><listenerclass>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
Without the parentlast setting, the JSF pages are correctly shown, but BIRT charts don't work.
I understand this behaviour, as the parentlast classloading makes the application seeing at first the application libs, where JSF is not included (it's loaded at server scope).
Any suggestion?
Thank you in advance!

JSF 1.2 application not getting deployed on websphere 8.5

I am trying to deploy JSF 1.2 application on WAS 8.5 server. But it is throwing below error on deployment.
Note: In the WAS admin, Under JSF implementation use console, I have selected the "Sun Reference Implementation 1.2 " option . But still problem persist.
[12/17/14 15:12:41:222 PST] 00000095 webapp E com.ibm.ws.webcontainer.webapp.WebApp notifyServletContextDestroyed SRVE0285E: Exception caught while destroying context: {0}
java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
A typical config looks like this;
<listener>
<listener- class> org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:196)
at org.apache.myfaces.context.servlet.FacesContextImplBase.getApplication(FacesContextImplBase.java:131)
at org.apache.myfaces.webapp.AbstractFacesInitializer._dispatchApplicationEvent(AbstractFacesInitializer.java:261)
at org.apache.myfaces.webapp.AbstractFacesInitializer.destroyFaces(AbstractFacesInitializer.java:293)
at org.apache.myfaces.webapp.StartupServletContextListener.contextDestroyed(StartupServletContextListener.java:153)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextDestroyed(WebApp.java:1748)
You should restart the application server (not just the app). You should also make sure jsf-api.api and jsf-impl.jar are not in WEB-INF/lib of your app.

WebSphere Liberty profile JAXBContext ClassCastException

I am using the WebSphere Liberty Profile server, version 8.5.5.3. I have an ear containing multiple wars. I deploy them all exploded (ear and the war's of the modules inside it as well).
When deploying it I get the following class cast exception:
java.lang.RuntimeException: javax.xml.bind.JAXBException:
ClassCastException: attempting to cast bundleresource://67.fwk-1166858817/javax/xml/bind/JAXBContext.class
to jar:file:/C:/ws/IBM/java_1.7_64/jre/lib/rt.jar!/javax/xml/bind/JAXBContext.class.
Please make sure that you are specifying the proper ClassLoader.
I figured that the problem is that my bundled jax-api and jaxb-impl jars are not loaded, so I added to the server.xml the parentLast class loading option:
<enterpriseApplication id="ear-app" location="C:/ws/ear/exploded/ear-app.ear" name="ear-app" >
<classloader delegation="parentLast" commonLibraryRef="provided-jars" privateLibraryRef="shared-libs"/>
</enterpriseApplication>
I added my jax-api and jax-impl jars to this folder
<library id="shared-libs">
<fileset dir="${server.config.dir}/lib/global" include="*.jar"/>
</library>
However I still have the ClassCastException, it looks like it is still using the parentFirst classloading?
I found other jaxb ClassCastException threads, but not when using the Liberty profile..
Maybe it is a typo, but in your post you have delegation="parentFirst" instead of parentLast.
Did you check to just change delegation for application like this:
<enterpriseApplication id="ear-app" location="C:/ws/ear/exploded/ear-app.ear" name="ear-app" >
<classloader delegation="parentLast"/>
</enterpriseApplication>
For more details see Overriding a provided API with an alternative version
I worked aroud the problem by not using the parentLast. Thanks for the help.

Websphere 8.5 upgrade and java2 security - strange error in spring transaction

We are migrating from WAS 6.1 to 8.5. I simply copied the EAR file which we used to deploy in 6.1 to 8.5. The application worked fine and I was happy until web-sphere admin decided to turn on Java2 security. The current was.policy file had java.security.AllPermission. But I guess this does not work with java2 security, so I changed it and granted io permission to every file which is read/written. After this, all permissions related errors are gone, but i am stuck with a strange exception:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wsJtaTm' defined in ServletContext resource [/WEB-INF/applicationContext.xml]:
Instantiation of bean failed; nested exception is
org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.transaction.jta.WebSphereTransactionManagerFactoryBean]:
Constructor threw exception; nested exception is
org.springframework.transaction.TransactionSystemException: Could not find WebSphere 5.1/6.0/6.1 TransactionManager factory class; nested exception is
java.lang.ClassNotFoundException: com.ibm.ws.Transaction.TransactionManagerFactory
My spring transaction is defined like this:
<bean id="wsJtaTm"
class="org.springframework.transaction.jta.WebSphereTransactionManagerFactoryBean" />
<bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager" ref="wsJtaTm" />
</bean>
I don't understand why the app would work when Java2 security is turned off, and why would it throw ClassNotFound exception when i turn the java2 security on.
According to my knowledge, com.ibm.ws.Transaction.TransactionManagerFactory should be loaded by server itself and should be made available to the app. i don't have any jar in my app having this class.
The error is originating from the constructor of bean id wsJtaTm. Am I missing something in was.policy file?
On further research, i found that this class is present inside a jar file named com.ibm.ws.runtime.jar in the plugins folder of server installation. I don't understand why this jar becomes in-visible when java2 security is turned on.
Please note I am using spring v2.5
Kindly help.
The com.ibm.ws.Transaction.TransactionManagerFactory class is not API, and WebSphere Application Server restricts access to non-API classes when Java 2 security is enabled (if applications could access internal classes, they could easily circumvent Java 2 security). Try using Spring's org.springframework.transaction.jta.WebSphereUowTransactionManager, which uses the supported UOWManager API.

JSF html component on WebSphere 7.0

We are in the process of upgrading to WebSphere 7.0 on Windows 2008 R2. Our applications currently run on WebSphere 6.1 on Windows 2003.
We use custom controls we wrote using JSF 1.1 in our applications. Our controls seem to render and interact fine, however whenever we use a JSF HTML component such as:
<%# taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
...
<h:graphicImage url="#{MenuBean.bannerImagePath}" />
We get the following error:
com.ibm.ws.jsp.JspCoreException: Unable to convert string '#{MenuBean.bannerImagePath}' to class javax.el.ValueExpression for attribute url: java.lang.IllegalArgumentException: Property Editor not registered with the PropertyEditorManager
com.ibm.ws.jsp.JspCoreException: Unable to convert string '#{MenuBean.bannerImagePath}' to class javax.el.ValueExpression for attribute url: java.lang.IllegalArgumentException: Property Editor not registered with the PropertyEditorManager
at org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:939)
at com.ibm._jsp._dashboard._jspx_meth_h_graphicImage_0(_dashboard.java:136)
at com.ibm._jsp._dashboard._jspx_meth_f_view_0(_dashboard.java:436)
at com.ibm._jsp._dashboard._jspService(_dashboard.java:109)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1583)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1523)
I have found an article on IBM's website giving a possible fix:
http://www-01.ibm.com/support/docview.wss?uid=swg21318801
However I have removed the specified jars and am still receiving the error message. Again our custom controls seem to work fine under WebSphere 7's JSF 1.2.
Thanks for any help you can provide.
Mike
Listing of WEB-INF\lib
activation.jar
commons-beanutils-1.8.0.jar
commons-collections-3.2.1.jar
commons-dbcp-1.2.2.jar
commons-digester-1.8.1.jar
commons-fileupload-1.2.1.jar
commons-io-1.4.jar
commons-logging-1.1.1.jar
commons-pool-1.4.jar
concurrent.jar
dib-2.0.3.jar
ibatis-2.3.4.726.jar
ifc-3.1.0.jar
imgipt-3.0.0.7.jar
ironeyesql.jar
iText-2.1.5.jar
jasperreports-3.5.0.jar
jaxen-full.jar
jcommon-1.0.12.jar
jdom.jar
jdt-compiler-3.1.1.jar
jfreechart-1.0.9.jar
localization-3.1.0.jar
log4j-1.2.15.jar
mail.jar
mflutil-3.1.0.jar
mmwfoundation-3.1.0.jar
RapidSpellWeb.jar
saxpath.jar
Stedmans.dict
tcr-3.1.0.jar
xalan.jar
xercesImpl-2.4.0.jar
xml-apis.jar
After recompiling against JSF 1.2, rebuilding config files, and updating tld files in the WEB-INF folder, I'm happy to report our problem is fixed. Not exactly sure which fixed the problem. Thanks for your time.
Mike

Resources