NetBeans strangeness

T

Tim Slattery

I'm trying to switch to using the NetBeans IDE. Very nice, but...

I create a project and select the Struts framework out of the four
available. It creates the project. Then I look at the project
properties, and it has both Struts and JavaServer Faces activated! I
could add more frameworks if I wanted, but there seems to be no way to
get rid of one.

So what? When I build the project and deploy the resulting WAR to
WebLogic, it throws this:

Failed to initialize the application 'NCS' due to error
java.lang.ClassNotFoundException: javax.faces.webapp.UIComponentTag.

Nothing in my app mentions that class or anything in javax.faces.*.

The weird thing is that when I examine the WAR file, there's nothing
there except what I want. There's nothing referencing JSF at all. So
why is WL looking for that class?
 
D

Donkey Hottie

I'm trying to switch to using the NetBeans IDE. Very nice, but...

I create a project and select the Struts framework out of the four
available. It creates the project. Then I look at the project
properties, and it has both Struts and JavaServer Faces activated! I
could add more frameworks if I wanted, but there seems to be no way to
get rid of one.

So what? When I build the project and deploy the resulting WAR to
WebLogic, it throws this:

Failed to initialize the application 'NCS' due to error
java.lang.ClassNotFoundException: javax.faces.webapp.UIComponentTag.

Nothing in my app mentions that class or anything in javax.faces.*.

The weird thing is that when I examine the WAR file, there's nothing
there except what I want. There's nothing referencing JSF at all. So
why is WL looking for that class?

No JSF specific XML configuration files at all? Must be something...
 
L

Lew

Donkey said:
No JSF specific XML configuration files at all? Must be something...

Also, look in the web.xml to make sure it isn't including

<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

But you're right, NB seems addicted to including JSF in Web apps, but
I sure don't know why. It's less of a problem for me because I'm
using JSF.

The answer I suspect to be buried in the nbprojects/ metadata
somewhere.
 
T

Tim Slattery

Lew said:
Also, look in the web.xml to make sure it isn't including

<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

Been there, done that.
But you're right, NB seems addicted to including JSF in Web apps, but
I sure don't know why. It's less of a problem for me because I'm
using JSF.

Big PITA. It's there immediately after I create the project, before
I've done ANYTHING to it.
The answer I suspect to be buried in the nbprojects/ metadata
somewhere.

I've looked there. I find references to Struts in build-impl.xml, but
I don't see anything about JSF. It's a long file, I've run (case
insensitive) text searches on "face", "javax", "jsf".

Hmm..the first line in project.properties is:

auxiliary.org-netbeans-modules-projectapi.jsf_2e_present=true

Seems unlikely, but you never know.
 
T

Tim Slattery

Tim Slattery said:
I'm trying to switch to using the NetBeans IDE. Very nice, but...

I create a project and select the Struts framework out of the four
available. It creates the project. Then I look at the project
properties, and it has both Struts and JavaServer Faces activated! I
could add more frameworks if I wanted, but there seems to be no way to
get rid of one.

So what? When I build the project and deploy the resulting WAR to
WebLogic, it throws this:

Failed to initialize the application 'NCS' due to error
java.lang.ClassNotFoundException: javax.faces.webapp.UIComponentTag.

It seems that when I ask NetBeans for Struts support, it throws in a
whole list of Struts JAR files. One of those is
struts-faces-1.3.8.jar, that must be where the reference to
UIComponentTag is. I guess that the NetBeans IDE finds that reference
and shows Faces support in the project options dialog.

So I have NB show the list of JARs. I right-click struts-faces, and
select "Remove" and the entire list of Struts libraries disappears. I
guess there must be a way to control that somewhere. If nothing else,
I can just remove that library from the WAR before I deploy it.
 
L

Lew

Tim said:
So I have NB show the list of JARs. I right-click struts-faces, and
select "Remove" and the entire list of Struts libraries disappears. I
guess there must be a way to control that somewhere. If nothing else,
I can just remove that library from the WAR before I deploy it.

NetBeans libraries are unitary. You get all the JARs in a library or
none. You can set up your own libraries for finer-grained control.

For example, MyFaces requires a number of Apache Commons libraries. I
have a library that contains the MyFaces JARs plus all the Commons
JARs, but that has risks. I may want a newer version of a Commons JAR
and I might have another library that also includes Commons JARs,
causing double inclusion. I also might put some of these JARs into,
say, my common Tomcat lib/ directory, also causing redundant
inclusion. To solve this, I have a custom library with just the
MyFaces JARs and others for each of the Commons JARs, and I use (or
don't use) those in lieu of the all-in-one library.
 
R

Roedy Green

Failed to initialize the application 'NCS' due to error
java.lang.ClassNotFoundException: javax.faces.webapp.UIComponentTag.

Do a grep on all your source code and configuration files for "Faces".
 
T

Tim Slattery

Lew said:
NetBeans libraries are unitary. You get all the JARs in a library or
none. You can set up your own libraries for finer-grained control.

It turns out you can tweak that. Project properties/Libraries. Select
(in this case) Struts 1.3.8, click the "Edit" button. It shows a list
of jar files in a list box. Click the ones you don't want in your
project and click "Remove". Poof, they're gone.
 
L

Lew

Tim said:
It turns out you can tweak that. Project properties/Libraries. Select
(in this case) Struts 1.3.8, click the "Edit" button. It shows a list
of jar files in a list box. Click the ones you don't want in your
project and click "Remove". Poof, they're gone.

Sure, and ruin its use for other projects where you want the full
boat.
 
T

Tim Slattery

Lew said:
Sure, and ruin its use for other projects where you want the full
boat.

Hmm...looks like you're right. In my case it doesn't matter, we won't
be needing that library. Seems like there should be a way to tailor
that for a particular project but...

I know that it's *not* expanding "libraries" under your project,
selecting the offending library, right-click and "remove". When you do
that the entire package disappears!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top