Some theory first:
In order to have Oracle WebLogic Server 11gR1 PatchSet 2 (latest) runtime environment in Eclipse helios,
you need to have server adapter in your IDE for that.
We still think the best way to do this is through “Oracle Enterprise Pack for Eclipse” where this adapter is included.

From this pack you only need this software:
Oracle WebLogic Server Tools 1.5.0.201003261013
Oracle Common Tools 1.5.0.201003261013 (dependency)

You can do that by adding another update URL in Eclipse:
“Oracle Enterprise Pack for Eclipse - http://download.oracle.com/otn_software/oepe/helios”

Oracle web site (http://www.oracle.com/technetwork/developer-tools/eclipse/downloads/oepe-11115-089873.html )
contains this note:
“Note: Be aware that Eclipse 3.6 Helios is not final and this tech preview is based on the M6 milestone release of Eclipse 3.6.”

Now to the point: when you try to add awesome WLS in latest Eclipse you will get nice server error

From Error log:

java.lang.reflect.InvocationTargetException
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:421)
at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:1008)
at org.eclipse.wst.server.ui.internal.wizard.TaskWizard.performFinish(TaskWizard.java:221)
at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:811)
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:430)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at org.eclipse.wst.server.ui.internal.actions.LaunchWizardAction.run(LaunchWizardAction.java:57)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
Caused by: java.lang.NoSuchMethodError: org.eclipse.wst.server.core.internal.UpdateServerJob.<init>(Lorg/eclipse/wst/server/core/IServer;)V
at oracle.eclipse.tools.weblogic.ui.internal.WlsUiPlugin$1.serverAdded(WlsUiPlugin.java:242)
at org.eclipse.wst.server.core.internal.ResourceManager.fireServerEvent(ResourceManager.java:493)
at org.eclipse.wst.server.core.internal.ResourceManager.registerServer(ResourceManager.java:1114)
at org.eclipse.wst.server.core.internal.ResourceManager.addServer(ResourceManager.java:630)
at org.eclipse.wst.server.core.internal.Server.saveToMetadata(Server.java:459)
at org.eclipse.wst.server.core.internal.Base.doSave(Base.java:264)
at org.eclipse.wst.server.core.internal.Server.doSave(Server.java:448)
at org.eclipse.wst.server.core.internal.ServerWorkingCopy.save(ServerWorkingCopy.java:426)
at org.eclipse.wst.server.ui.internal.wizard.WizardTaskUtil.tempSaveServer(WizardTaskUtil.java:149)
at org.eclipse.wst.server.ui.internal.wizard.WizardTaskUtil$4.performFinish(WizardTaskUtil.java:65)
at org.eclipse.wst.server.ui.internal.wizard.TaskWizard.executeTask(TaskWizard.java:256)
at org.eclipse.wst.server.ui.internal.wizard.TaskWizard$2.run(TaskWizard.java:213)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1957)
at org.eclipse.wst.server.ui.internal.wizard.page.WorkspaceRunnableAdapter.run(WorkspaceRunnableAdapter.java:35)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

That is because underlying eclipse implementation had changed.
You see that signature?
UpdateServerJob.<init>(Lorg/eclipse/wst/server/core/IServer;)V

It’s initialize method from UpdateServerJob class that returns void and takes IServer as an argument.

When you decompile latest M7 UpdateServerJob.class there really is no such method. It has only constructor that takes IServer array!

Unfortunately that works for M6 version only. At that time UpdateServerJob constructor looked like this:
public UpdateServerJob(IServer server)
{
super(NLS.bind(Messages.jobUpdateServer, server.getName()), server);
}

Conclusion:
Oracle developers, I think it is really a time to update your OEPE plugin because M7 is out there for 3 months now.
You have to change all calls of that constructor:
From
UpdateServerJob job = new UpdateServerJob(server);
To
UpdateServerJob job = new UpdateServerJob(new IServer[]{server});

many component authors are lazy to read HTML specification,
and lazy to write extra if in the code as well.
One of the examples is title tag absence in code generated by
myfaces components (see older posts).
Proposal for correct list rendering:
<c:if test="${!empty files}">
<ol>
<c:forEach var="file" items="${files}">
<li><c:out value="${file.name}"/></li>
</c:forEach>
</ol>
</c:if>

The point is that OL without child LI is nonsence from HTML point of view.
Later we will talk about what element
to generate instead for empty list
and if null and empty is the same (EL does not care of course).

Do you think ther is a reason or just ignorance ?
Fist original WST code is buggy, outputed "XHTML" will have whitespaces before ?xml and whitespaces before doctype. (Authors, please read at least JSP.1.3.8 White Space) if not XML and HTML specs ;-))

Monday, July 26, 2010

I have commented on encoding issues in JDeveloper and today I have reached the same point in the Eclipse-OEPE environment.

First the good news is that OEPE let's you choose form many templates combining language (html,xhtml) of source markup, doctypes and final output doctype in
File/New/JSP Page/(Use JSP Template) and configure the templates the easy way
Window/Preferences/Web/JSP Files/Templates.

I had to stop after while...
... since this could be book of "JavaScript antisamples".
I have no idea about the libs origin,
they mention IE 4 versions, however Trinidad claim support to 6+,
I belive a lot of code is "ported" from some other languages with
little JS knowledge or care,
or comes from aged libs written in the dark and deep web history.
I have to quote Mr.D: http://javascript.crockford.com/style1.html

There are no good texts on JavaScript programming.
Most of the people on the web who are producing JavaScript programs
learned it by copying really bad examples from bad books,
bad websites,
and bad tools.
We have an amazingly good community of JavaScript programmers here,
but still we can benefit from better practice of style.

This is because one is produced by jsp:output
and another by thr:html + org.apache.myfaces.trinidad.core renderkit
(which is default for JDeveloper 11.1.1.3.0 and "ADF Mobile")
It seems just like coincidence that both are the same (read more...)

Wednesday, July 21, 2010

After fresh instalation JDeveloper will produce new JSPX pages that may look like this.
<?xml version='1.0' encoding='windows-1252'?>
.....
<jsp:directive.page contentType="text/html;charset=windows-1252"/>

This 1252 seems to me like "unwanted legacy".

Tools/Preferences/Environment/encoding:

Encoding
Use to select an encoding value. The default is CP1252.
Once you have selected a value, all new files will be created with the new encoding, and the new encoding will be used to open and save files without encoding tags.
Note that XML files and JSP 2.0 documents (XML compliant files)
must include an appropriate XML encoding declaration on a per-file basis.
For details refer to the W3C XML specification.
You can expand the encodings
in this list by appending new
encoding definitions to the encodings.xml file, found in the jdev/bin directory. This XML file contains a list of mappings from Sun JDK to IANA encoding names.
Note that files already open in JDeveloper will not be opened with the new encoding. To change the encoding used to read open files, close the files and reopen them after changing the encoding value here. Also note that files with encoding tags will always be opened and saved using the specified tags, and not JDeveloper's encoding.

This is tricky, half true, or buggy ...
I have tried to make a new page in an existing project and again the 1252.
Then I have tried new page in different project and UTF-8.

Beware:
There are two more "Character Encoding" (at least) in Project Preferences.
XML.encoding and JSP.charset in JSF pages seems to be controlled by
Project Preferences/Compiler/JSP.

WorstCase:
So If you have already created projects change those, and
manualy fix text in files and if you have non ascii markup in the text, resave all files as UTF-8 as well ;-))

I will start posting unsorted opinions about ADF in the next days
just to collect findings, subjective unproved hypothesis and mental shocks I'm ready to experience during my "late adoption".....

From JSF Specification:

Solving Practical Problems of the Web
JSF’s core architecture is designed to be independent of specific protocols and markup.
However it is also aimed directly at solving many of the common problems encountered
when writing applications for HTML clients that communicate via HTTP to a Java
application server that supports servlets and JavaServer Pages (JSP) based applications.

Or from ADF dev guide:

JavaServer Faces for Quick Learners
JSF 1.2 was chosen as the view layer of choice in Fusion web application development of Oracle
JDeveloper 11g. JSF is a Java EE standard since 2004 and in its current version 1.2 is part of the
Java EE 5 platform. JSF is designed to simplify web application development and changes the
programming model for building web pages from HTML markup development to the assembly
of reusable UI components that are declaratively linked to their data model and server-side event
handlers.

This construct will work
in all browsers
in all types of windows (iFrame, window.open, modal, modeless dialogs)
but and WILL NOT WORK in MSIE modelessDialog and window.open.
and the call will end up with "Invalid procedure call or argument".

However in those working in explorer (iframe and tweaked modal dialog)
let's try to compare window references:

// remote window is opener or parent or self
// depending on the type of "popup" method used

All browsers (Safari, FF, Opera, Chrome) pass this test for
all supported types of cross-referenced windows (iFrame, window.open,showModalDialog)
but

MSIE (6,7,8) fails to compare window references with ===

summary:
// does not work
remoteCtx===remoteWnd
// seems to work but what is actually compared ? (TODO: see specs.)
remoteCtx==remoteWnd
// works but means something different right ?
remoteCtx.document===remoteWnd.document

Of course there is more XB magic in cross-window communication
(MSIE and Safari identified as trouble makers)
and I may return with more notes....