sexta-feira, 5 de dezembro de 2014

java.lang.OutOfMemoryError while compiling weblogic.appc is running

Hello all,

This week, after 2 months waiting Oracle to answer me in MOS I finally got the solution for my problem.

The weblogic.appc tool pre-compiles each JSP file before deploying your project to Integrated WLS, otherwise your application could take a big performance hit as it needs to compile each .JSP file after the first request. This so called "feature" could get you in some trouble if you have more 400+ .jsp files, the fact lies beyond the heap parameters in weblogic.appc compiler, the default values (-Xms128 and -Xmx512) aren't enough to a big project like that.

After some analysis Oracle Support offered me two solutions:

  • 1) Start JDeveloper with the following argument from command-line: 

      -J-Djdev.webapp.appc.addition.jvmargs=-Xmx1025m 

    Example: 

      jdevW.exe -J-Djdev.webapp.appc.addition.jvmargs=-Xmx1025m 

    Important: this argument is for internal development, hence is not officially supported and is subject to change or removal. 

    See if you can compile the project. 

    You'll notice an output like this in the compiler log: 
    --- 
    C:\Oracle\jdev111170\jdk160_24\jre\bin\javaw.exe -Xms128m -Xmx512m -XX:MaxPermSize=128m -Xverify:none -client -classpath C:\Oracle\jdev111170\jdk160_24\lib\tools.jar;C:\Oracle\jdev111170\wlserver_10.3\server\lib\weblogic.jar -Dweblogic.jsp.diagnosticWithAbsolutePath=true -Dweblogic.classloader.noJarSigners=true -Xmx1025m weblogic.appc "@C:\Users\wperezs\AppData\Local\Temp\appcCommandList4301097272113615486.txt" 
    --- 

    Notice that argument -Xmx shows twice: the first is internally passed by JDev and the second is the one we are passing with above argument. 
    This is because is not possible to override arguments we are passing internally through JDeveloper. 


    2) If the above didn't help, are left with the following options: 

    a) Disable compilation at DT when deploying to to Integrated Weblogic Server. 

    Uncheck "Compile JSP before deploying to Integrated Weblogic Server" checkbox in Project Properties > Compiler > JSP. 
Both of them worked and now my project is compiling fine. I'm thinking about permanently disabling the JSP pre-compilation as we do far more deploys locally than remote.

quarta-feira, 26 de fevereiro de 2014

ViewObject Forward Only mode

Hi!

Today I was reading a interesting topic about one of ViewObject tuning properties, it is called Forward Only mode, you can programmatically set it by calling setForwardOnly(true). This property won't allow the ViewObject to cache the previous loaded rows while RowSet scroll is happening.

Link to the documentation: http://docs.oracle.com/cd/E21043_01/web.1111/b31974/bcadvvo.htm#sm0342

Section

39.2.6 Use Forward Only Mode to Avoid Caching View Rows

As stated in documentation:
"Often you will write code that programmatically iterates through the results of a view object. A typical situation will be custom validation code that must process multiple rows of query results to determine whether an attribute or an entity is valid or not. In these cases, if you intend to read each row in the row set a single time and never require scrolling backward or re-iterating the row set a subsequent time, then you can use "forward only" mode to avoid caching the retrieved rows. To enable forward only mode, call setForwardOnly(true) on the view object.

Note:
Using a read-only view object (with no entity usages) in forward-only mode with an appropriately tuned fetch size is the most efficient way to programmatically read data.
You can also use forward-only mode to avoid caching rows when inserting, updating, or deleting data as long as you never scroll backward through the row set and never call reset() to set the iterator back to the first row. Forward only mode only works with a range size of one (1)."



Good to know!

sábado, 15 de fevereiro de 2014

Accessing ViewObjectImpl sample methods trough Groovy

Hi!

Here are two ViewObjectImpl sample methods, one using direct Where Clause modification and another one using ViewCriteriaRow API:

Class br.com.home.view.JobsVOImpl.getJobWithMinimumSalary()

    private static ADFLogger LOGGER =
               ADFLogger.createADFLogger(JobsVOImpl.class);
    private String minimumSalaryWhereClause = "MIN_SALARY IN (SELECT MIN(MIN_SALARY)\n" +
                                              "                 FROM HR.JOBS)\n" +
                                              "       AND ROWNUM = 1";
    private String minimumSalaryWhereClauseVC = "SELECT MIN(MIN_SALARY)\n" +
                                                "  FROM HR.JOBS\n";

    public String getJobWithMinimumSalary() {
        setWhereClause(minimumSalaryWhereClause);
        LOGGER.warning("WHERE clause -> " + this.getWhereClause());
        executeQuery();

        String jobId = "SH_CLERK";
        if (first() != null) {
           jobId = (String)first().getAttribute("JobId");
        }
        LOGGER.warning("Selected JobId -> " + jobId);
        setWhereClause(null);
        LOGGER.warning("WHERE being reseted -> " + this.getWhereClause());

        return jobId;

    }

    public String getJobWithMinimumSalaryVCVersion() {
        ViewCriteria minimumSalaryVc = createViewCriteria();
        ViewCriteriaRow vcRow = minimumSalaryVc.createViewCriteriaRow();
        ViewCriteriaItem criteriaItem = vcRow.ensureCriteriaItem("MinSalary");
        criteriaItem.setOperator(JboCompOper.OPER_IN);
        criteriaItem.setIsSqlFragment(true);
        criteriaItem.setValue(minimumSalaryWhereClauseVC);
        minimumSalaryVc.add(vcRow);
        applyViewCriteria(minimumSalaryVc);
        executeQuery();

        return (String)first().getAttribute("JobId");
    }

Two methods that does exactly the same thing but with slightly different approach. After that suppose that you want to populate the JobId attribute in Employees View Object with the previous created method return:
adf.source.getApplicationModule().findViewObject("JobsVO1").getJobWithMinimumSalary();

Don't forget to mark the Default Value indicator as "Expression", that will take care of Groovy interpretation process. Run trough AppModule tester to see runtime generated queries of both methods.

segunda-feira, 28 de outubro de 2013

Weird Weblogic deployment exception

Hi everyone!

Just a note for myself, today I faced a weird exception while trying to start a Managed Server from our Weblogic Cluster.

The server crashed due to an exception:
java.lang.OutOfMemoryError: allocLargeObjectOrArray: [Ljava/lang/Object;, size 16400

I don't know exactly what hapenned, especially because the time that exception ocurred we had almost no users online.

After trying to start the Managed Server I was facing this error:
weblogic.management.DeploymentException: Exception occured while downloading files

And then:
Caused By: java.io.IOException: [DeploymentService:290066]Error occurred while downloading files from admin server for deployment request "0". Underlying error is: "null"

After some Googling I found a blog post that helped me a lot:
http://www.javamonamour.org/2012/10/javaioioexception-deploymentservice2900.html

One special note to "and the Admin is unable to redeploy the file". After reading that I started to look into Stage directories inside managed server's to see if something is missing. I found out that the last version of the application wasn't there and after I managed to deploy it manually to the managed server, it started normally.

Now it is just some time to let the Load Balancer do its work and free some of other managed servers load =).



Hope it helps someone! Especially because I didnt't found anything that specific about the issue.

segunda-feira, 22 de julho de 2013

The deferred EL expression is not allowed since deferredSyntaxAllowedAsLiteral is false

This error usually happens when you forgot to declare the Tag Libraries in your Web project inside JDeveloper, just import the library (trough JSP Tag Libraries inside your IDE, I'm using JDeveloper here but I think that all of then uses the same concept) that references the attribute TAG and everything should compile.

sábado, 27 de outubro de 2012

JDeveloper Data Control palette is missing

In day-to-day use JDeveloper always make some weird things by itself... Here I'am showing how to solve the most common one, the Data Control Palette got hidden somewhere in the darkness...

Screen showing the Palette:

Altough I was not able to reproduce the problem I know how to solve it, you just have to go to Window Menu and click "Reset Windows to Factory Settings", that'll fix some lost tag in one of JDeveloper configuration XML's.

404 Error while running a Bounded Task Flow inside Dialog

Morning!

When running a task-flow as a dialog do not forget to add those attributes to the button that calls the btf:
useWindow="true" windowHeight="400" windowWidth="500"

Without this you'll probably run into a 404 error, here is part of the exception (pt-BR message):
 <XmlHttpServletResponse> <_logException>   
 javax.servlet.ServletException: ADF_FACES-60101:Código de Status de Erro de HTTP: 404."