NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Netbeans bug? Application Client projects can’t use library jars

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
jportway



Joined: 28 Jan 2010
Posts: 6

PostPosted: Thu Jan 28, 2010 1:10 am    Post subject: Netbeans bug? Application Client projects can’t use library jars Reply with quote

Hi, I can’t seem to reference library jars properly from enterprise application client projects on Glassfish v3.

• My Application Client project will deploy and run fine (either running from the IDE, or launching the deployed app from the server) until I add a library jar.

If the application client project is stand alone (ie. not part of an enterprise app ear) then when I run the client it doesn’t see the jar (I get classNotFound exceptions) and in the server log I get “error in annotation processing : java.lang.NoClassDefFoundError” and on the client I get an exception that looks like this :
Code:
Jan 28, 2010 12:57:42 AM com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegates
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
FATAL ERROR in native method: processing of -javaagent failed
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:323)
        at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/compress/archivers/ArchiveInputStream
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:247)
        at org.glassfish.appclient.client.acc.FacadeLaunchable.getMainClass(FacadeLaunchable.java:256)
        at org.glassfish.appclient.client.acc.AppClientContainer.setClient(AppClientContainer.java:316)
        at org.glassfish.appclient.client.acc.AppClientContainerBuilder.createContainer(AppClientContainerBuilder.java:172)
        at org.glassfish.appclient.client.acc.AppClientContainerBuilder.newContainer(AppClientContainerBuilder.java:159)
        at org.glassfish.appclient.client.AppClientFacade.createContainerForAppClientArchiveOrDir(AppClientFacade.java:458)
        at org.glassfish.appclient.client.AppClientFacade.createContainer(AppClientFacade.java:420)
        at org.glassfish.appclient.client.AppClientFacade.prepareACC(AppClientFacade.java:256)
        at org.glassfish.appclient.client.acc.agent.AppClientContainerAgent.premain(AppClientContainerAgent.java:75)
        ... 6 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.compress.archivers.ArchiveInputStream
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)
        ... 16 more


When I look at the deployed client in glassfish the library jars seem to be in a “lib” directory n the META-INF directory of the application, is this right? There doesn’t seem to be any reference to the library jar generated in the manifest file.

If the application is part of an enterprise app then I get more extreme weirdness. I get these exceptions in the server as soon as I try to deploy or run the app :

Code:
WARNING: ACDEPL112: Error attempting to process extensions from the manifest of JAR file /Users/josh/glassfishv3/glassfish/domains/domain1/generated/xml/SkyServer/SkyServer-app-client_jar/lib/commons-compress-1.0.jar; ignoring it and continuing
java.util.zip.ZipException: error in opening zip file
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(ZipFile.java:114)
        at java.util.jar.JarFile.<init>(JarFile.java:133)
        at java.util.jar.JarFile.<init>(JarFile.java:97)
        at org.glassfish.appclient.server.core.jws.ExtensionFileManager.findExtensionTransitiveClosure(ExtensionFileManager.java:264)
        at org.glassfish.appclient.server.core.jws.JavaWebStartInfo.processExtensionReferences(JavaWebStartInfo.java:331)
        at org.glassfish.appclient.server.core.jws.JavaWebStartInfo.startJWSServices(JavaWebStartInfo.java:308)
        at org.glassfish.appclient.server.core.jws.JavaWebStartInfo.access$100(JavaWebStartInfo.java:96)
        at org.glassfish.appclient.server.core.jws.JavaWebStartInfo$1.run(JavaWebStartInfo.java:254)
        at org.glassfish.appclient.server.core.jws.JavaWebStartState.transition(JavaWebStartState.java:84)
        at org.glassfish.appclient.server.core.jws.JavaWebStartInfo.start(JavaWebStartInfo.java:250)
        at org.glassfish.appclient.server.core.AppClientServerApplication.start(AppClientServerApplication.java:134)
        at org.glassfish.appclient.server.core.AppClientServerApplication.start(AppClientServerApplication.java:126)
        at org.glassfish.internal.data.EngineRef.start(EngineRef.java:126)
        at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:241)
        at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:236)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:339)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
        at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224)
        at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
        at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
        at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
        at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
        at java.lang.Thread.run(Thread.java:637)


Note that I get one of these exceptions for every jar referenced by the application client - in the exception above it’s the ejb project jar, but I get the same exceptions for any library jars that I’ve included in the application client.
When I look at the path quoted in the exception the jar file doesn’t seem to exist there. I’m not sure whether that’s what’s causing the exception, or whether the exception is causing the jar file to be deleted.
The library jar files *do* seem to be in the ear /Lib directory. And the ejb jar mentioned above is in the ear file.

• When I run an application client embedded in an enterprise app directly (ie, I click on the application client project and choose run) then I get the same ClassNotFoundExceptions on the client as I saw when using a stand-alon application client project.

• If I set the application client to be the “client module” of the enterprise app project and run it from there then finally I have more luck. The application client actually seems to run properly when run from the IDE, but it won’t deploy and run from the server.

I’ve tried everything I can think of and this looks more and more like a bug in either Netbeans or Glassfish 3. Or maybe I’m misunderstanding something - in which case someone really needs to amend the Application Client tutorial to add something about including library jars in application client - anything but the most trivial app is likely to need libraries, and if this is the expected behaviour then it’s certainly not obvious how to do it.

Anyone have any ideas?
Back to top
jportway



Joined: 28 Jan 2010
Posts: 6

PostPosted: Thu Jan 28, 2010 12:36 pm    Post subject: Reply with quote

Also if I try to debug the project rather than run it I get this error in the server :

Code:
Non-existing path "/Users/josh/Documents/Sky/SkyServer/${javac.classpath}" provided.
Non-existing path "/Users/josh/Documents/Sky/SkyServer/${src.dir}" provided.
Attached JPDA debugger to localhost:59560
org.glassfish.appclient.client.acc.UserError: ACC007: The app client directory /Users/josh/Documents/Sky/SkyServer does not contain a manifest; the app client container cannot process it.


And the app doesn't launch.
Back to top
jportway



Joined: 28 Jan 2010
Posts: 6

PostPosted: Thu Jan 28, 2010 12:39 pm    Post subject: Reply with quote

It's pretty easy to reproduce this :

• I'm using a fresh install of Netbeans and a fresh install of glassfish.
• Just create a new Application client project using the j2ee wizard
• run it - it should work and print hello world to the console
• add a library jar to the project
• run it - it will fail with the zip problems I described above

surely someone else is having this problem, or am I the only person writing a J2EE Application client? Or have I misunderstood something fundamental?
Back to top
rogier.de.groot



Joined: 06 Feb 2010
Posts: 1
Location: Schoonhoven, Netherlands

PostPosted: Sat Feb 06, 2010 3:34 pm    Post subject: Reply with quote

I'm getting this too, it's really annoying and I can't seem to figure out what's wrong exactly. Really frustrating...
Back to top
ayip



Joined: 20 Jan 2010
Posts: 3

PostPosted: Thu Feb 11, 2010 8:43 pm    Post subject: Reply with quote

I am having the same problem too and haven't found the solution. The app-client does run as you said. Did you find a solution?
Back to top
jportway



Joined: 28 Jan 2010
Posts: 6

PostPosted: Sat Feb 13, 2010 12:56 pm    Post subject: Reply with quote

no, I still haven't really found a solution, though I've sort of developed a way of working which somewhat works around the problem.

I can't believe everyone is having these issues, so I'm wondering whether it's a platform issue. I'm running OSX and glassfish 3 - what are you running ?
Back to top
ayip



Joined: 20 Jan 2010
Posts: 3

PostPosted: Wed Feb 17, 2010 2:33 am    Post subject: Reply with quote

We're running XP and Glassfish V3. I've been ignoring the messages for now since the app seems to run ok. I'm guessing there will eventually be some deployment problems but haven't investigated.
Back to top
jportway



Joined: 28 Jan 2010
Posts: 6

PostPosted: Mon Feb 22, 2010 4:13 pm    Post subject: some progress Reply with quote

OK - I’ve got somewhere.
All the "java.util.zip.ZipException: error in opening zip file” exceptions spewed by Glassfish are apparently completely bogus, and seem to be the inevitable side-effect of including library jars in an an ear with an application client. In my opinion this is a really, really stupid bug with Glasshfish, since it sent me off for several days in the wrong direction trying to sort out the problem. They really need to sort that out.

I’m not sure what was causing some of the other issues I was having before, but I’ve got something working by creating a second EAR project specifically for the application client projects, separate from the EAR containing the EJBs etc. The classpath issues I was having were because as far as I can tell you can’t use library jars in an application client unless you package the app client in a EAR. This rather fundamental bit of information doesn’t seem to exist anywhere on the net - and there are no warnings from netbeans if you try to do it (in fact netbeans packages the library jars into the jar file it deploys to the server - glassfish just ignores them).

So - with the app client packaged in an external EAR everything seems to be working properly. There’s an added advantage that editing the application client code doesn’t cause the the entire EAR to be redeployed all the time and testing is much faster and easier.
Back to top
Tim Quinn
Posted via mailing list.





PostPosted: Mon Feb 22, 2010 8:33 pm    Post subject: Re: Netbeans bug? Application Client projects � use library jars Reply with quote

I tried to backtrack to the origin of this thread and could not find its
beginning in the forum archives, but based on the last few messages I
guess you are referring to messages like

Error attempting to process extensions from the manifest of JAR file ...



Sorry this situation has been so frustrating for you.

First, about library JARs in stand-alone app clients (that is, app
clients not in an EAR) - Except for web apps (which are treated
specially for, I think, historical reasons), no stand-alone Java EE
module supports library JARs. I am not sure how easy or hard it would
be for NetBeans to prohibit that, if in fact that's even the right thing
to do. (Perhaps allow it but warn about it??)


Now, about the exceptions themselves - A Google search for GlassFish
and the error message above leads to this

http://blogs.sun.com/quinn/entry/why_the_warnings_about_glassfish

as the first entry (at least for me, at least when I ran it a few
minutes ago) which discusses the error and why it appears and why it's
generally OK (although, admittedly, noisy). You might find that
somewhat helpful...although in your case a bit late.

In any event, glad to hear that you have things working now.

- Tim



On 2/22/10 10:13 AM, jportway wrote:
Quote:
OK - I’ve got somewhere.
All the "java.util.zip.ZipException: error in opening zip file” exceptions spewed by Glassfish are apparently completely bogus, and seem to be the inevitable side-effect of including library jars in an an ear with an application client. In my opinion this is a really, really stupid bug with Glasshfish, since it sent me off for several days in the wrong direction trying to sort out the problem. They really need to sort that out.

I’m not sure what was causing some of the other issues I was having before, but I’ve got something working by creating a second EAR project specifically for the application client projects, separate from the EAR containing the EJBs etc. The classpath issues I was having were because as far as I can tell you can’t use library jars in an application client unless you package the app client in a EAR. This rather fundamental bit of information doesn’t seem to exist anywhere on the net - and there are no warnings from netbeans if you try to do it (in fact netbeans packages the library jars into the jar file it deploys to the server - glassfish just ignores them).

So - with the app client packaged in an external EAR everything seems to be working properly. There’s an added advantage that editing the application client code doesn’t cause the the entire EAR to be redeployed all the time and testing is much faster and easier.




Back to top
jportway



Joined: 28 Jan 2010
Posts: 6

PostPosted: Tue Feb 23, 2010 3:14 pm    Post subject: Reply with quote

Hi Tim,

Thanks very much for your reply. I did actually find the blog post you mentioned in the end - and that’s what rescued me from continuing down the hopeless path that I’d been on. Thanks very much for posting it.

I do think that the “error processing zip file” warnings that glassfish emits are a lot worse than just “noise” - unless you already know that you can ignore them they look very much like something is wrong with your deployment. What else is one to think when several thousand lines of exception stack traces fly past when you deploy, all with red “warning” logs?

If (as in my case) you really do have some kind of classpath problem then these warnings look very much like the culprits. Even when you don’t actually have a problem the sheer volume of log messages generated is a real pain (especially if, like me, you have around 20 jars in your deployment).

In general application client support seems to be the poor relation in the javaee family, with much less robust support than web apps etc. Do you think the situation is likely to improve in the future, or is it the case that very few people actually use the technology and it’s stalled?
Back to top
asgteach



Joined: 30 Mar 2010
Posts: 3

PostPosted: Mon May 17, 2010 5:52 pm    Post subject: Re: Netbeans bug? Application Client projects � use library jars Reply with quote

Tim Quinn wrote:

[ . . . ]
First, about library JARs in stand-alone app clients (that is, app
clients not in an EAR) - Except for web apps (which are treated
specially for, I think, historical reasons), no stand-alone Java EE
module supports library JARs. I am not sure how easy or hard it would
be for NetBeans to prohibit that, if in fact that's even the right thing
to do. (Perhaps allow it but warn about it??)


Perhaps an update to the NetBeans tutorial http://netbeans.org/kb/docs/javaee/entappclient.html (which was written targeting EJB 3.0 and NetBeans 6.5, 6.7, 6.8) is in order. The section entitled "Using a Standalone Application Client to Access an EJB" tells you to right-click the Libraries node (of the Application Client) and select Add Project (which adds the EJB JAR file to this project). I followed the steps in this tutorial and was unable to deploy the standalone app client with the exception:

java.lang.IllegalArgumentException: Sniffers with type [ejb] and type [appclient] should not claim the archive at the same time. Please check the packaging of your archive [/Applications/NetBeans/sges-v3/glassfish/domains/domain1/applications/TempConverterClient

So, from this discussion, then it is true that you cannot access an EJB from a standalone application client?? You must package your application client as part of an Enterprise Application? Thanks for confirming.
Back to top
ken.ganfield



Joined: 18 Aug 2008
Posts: 31

PostPosted: Mon Jun 21, 2010 4:25 pm    Post subject: Reply with quote

There is a draft of an update to the enterprise application tutorial that is targeted at NetBeans IDE 6.9 and GlassFish 3:

http://wiki.netbeans.org/DocsEntAppClientGF3
Currently it is just the basic steps, but it may be helpful. Questions, comments and suggestions are welcome. [/url]
Back to top
Edux



Joined: 24 Aug 2010
Posts: 1

PostPosted: Tue Aug 24, 2010 3:12 pm    Post subject: Reply with quote

Hi,

I've followed the draft steps one by one and I always get the same error:
org.glassfish.appclient.client.acc.UserError: ACC007: The app client directory F:\Edu\Master Java\EJBCliente\EJBCliente-app-client does not contain a manifest; the app client container cannot process it. Embedded programs should pass URIs with scheme "jar:" for JAR files and scheme "file:" for directories.
Java Result: 1

If I try to include an App Client to my EE Project I get: java.lang.IllegalArgumentException: Sniffers with type [ejb] and type [appclient] should not claim the archive at the same time.

I'm stuck. I will appreciate any answer. Thanks in advance.

Note: I'm using Netbeans 6.9 and Glassfish V3.0.1
Back to top
emiddio



Joined: 07 Sep 2009
Posts: 233

PostPosted: Tue Aug 24, 2010 6:04 pm    Post subject: Re: Netbeans bug? Application Client projects can Reply with quote

see http://netbeans.org/bugzilla/show_bug.cgi?id=189732

i got similiar errors;

dont remember details -- but some issues were fixed with nb6.10dev, but then
found some
new issues with gfv3.1b16 vs gfv3.01; also some issues with gfv211 support
also.

gary


----- Original Message -----
From: "Edux" <address-removed>
To: <address-removed>
Sent: Tuesday, August 24, 2010 8:12 AM
Subject: [nbj2ee] Netbeans bug? Application Client projects can
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo