This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 194121 - deploying java web application having huge class file
Summary: deploying java web application having huge class file
Status: RESOLVED WORKSFORME
Alias: None
Product: serverplugins
Classification: Unclassified
Component: GlassFish (show other bugs)
Version: 7.0
Hardware: PC Other
: P3 normal (vote)
Assignee: Vince Kraemer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-07 12:07 UTC by pradyutb
Modified: 2011-01-19 16:45 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pradyutb 2011-01-07 12:07:53 UTC
I have a JSP/Servlet web application deployed in Glassfish which is having a number of Servlets and huge class files. When I make even minor changes in the Servlet or class file, then the whole web application gets re-deployed which takes considerable amount of time. Not only that, all the JSPs and Servlets are unloaded from memory and upon being called it takes around 1 second for getting initialized.

This problem does not occur when I change code of JSP, JS or CSS files as only that particular file is re-deployed.

Can I do anything so that the Servlets or those huge class files deployed separately and thus not the whole web application?

should i go for opening a glassfish issue/enhancement as jsp/servlets are here for less than a decade now... still a simple feature missing...
Comment 1 Vince Kraemer 2011-01-07 16:29:34 UTC
Please add more details about the project and environment...

How big is the war file?  What is the size of the smallest, median and largest class files?

How much time are we talking about?

What are the specs of your machine? processor speed? memory?

What OS are you using?

You may be able to restructure your app to lower the size of the overall package being redeployed.  Without more details about the structure of the app, I am not sure that anybody can give you useful advice, though...

Are you triggering the redeploy manually or is NB triggering it automatically via the deploy-on-save feature?

Are you using JPA? Please attach your persistence.xml file if you are...
Comment 2 Vince Kraemer 2011-01-07 16:30:37 UTC
i will take a first swing at this...
Comment 3 pradyutb 2011-01-07 19:42:53 UTC
This is what netbeans shows at deploying
--------------------------------------------------------------------------------------------------------------------------------------
SEVERE: 0  WebApplicationSecurityPU  INFO   [http-thread-pool-4848-(1)] openjpa.Enhance - You have enabled runtime enhancement, but have not specified the set of persistent classes.  OpenJPA must look for metadata for every loaded class, which might increase class load times significantly.

INFO: Portable JNDI names for EJB NewSessionBean : [java:global/WebApplicationSecurity/NewSessionBean, java:global/WebApplicationSecurity/NewSessionBean!enew.NewSessionBean]
INFO: Portable JNDI names for EJB AnotherBean : [java:global/WebApplicationSecurity/AnotherBean, java:global/WebApplicationSecurity/AnotherBean!enew.AnotherBean]
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
INFO: Loading application WebApplicationSecurity at /WebApplicationSecurity
INFO: Loading application WebApplicationSecurity at /WebApplicationSecurity
INFO: Loading application WebApplicationSecurity at /WebApplicationSecurity
INFO: Loading application WebApplicationSecurity at /WebApplicationSecurity
INFO: WebApplicationSecurity was successfully deployed in 3,328 milliseconds.
--------------------------------------------------------------------------------------------------------------------------------------

OS is windows xp 64
netbeans version is 6.8
glassfish version is 3

well as mentioned nb deploys automatically on save of any class files(servlets or normal class files *not jsps,js,css*)

processor is amd triple core at 2.1 with 4gb memory

one of the class file has the length 2700 lines
another one with length 700 lines
others have 300 lines length
there are about 30 class files(including servlets)
other than that around 100 jsp files although some very small
and 20 js and 20 css files
main 4-5 jsp pages are around 400 lines
the war file is 16mb

(although out of context but during build this error came up 
http://blogs.sun.com/NetBeansSupport/entry/unable_to_delete_file_appbase 
but could build the app as the fix was given in the blog

i m using jpa and i will be quitting using that because jpa is a space science.. may be atleast for me... take a look at this..
http://stackoverflow.com/questions/2262824/update-using-jpa
and i see loads of jpa issue on every other forum...sorry out of context...

the persistence.xml file..
----------------------------------------------------------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
  <persistence-unit name="WebApplicationSecurityPU" transaction-type="RESOURCE_LOCAL">
    <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
    <non-jta-data-source>jdbc_void</non-jta-data-source>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>
    <properties>
    </properties>
  </persistence-unit>
</persistence>
----------------------------------------------------------------------------------------------------------------------------

Now vkraemer(blogs.sun.com/vkraemer) from glassfish does not say to file a glassfish issue
(may be glassfish does *not* require deployment of whole app on class change)
http://stackoverflow.com/questions/4596978/deploying-java-web-application-having-huge-class-file

folks at javaranch disagree
http://www.coderanch.com/t/522444/Servlets/java/deploying-java-web-application-having

So now the question comes down whether changing a class require deployment of the whole app or it can be done without deployment of the whole app as in the case of jsp(as only that particular file is only saved and glassfish reads from the local disk)

Another thing that comes into my mind is that glassfish is reading the application files locally and is not in a war file.
I dont thing a war file is uploaded by netbeans as when the server is at localhost

So is it now a jsp/servlet issue , a glassfish(container) issue or a netbeans issue...

Thanks guys...
Happy bug hunting...
Comment 4 Vince Kraemer 2011-01-07 20:17:49 UTC
Changing a single class means the web app needs to be redeployed.  That is what the NB/GF integration does.  The server does not need to be restarted.

4 second redeploy of a 16 meg war file... not bad in my book.

Have you tried declaring the classes that are entities in your persistence.xml file... like the warning message from openjpa suggested?

JSP's are different than servlets.  GF has a JspServlet that manages their lifecycle, so they can be reloaded more dynamically.

Can you share the source of the project?
Comment 5 pradyutb 2011-01-07 20:38:07 UTC
i hope you can do something to make a new architecture of jsp/servlets

so anything that can be done to save class files without re-deploying 
may be using other frameworks(although all frameworks are based on jsp/servlets)

as of the project there's nothing much special..  js/css/jsp -> BAL ->DAL , simple database calls to mysql using callable statement with db pooling

may be for more take a look at http://pradyut.dyndns.org

thanks
Comment 6 Vince Kraemer 2011-01-07 20:55:52 UTC
you may be able to move your bal/dal into a stand-alone ejb jar and then access the bal layer via the global jndi names...
Comment 7 Vince Kraemer 2011-01-19 16:45:57 UTC
this is the way to do it...

http://blogs.sun.com/vkraemer/entry/never_run_a_web_app

You need to add a step 2.5...

Open the Project Properties for WA1 and untick the 'deploy on save' option for the project.

Marking as worksforme