Friday, February 17, 2012

Changing the maximum size for uploaded files in Oracle WebCenter

Those of you who have worked with Oracle WebCenter, have probably a content repository configured for your collaboration space. If you have tried uploading files in the document explorer task flow, you would notice that the maximum allowed file size is 2 MB, which is not what most of us are used to. As you can see the message says that the max. file size allowed is 2 GB, which is clearly a lie. So here is how to change it.


1. Export your WebCenter Spaces metadata file using the following command(s)
cd <WC HOME>\common\bin\
wlst.bat
2. Wait for the script to finish initializing, then type
connect('weblogic', 'welcome1', 't3://<host>:7001')
3. Replace the values in quotes with yours of course, then
exportMetadata(application='webcenter', server='WC_Spaces', toLocation='c:/', docs='/oracle/webcenter/webcenterapp/metadata/webcenter-config.xml')
4. Then navigate to c:/oracle/webcenter/webcenterapp/metadata and edit the webcenter-config.xml file. Change the <webcenter:uploadedFileMaxDiskSpace> value, the default is 2097152 which is around 2 MB, so change it to 2147483648 (2 GB).

5. Then import the modified file back, if you have closed the wlst session, repeat step 1 and 2 then type
importMetadata(application='webcenter',server='WC_Spaces',fromLocation='c:/',docs='/oracle/webcenter/webcenterapp/metadata/webcenter-config.xml')
6. Exit wlst
exit()
7. Restart the WC_Spaces managed server

Friday, February 3, 2012

Using P6 R8 Web Services in Web Applications (Weblogic)

If you are familiar with Primavera P6 development, you would know about the "P6 Web Services", which in practice, is a web application exposing the functionality of the Integration API through web services. Recently I had to consume a bunch of these web services in a Web Application (to be deployed on Weblogic AS). If you take a look at the Demo provided by the Web Services Installation (a Java swing application that creates a sample project), you would notice the libraries required to consume such services, the most important of which are cxf-bundle, p6ws-jaxws-client and osdt-*. After developing a pretty simple application and deploying it on Weblogic AS, I hit the following error:
weblogic.wsee.jaxws.spi.ClientInstanceInvocationHandler cannot be cast to org.apache.cxf.frontend.ClientProxy


After lots of googling, I finally found the problem. The CXF libraries used in the web service stubs are being overridden by Weblogic AS which causes the problem. The solution is to add the package preference setting in weblogic.xml file in your application (if you don't have one create it using File->New->Weblogic Deployment Descriptor). So your weblogic.xml should look something like:

<?xml version = '1.0' encoding = 'windows-1252'?>
<weblogic-web-app xmlns="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.2/weblogic-web-app.xsd">
  <context-root>yourapp</context-root>
  <container-descriptor>
  <prefer-application-packages>
    <package-name>org.apache.cxf.binding.soap.saaj.*</package-name>
    <package-name>org.apache.cxf.endpoint.*</package-name>
    <package-name>org.apache.cxf.frontend.*</package-name>
    <package-name>org.apache.cxf.transport.http.*</package-name>
    <package-name>org.apache.cxf.interceptor.*</package-name>
    <package-name>org.apache.cxf.transports.http.configuration.*</package-name>
  </prefer-application-packages>
  </container-descriptor>
</weblogic-web-app>
This should resolve the library conflict. If you get an error like this:
This class does not support SAAJ 1.1 weblogic
The Reason for the problem is Weblogic’s default SAAJ implementation, so you need to override the properties to use a better implementation weblogic.xml.saaj  package. You can do that by adding the following parameters to your Weblogic startup script:
JAVA_OPTIONS= %JAVA_OPTIONS% -Djavax.xml.soap.MessageFactory=com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl -Djavax.xml.soap.SOAPConnectionFactory=weblogic.wsee.saaj.SOAPConnectionFactoryImpl