David Sheltby

Ranch Hand
+ Follow
since Oct 19, 2011
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
5
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by David Sheltby

I'm writing an enterprise application to familiarize myself with Glassfish 3.1.2 and EJB 3.1. I've created several local, stateless beans, and injected one into a JSF managed bean using the @EJB annotation. The ejb and web module compile fine, but when I launch the application with Glassfish I get the following startup error and the application does not deploy. I don't understand what it means, can someone ellaborate? thanks!



SEVERE: Exception while invoking class org.glassfish.ejb.startup.EjbDeployer prepare method
SEVERE: Exception while invoking class org.glassfish.javaee.full.deployment.EarDeployer prepare method
SEVERE: Exception while preparing the app
SEVERE: Unable to load the EJB module. DeploymentContext does not contain any EJB. Check the archive to ensure correct packaging for D:\Documents\NetBeansProjects\Test\dist\gfdeploy\Test\Test-war_war.
If you use EJB component annotations to define the EJB, and an ejb or web deployment descriptor is also used, please make sure that the deployment descriptor references a Java EE 5 or higher version schema, and that the metadata-complete attribute is not set to true, so the component annotations can be processed as expected
org.glassfish.deployment.common.DeploymentException: Unable to load the EJB module. DeploymentContext does not contain any EJB. Check the archive to ensure correct packaging for D:\Documents\NetBeansProjects\Test\dist\gfdeploy\Test\Test-war_war.
If you use EJB component annotations to define the EJB, and an ejb or web deployment descriptor is also used, please make sure that the deployment descriptor references a Java EE 5 or higher version schema, and that the metadata-complete attribute is not set to true, so the component annotations can be processed as expected
at org.glassfish.javaee.full.deployment.EarDeployer.prepare(EarDeployer.java:166)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:871)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:410)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:461)
at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:212)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:722)

That works, except its not pretty. I also go it to work by changing them to:
Not really sure why that works though.

Thanks
11 years ago
JSF
Hi

I have the following directory structure:

webapp/
|--resources/css/theme.css
|--resources/css/images/images.png
|--template.xhtml
|--index.xhtml

The template has the following <h:outputStylesheet library="css" name="theme.css" /> in the <h:head> tag, however none of the images defined in theme.css are loading. All the URL paths are relative (e.g. they start with "images/"). The only way I can get them to load is to make them absolute URL's. What should they be?

thanks
11 years ago
JSF

Tim Holloway wrote:I don't know that a bigger heap necessarily means a slower garbage collector. YMMV, but last I saw, GCs were being more targeted towards incremental cleanup than the old "freeze-while-I-free-memory" approach.

Too much memory is, quite simply, more memory than you need. If you allocate excess memory and it doesn't get used, you're stealing it from the rest of the system and leaving it idle, which not only reduces what other processes can do, it's a flat waste of the electricity needed to run the memory chips. And/or paging space, depending on your VM configuration.

If you allocate memory and it gets used, but the system will run nearly as efficiently without the extra memory, then you should consider tuning memory settings so that you get the most efficient performance benefits for your JVM while minimizing the impact on the rest of the system.


Yes, I think some resource monitoring is in order.

thanks
11 years ago

Jelle Klap wrote:I don't think you'll be wanting to utilize 8 GBs of heap space in your application. Unless you don't mind waiting on the garbage collector.


Max recommendation?
11 years ago
Its a Window Server 2008 environment, so somehow I think a few resource fights will be inevitable. There will not be many other third party services installed on this server though. 8GB to the OS and its buddies seems like a decent amount.
11 years ago
I have Tomcat 6 installed on a dedicated server with 16GB of memory. Tomcat is running an application that could potentially have a couple thousand concurrent users. I was considering allocating up to half of the servers memory to the heap. Is there such a thing as too big of a max heap size. 8GB seems like a lot, but I have no metrics to gauge this. Are there any dangers or performance hits that could result in having too much memory allocated?

thanks
11 years ago
Is there a solution for creating property variables that are container-scoped (available to all web-applications). I'm sure there is but I can't seem to find any docs for this. Can these properties be db driven in any way?

Thanks
11 years ago
I'm not sure SSO would be a solution. The other system requires a completely different login solution unrelated to the one I'm working on (and vice versa). I'm just creating a kind of internal back-door for these users, passing some user credentials from one system and to another - the major roadblock is adding the UserPrincipal and then redirecting to appropriate page after this transparent authentication takes place. Not sure how to do it without altering whats in place already.


12 years ago
So I've implemented all of the above and I have another requirement to complete which I need some input on. Is it possible to create my own UserPrincipal and add it to the "server" (not sure exactly where the UserPrincipal officially resides) to grant access to a specific type of user without them having to manually login - essentially logging in transparently from another system?

I was first thinking of creating an auto submit form which submitted to j_security_check to authenticate, but the way Tomcat works is for the user to first request a protected resource, and only then does the server complete authentication and redirects after if successful. Not sure how to get around this.

thanks!!
12 years ago
Hi again,

A follow-up to this. I've subclassed the DataSourceRealm and overridden the authenticate method to suit our needs... works perfectly. However I also need to set a couple of session variables upon login and if possible I'd like to do this in the authenticate method. Is this possible? I can't find any way to access the session. At what point does the principal get cached/placed in the request?

If, as you state in your previous post I have to do something like detect a transition to a logged-in state, can you clarify this? What do mean by this?

thanks!
12 years ago
I think creating my own subclassed Realm sounds like a good approach. I'll give it a try.

Thanks!
12 years ago
Hi,

For the moment, I just need to look up a value in the database for the account that was just authenticated - an account activation status. I don't want to go down the road of checking this status for each request after being authenticated, so I wanted to tack it on to post-authentication process.

thanks for the help.
12 years ago
Hi, I need to execute some code either before or after authentication. I've read several posts online from people trying to get a filter working for j_security_check url's, but I haven't seen anyone achieve it with Tomcat; results seems to be container specific. The posts are all a few years old, so first I wanted to see if anything has changed in a few years and if it is in fact possible to capture a request for j_security_check with Tomcat 6?

If not (and that stills seems to be the case), then the alternative that I tried is this: POST the login form to a filter (or servlet) which will do any pre-authentication work, forward to j_security_check, then execute any post-authentication code. I can get this to work only if I use Response.sendRedirect("j_security_check?j_username="+username+"&j_password="+password")... forwarding to j_security_check does not trigger authentication. I'm not to keen on this approach since it exposes the username and password in the query string. Is there another approach?

thanks
12 years ago
Hi,

I'm using Tomcat's out-of-the-box authentication and as such I define a login-config and form-login-page in my web.xml. Is there a way to configure which page a user is redirected to when a session expires? By default, its the form-login-page, however I would like to inform the user that the session has expired.

thanks
12 years ago