David Karr

Greenhorn
+ Follow
since Jan 06, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by David Karr

I have an existing groovy script with 3 @Grab annotations before the first import, to get dependencies.

I've recently been reading "Making Java Groovy" (on Safari). In chapter 5, I saw the following statement:

"Because a member of a class can only have a single instance of a particular annotation, the @Grapes annotation is used to combine multiple @Grab annotations."

In the context of my script, which works just fine with multiple separate @Grab annotations, this is obviously false, but I imagine this statement likely used to be true. Does anyone know if that's the case?
10 years ago
(This is reposted from the engineering-security forum, but I realized later that forum isn't as active as this one.)

I'm building an app using Apache CXF (JAX-RS), running in WebLogic 10.3.2.

I have a nice set of resource methods that work fine. I now need to implement some sort of authentication/authorization, but it will have to be managed by the application, not the container. I implemented a request handler in CXF that should allow me to look at the principal and credentials that were sent in the Authorization header. However, when I configured my test client to send a manually-constructed Authorization header (which I obtained from a tutorial on basic auth), my request got a 401 back without even getting into my application code on the server.

That tells me that I probably have to implement some of the "security"-related elements in my application's web.xml, although I just need to tell it to let everyone in, but give me the principal/credentials that were sent. I started to construct the "security-constraint" and "login-config" elements, but I'm not sure what minimal settings I need to get me past this obstacle.

I've started with the following, but I'm not sure what I need:

<security-constraint>
<web-resource-collection>
<web-resource-name>myapp</web-resource-name>
<url-pattern>/rest</url-pattern>
</web-resource-collection>
<auth-constraint>
</auth-constraint>
</security-constraint>

<login-config>
<auth-method>BASIC</auth-method>
</login-config>

I've tried several variations of this, but I still get an immediate 401 when I send the Authorization header.
14 years ago
I'm building an app using Apache CXF (JAX-RS), running in WebLogic 10.3.2.

I have a nice set of resource methods that work fine. I now need to implement some sort of authentication/authorization, but it will have to be managed by the application, not the container. I implemented a request handler in CXF that should allow me to look at the principal and credentials that were sent in the Authorization header. However, when I configured my test client to send a manually-constructed Authorization header (which I obtained from a tutorial on basic auth), my request got a 401 back without even getting into my application code on the server.

That tells me that I probably have to implement some of the "security"-related elements in my application's web.xml, although I just need to tell it to let everyone in, but give me the principal/credentials that were sent. I started the construct the "security-constraint" and "login-config" elements, but I'm not sure what minimal settings I need to get me past this obstacle.

I've started with the following, but I'm not sure what I need:

<security-constraint>
<web-resource-collection>
<web-resource-name>myapp</web-resource-name>
<url-pattern>/rest</url-pattern>
</web-resource-collection>
<auth-constraint>
</auth-constraint>
</security-constraint>

<login-config>
<auth-method>BASIC</auth-method>
</login-config>
14 years ago
I'm having trouble getting a mapping to work with Hibernate JPA, using Spring. I'll list several code excerpts, and the end of the note has the error message I'm getting.

I have two tables, "student" and "absence". the "absence" table has a composite primary key consisting of all of its columns, and one of those columns is also a foreign key to "student". They are defined somewhat like this in MySQL:



I'm attempting to map these with minimal annotations, specifying the mapping mostly in the orm.xml file.

The two classes, as I've defined them so far, are:



and then my orm.xml file (excerpt) is this, so far:

When I run a simple test, it fails to completely initialize, failing with this:

mappedBy reference an unknown target entity property: jpatest.domain.Absence.student in jpatest.domain.Student.absences

I also see the following warning appear before this failure:

Property jpatest.domain.Absence.student not found in class but described in &lt;mapping-file/&gt;

I'm not sure what I'm doing wrong here, but I'm sure it has something to do with the embedded id.

Besides pointing out what's "wrong", I'd appreciate any ideas of simpler ways to do this, although I'd prefer to continue using the XML descriptor more than annotations.
I found the problem in my domain, and it was because of the multiple jndi-name entries (the second one being blank). I sincerely doubt this has anything to do with newlines in the jndi name field. I've seen this happen in two different datasources that were working perfectly fine before. However, other fields were changed in the datasources since they had been working before. I expect there is a bug in the code that saves the datasource config that results in creation of additional jndi-name elements in the resulting XML descriptor.
15 years ago
Did you ever resolve this? We're seeing the exact same symptom, in WL 9.2.2. A server that was working perfectly fine is now reporting this exception for both an Oracle and a DB2 datasource at startup (one other Oracle and two other Teradata DSes are perfectly fine). There's nothing unusual about the JNDI names we've defined for these two DSes. They obviously don't conflict with any other datasource. I'm going to file a support case, but I'm not hopeful they'll figure anything out quickly (if at all).
15 years ago
I would suggest two things:

While developing an app, always implement a debugging LifeCycleListener that just prints out each phase. If you see it go directly from the validation phase to the response phase, then you know it failed validation somewhere. You should also have a "messages" element on your page, and probably on all of your fields, so you can see if something failed validation.
16 years ago
JSF
The amazing thing you realize when you integrate the RichFaces (also Ajax4JSF) framework is that in many cases you can get a dynamically-updating application without page refreshes, without even writing any Ajax-related Javascript code. The combination of the event model of JSF with RichFaces is more than the sum of its parts.
16 years ago
JSF
I had a couple simple "toy" apps using the JSF 1.1 implementation from BEA (derived from Sun), also using RichFaces 3.1.3. I decided to try using the MyFaces implementation (just the api and impl jars) in place of the BEA implementation. The JSP page is basically working, but for some reason it's not creating my managed bean and putting it into its defined scope. I also defined a debugging lifecycle listener, and that appears to be working fine, but the managed bean seems to be ignored. I know this because I set a breakpoint in the bean constructor of the managed bean class, and it never hits it. I tried to reference a property from it in the JSP and that causes it to fail, saying "PropertyNotFoundException: Base is null". This happens when the variable referenced in the expression doesn't exist in the scope.
16 years ago
JSF
When I'm iterating through building a new page, I often get "duplicate Id for a component" while constructing pieces of the page. When I get this, I have to guess where I'm having an "id" problem. I've never actually specifically set two fields with the same "id" value, this error only really happens when the framework generates two fields that result in the same "id" value. The problem is, how the heck do you figure out what you did wrong that produces that error? I usually have to hunt around on the whole page to figure this out.

For instance, here is a page that I'm working on:

<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<html>
<head>
<title>TabPanel Experiment</title>
</head>
<body>
<f:view>
<a4j:form>
<rich:tabPanel id="tabpanel" switchType="client">
<rich:tab name="obligor" label="Obligor">
<h:panelGrid columns="2" id="obligorFields">
<h:column>Field1:</h:column>
<h:column><h:inputText id="field1"/></h:column>
</h:panelGrid>
</rich:tab>
<rich:tab name="property" label="Property">
<h:panelGrid columns="2" id="propertyFields">
<h:column>Field2:</h:column>
<h:column><h:inputText id="field2"/></h:column>
</h:panelGrid>
</rich:tab>
<rich:tab name="ratings" label="Ratings">
<h:panelGrid columns="2" id="ratingsFields">
<h:column>Field3:</h:column>
<h:column><h:inputText id="field3"/></h:column>
</h:panelGrid>
</rich:tab>
</rich:tabPanel>
</a4j:form>
</f:view>
</body>
</html>


This produces "duplicate Id for a component _id0:_id1". In general, how do I figure out how to fix these errors?
16 years ago
JSF
Considering that I've received exactly zero replies on any related forum on this subject, except for this one, I think this may be my only alternative. It's certainly not ideal, as my hierarchy would only be two levels. I guess I'll experiment with this. I filed a JIRA ER asking for a feature like this.
16 years ago
JSF
I'm currently experimenting with JSF 1.1 and RichFaces 3.1.3, on WebLogic 9.2.2.

(I asked about this on the RichFaces forum, but I haven't gotten a single response.)

For background, I'm trying to model a list of "Project" objects, where each project has a name and department, and also a list of Server objects for each project. The number of servers per project is variable, but it's reasonable to assume it's at least one.

As this is modeled in a spreadsheet, if the project has several servers, the cell with the project name is a "tall" cell, and the rows with the server names are associated with that cell. I know I'm not describing it very well, but that's approximately what I'm trying to represent.

Eventually, I'll need full editing capabilities, including the ability to add/delete/edit projects and servers, but that is probably more straightforward than this table layout problem.

I can only find one example of "rich:subTable", and I can't figure out how to get that to work in my situation.

Can anyone give me any suggestions on how to model this?
16 years ago
JSF