Why the ViewScope Token Fails in a Stand‑alone WL 12c
When you move an ADF application from JDeveloper’s integrated server to a standalone WebLogic 12.2.1.3 domain, the runtime environment changes. The integrated server automatically loads the ADF libraries and enables the ViewScope state‑token mechanism. In a plain WL domain those libraries are missing, so the ADF controller cannot create a ViewScope and throws the error `ADFc: ViewScope not available in this environment, cannot save State-token.` The stack trace ending in `TaskFlowRegionController.getViewPortState` confirms that the controller never found a ViewScope instance.
Install ADF Runtime on the WebLogic Domain
Run the ADF configuration wizard that ships with JDeveloper or the Oracle Fusion Middleware installer. It adds the required JARs (adf‑faces, adf‑controller, adf‑model, etc.) to the domain’s lib directory and updates the server’s classpath.
```bash # From JDeveloper installation $ORACLE_HOME/oracle_common/common/bin/config.sh -mode=adhoc -add_adf ```
After the wizard finishes, restart the server. The domain now contains the ADF shared libraries that the integrated server used implicitly.
Update the EAR to Prefer Application Packages
Even with the domain libraries present, WebLogic may still load its own older ADF classes. Force the EAR to use the bundled ADF version by adding a `weblogic.xml` descriptor with a `prefer-application-packages` block. This ensures the ViewScope implementation comes from the EAR, not the server’s default classloader.
```xml <?xml version="1.0" encoding="UTF-8"?> <wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"> <wls:container-descriptor> <wls:prefer-application-packages> <wls:package-name>oracle.adf.*</wls:package-name> <wls:package-name>oracle.jbo.*</wls:package-name> </wls:prefer-application-packages> </wls:container-descriptor> </wls:weblogic-web-app> ```
Place this file under `src/main/webapp/WEB-INF` before building the EAR.
Enable ViewScope in adf-config.xml
The ADF runtime needs an `adf-config.xml` that declares the ViewScope feature. JDeveloper adds it automatically, but a plain EAR may miss it. Create the file in `META-INF` with the following content:
```xml <?xml version="1.0" encoding="UTF-8"?> <adf-config xmlns="http://xmlns.oracle.com/adf/config"> <view-scope enabled="true"/> </adf-config> ```
Deploy the updated EAR and verify that the `adf-config.xml` is packaged inside `META-INF`. The ViewScope token can now be stored and restored during the RESTORE_VIEW phase.
Validate the Deployment
Redeploy the EAR to the 12.2.1.3 server and open the application. The welcome page should load, and the dynamic tab shell will render the view object without the `ADF_FACES-60098` exception. Check the server log for the absence of `ADFC-00032` messages. If the error persists, confirm that the domain’s `config.xml` lists the ADF shared libraries under `<library-ref>` and that the EAR’s `MANIFEST.MF` contains the correct `Extension-Name` entries.
Takeaway: Install ADF runtime, prefer application packages, and add adf-config.xml to enable ViewScope in a standalone WebLogic 12c deployment.
People also ask
Do I need to reinstall JDeveloper after migrating to WebLogic 12c?
No. JDeveloper is only the development IDE; the critical step is installing the ADF runtime libraries on the target WebLogic domain.
Can I use the same EAR for both integrated and standalone servers?
Yes, once you add `weblogic.xml` and `adf-config.xml` the EAR works in both environments.
What if I still see ADFC-00032 after these changes?
Verify that the domain’s `config.xml` references the ADF shared libraries and that no older ADF JARs are lingering in the server’s classpath.
Is ViewScope the only scope that requires special configuration?
ViewScope is the only one that depends on the state‑token mechanism; other scopes (request, session, flash) work without extra setup.
Inspired by a public discussion on Stack Overflow. This article is an original explanation for learners.