« Doing Presentations in New Places | Main | Another Tip for OTN Forums Users »

Common pitfalls when deploying from JDeveloper 11g to WebLogic 10.3

One thing we should probably do in future versions of JDeveloper is work to simplify the deployment steps even further.
Don't get me wrong, we are doing a nice job now with one click packaging and deploy to a remote server - but there are still some pitfalls that people might run into.

Here is a sample demo showing the basic deployment of an ADF application to a remote WebLogic Server.

The first problem most people run into is that they don't read the manual - there are quite clear instructions for deployment in the Fusion Developer Guide.
Here is a direct link to the deployment chapter.

Here are a couple of things you might run into and how to solve them.

Missing ADF libraries

If you are deploying to a stand-alone WebLogic Server - it won't have the ADF libraries on it by default. Luckily for you it is now very easy to deploy them to the server with the JDeveloper installer. You simply invoke it and choose to install to an existing WebLogic directory, and then uncheck the JDeveloper installation - it will then let you install the ADF libraries.
Then you'll be able to server's configuration wizard to add the ADF libraries to a domain.


Data-sources - and not finding them

When you are building an ADF BC application, or any other Java EE application for that matter, you should take advantage of the data-sources capabilities of your server.
In ADF BC's application module configuration it is quite easy to edit the configuration and replace the connection to be based on a JDBC DataSource instead of direct JDBC connection - once you do that the JDBC data source name will be something like: java:comp/env/jdbc/scottDS (where scott is the name of the DB connection you defined for your application).

After you did this modification, the next step is to go into the WLS admin console and define a data source. The important thing here is to have the JNDI Name be: jdbc/scottDS
This way your JDBC connection will be found.
One more common overlooked thing here is that after you define the data source in WLS you need to give it a target. So click the Targets tab and assign the datasource to the server you are going to deploy to.

One click packing from inside JDeveloper
When you create a regular Fusion application you get two projects a Model one and a ViewController one.
If you right click the ViewController one and choose deploy you'll be able to create a WAR file and directly deploy to WebLogic, but then you might run into an error message which will have this line somewhere in it:
java.lang.ClassNotFoundException: oracle.adf.library.webapp.ResourceServlet

The right way to deploy the complete application is to do it from the application level menu - where you'll find another deploy option - this will create an EAR file that will deploy successfully.

t008.gif

Ran into another gotcha? let me know in the comments and help create a knowledge base for future generation.

Comments (10)

Anita:

Hi Shay,
i succeded to deploy and run my web application (using BC and ADF Faces) to a Standalone WebLogic Server Instance started on the command line using startWebLogic.cmd.

When I set up the Server Instance as Windows Service (following instructions http://e-docs.bea.com/wls/docs103/server_start/winservice.html) my deployed application is not started in the start up process of the WL Server. I'm not able to install/start it manually from within the Administration Console. So I tried to redeploy it from within the JDeveloper11g. But the Deployment process failed as well. [Deployer:149034]An exception occurred for task [Deployer:149026]deploy application ... on AdminServer.: .
weblogic.management.DeploymentException:
#### Deployment incomplete.

I posted my problem on the Oracle WebLogic Forum as well. But nobody answered till now :-(( http://forums.oracle.com/forums/thread.jspa?threadID=830959&tstart=0

Do you have any Idea, why the deployment works on the WLS Instance started from the Windows command line and why it failes, when it is started as a Windows Service? I changed neither the Configuration of the WL Server nor the Application Deployment.

Thanks in advance!
Regards Anita

nico:

Hi,

how did you manage to have 2 ViewController projects. Is there something special to be cofigured to make it deployable and working with such a setup?

Thanks
Nico

Vijay Chavan:

hi
I deployed my ADF BC JSF Application on Oracle WebLogic 10.3,
i have created Session Beans for application module
created Datasource with name expertDS.
bc4j.config file look like bellow,

EjbWls
../ModelEJB.deploy
jdbc/expertDS
employeeBean
../ModelMiddleTier.deploy
../ModelCommon.deploy
true
weblogic
simple
model.emp.am.employee


Sir, Can you tell me where i am wrong.

Thanks
Vijay Chavan

Hi Shay

You have written about the DataSource configuration.

"In ADF BC's application module configuration it is quite easy to edit the configuration and replace the connection to be based on a JDBC DataSource instead of direct JDBC connection "

I want to use JNDI to connect to the database in a Struts application. Where exactly do i define the datasource? How do i find the WLS admin console?

Thanks
Neeti

shay:

Neeti,

You can access the admin console by adding a /console to the end of your URL like this:
http://127.0.0.1:7101/console

Shay

Hi Shay
I connected to the admin console and made a datasource with
Name = SQL
JNDI Name = jdbc/SQLDS.

I tested the connection and the data source and it is working out well.

Now i want to use this datasource from my struts application. I have been connecting to the database using JDBC Connections using DriverManager. Now I want to use JNDI to connect to the database.

I found out that the following statements have to be written in the application:

InitialContext context = new InitialContext();
DataSource ds = (DataSource) context.lookup("--");

I tried putting the JNDI name "jdbc/SQLDS" as the parameter for the lookup.

Then I put the following in the web.xml:


data source
jdbc/SQLDS
javax.sql.DataSource
Container

I made a database connection called SQL for the application.

When i ran the application, it gave me the error as
"
javax.naming.NameNotFoundException: While trying to lookup 'jdbc.SQLDS' didn't find subcontext 'jdbc'. Resolved ''; remaining name 'jdbc/SQLDS'
"
I saw in an article that you can put "java:comp/env/jdbc/SQLDS" . I used that and I get a similar error that it can't find comp/env/jdbc/SQLDS.

Can you help me out to understand what I am supposed to put for the lookup?

Thanks
Neeti

shay:

Neeti,

Please ask these questions on the WebLogic forum on OTN - These look like generic WLS questions that don't seem to be related to JDeveloper or ADF.

rifinio:

hello;

i m a new user of the jDevoloper 11. and i'm trying to create an web Application with ADF faces.
i used to run the application without any problems.
but today when i tried to run it
it gives me that error message in the log window

--------------------------------------------------------------------------------
http://Running application JSFApplication on Server Instance DefaultServer...
Uploading credentials.
---- Deployment started. ---- May 19, 2009 11:06:08 AM
Target platform is (Weblogic 10.3).
Running dependency analysis...
#### Deployment incomplete. #### May 19, 2009 11:06:08 AM
java.lang.RuntimeException: java.lang.NullPointerException
at oracle.jdevimpl.deploy.common.ModulePackagerImpl.deployProfiles(ModulePackagerImpl.java:88)
at oracle.jdeveloper.deploy.common.ModulePackager.deployProfiles(ModulePackager.java:63)
at oracle.jdeveloper.deploy.common.ModulePackager.deployImpl(ModulePackager.java:52)
at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
at oracle.jdevimpl.deploy.fwk.WrappedDeployer.deployImpl(WrappedDeployer.java:39)
at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
at oracle.jdeveloper.deploy.common.BatchDeployer.deployImpl(BatchDeployer.java:82)
at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
at oracle.jdevimpl.deploy.fwk.WrappedDeployer.deployImpl(WrappedDeployer.java:39)
at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
at oracle.jdevimpl.deploy.fwk.WrappedDeployer.deployImpl(WrappedDeployer.java:39)
at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
at oracle.jdeveloper.deploy.common.BatchDeployer.deployImpl(BatchDeployer.java:82)
at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
at oracle.jdevimpl.deploy.fwk.WrappedDeployer.deployImpl(WrappedDeployer.java:39)
at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
at oracle.jdeveloper.deploy.common.BatchDeployer.deployImpl(BatchDeployer.java:82)
at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
at oracle.jdevimpl.deploy.fwk.WrappedDeployer.deployImpl(WrappedDeployer.java:39)
at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
at oracle.jdeveloper.deploy.common.BatchDeployer.deployImpl(BatchDeployer.java:82)
at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
at oracle.jdevimpl.deploy.fwk.WrappedDeployer.deployImpl(WrappedDeployer.java:39)
at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
at oracle.jdevimpl.deploy.fwk.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:436)
at oracle.jdeveloper.deploy.DeploymentManager.deploy(DeploymentManager.java:209)
at oracle.jdevimpl.runner.adrs.AdrsStarter$5$1.run(AdrsStarter.java:1365)
Caused by: java.lang.NullPointerException
at oracle.ide.net.URLFileSystem$TrackedOutputStream.flush(URLFileSystem.java:2332)
at java.io.FilterOutputStream.flush(FilterOutputStream.java:123)
at oracle.jdevimpl.deploy.stripe.MonitoredOutputStream.flush(MonitoredOutputStream.java:84)
at java.io.FilterOutputStream.close(FilterOutputStream.java:140)
at oracle.jdevimpl.deploy.stripe.MonitoredOutputStream.close(MonitoredOutputStream.java:89)
at oracle.jdevimpl.webapp.jsp.libraries.wl.WebLogicDeployerListener.prepared(WebLogicDeployerListener.java:146)
at oracle.jdevimpl.deploy.fwk.ListenerSupport.firePrepared(ListenerSupport.java:178)
at oracle.jdeveloper.deploy.common.AbstractDeployer.prepare(AbstractDeployer.java:78)
at oracle.jdevimpl.deploy.fwk.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:430)
at oracle.jdeveloper.deploy.DeploymentManager.deploy(DeploymentManager.java:209)
at oracle.jdevimpl.deploy.common.ModulePackagerImpl.deployProfiles(ModulePackagerImpl.java:82)
... 26 more
#### Cannot run application JSFApplication due to error deploying to DefaultServer.
Application JSFApplication stopped and undeployed from Server Instance DefaultServer

--------------------------------------------------------------------------------

please i want some help on what to do to solve this issue :s
thank you in advance ;

Sarvpreet:

How can you create a EAR file from the command prompt?

shay:

Sarvpreet, you can use the ojdeploy bat file to deploy with the JDeveloper deployment profiles.
Look it up in the jdev/bin directory.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)