NetBeans Forums

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

Jars from common/lib not picked up in Netbeans when using JBoss...

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



Joined: 04 Jul 2009
Posts: 3

PostPosted: Sat Jul 04, 2009 8:43 pm    Post subject: Jars from common/lib not picked up in Netbeans when using JBoss... Reply with quote

I'm having a go at getting JBoss (5.1.0.GA) working with NetBeans 6.5 and seem to have fallen at the first hurdle. When trying to compile a basic hello world servlet, NB reports several errors as it cannot find the javax.servlet package. I found that JBoss keeps this package in servlet-api.jar, which is found in <JBoss_Home>/common/lib.

It appears that this directory is not included in the server libraries by NB, even though JBoss uses this as the "parent" lib that is included in all server instance libs.

I tried adding the servlet-api.jar as a compile time library in NB, however this causes either -
a)A blank page when the war is deployed OR
b)A 500 error with the following message
Quote:
javax.servlet.ServletException: java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/jasper/servlet/JasperLoader) previously initiated loading for a different type with name "javax/servlet/http/HttpServletRequest"
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96


I assume the latter linker error to mean that there is an identical class loaded somewhere in one of the other libraries (is this correct?).

Has anyone got any ideas on this one? I have loaded the same servlet in both GlassFish and Weblogic without any problems, but just can't get JBoss to play ball. Thanks in advance for any help on this!

Apologies if this has been answered elsewhere, but several googles have not produced any results for me yet...


[/quote][/list]
Back to top
chagharu



Joined: 04 Jul 2009
Posts: 3

PostPosted: Tue Jul 07, 2009 12:28 pm    Post subject: Reply with quote

If anyone is having the same problem here, there is a workaround to this - I guess the permanent fix will be in a future version of NB. But thought I'd try posting in case there was another way...

Workaround is to compile your project in Glassfish by right clicking the project in the projects tab, clicking on the "run" category in the left hand pane and select GlassFish V3 from the server drop down menu on the right (This assumes that the GF server is installed with NB). Click Ok, then do a clean and build of the project.

When the project has built, go back to the menu above, select the JBoss server and click OK. The project will show errors but if you run or deploy the project without trying to build, then JBoss will be able to use its common/lib libraries to deploy the appropriate J2EE class files.

Hope this helps.
Back to top
chagharu



Joined: 04 Jul 2009
Posts: 3

PostPosted: Thu Jul 09, 2009 8:42 am    Post subject: Reply with quote

Quicker workaround (can't believe I missed this before!)...

Add the required jars as a compile time library in NB but ensure that the package tick box is unchecked when the library/jar is added. This ensures the jar is only used for compilation and is not deployed with the project.

Stupid that I missed this before - that was why I was getting the linkage error. The project was deployed with the jar and JBoss didn't know whether to use the one in the common/lib or the one deployed with it... Rolling Eyes

Still would be nice for NB to recognise JBoss's common/lib directory somehow though...
Back to top
lloy0076



Joined: 30 Sep 2009
Posts: 1

PostPosted: Wed Sep 30, 2009 1:16 am    Post subject: Reply with quote

Yes, it would be nice if this had somehow been "fixed" or more well documented; making a we application only to find the Servlet APIs mysteriously missing was rather disconcerting.

DSL
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans 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