查找动态JNDI名称

时间:2017-02-13 15:29:29

标签: java tomcat7 jndi web.xml

我的应用程序代码接收JNDI名称以在运行时查找。因此,可能不会在# this demo generates some random data for M consumers based on N samples and # constructs a standard ellipse for each based on SEAc and SEA_B rm(list = ls()) library(siar) ------------------------------------------------------------------------- # ANDREW - REMOVE THESE LINES WHICH SHOULD BE REDUNDANT # change this line setwd("C:/Users/elisabeth/Desktop/R/demo") # ----------------------------------------------------------------------------- # now close all currently open windows graphics.off() # read in some data # NB the column names have to be exactly, "group", "x", "y" mydata <- read.table("example_ellipse_data.txt",sep="\t",header=T) # make the column names availble for direct calling attach(mydata) # now loop through the data and calculate the ellipses ngroups <- length(unique(group)) # split the isotope data based on group spx <- split(x,group) spy <- split(y,group) # create some empty vectors for recording our metrics SEA <- numeric(ngroups) SEAc <- numeric(ngroups) TA <- numeric(ngroups) dev.new() plot(x,y,col=group,type="p") legend("topright",legend=as.character(paste("Group ",unique(group))), pch=19,col=1:length(unique(group))) for (j in unique(group)){ # Fit a standard ellipse to the data SE <- standard.ellipse(spx[[j]],spy[[j]],steps=1) # Extract the estimated SEA and SEAc from this object SEA[j] <- SE$SEA SEAc[j] <- SE$SEAc # plot the standard ellipse with d.f. = 2 (i.e. SEAc) # These are plotted here as thick solid lines lines(SE$xSEAc,SE$ySEAc,col=j,lty=1,lwd=3) # Also, for comparison we can fit and plot the convex hull # the convex hull is plotted as dotted thin lines # # Calculate the convex hull for the jth group's isotope values # held in the objects created using split() called spx and spy CH <- convexhull(spx[[j]],spy[[j]]) # Extract the area of the convex hull from this object TA[j] <- CH$TA # Plot the convex hull lines(CH$xcoords,CH$ycoords,lwd=1,lty=3) } # print the area metrics to screen for comparison # NB if you are working with real data rather than simulated then you wont be # able to calculate the population SEA (pop.SEA) # If you do this enough times or for enough groups you will easily see the # bias in SEA as an estimate of pop.SEA as compared to SEAc which is unbiased. # Both measures are equally variable. print(cbind(SEA,SEAc,TA)) # So far we have fitted the standard ellipses based on frequentist methods # and calculated the relevant metrics (SEA and SEAc). Now we turn our attention # to producing a Bayesian estimate of the standard ellipse and its area SEA_B reps <- 10^4 # the number of posterior draws to make # Generate the Bayesian estimates for the SEA for each group using the # utility function siber.ellipses SEA.B <- siber.ellipses(x,y,group,R=reps) web.xml注释中预先配置JNDI名称。如何在这种情况下查找对象?应用程序正在Tomcat 7上运行。

1 个答案:

答案 0 :(得分:0)

您无法使用资源注入,但必须使用程序化查找

new InitialContext().lookup(dynamicName)