11 Replies Latest reply on Sep 28, 2011 12:00 PM by Linnet S

    Initialization Warning with Seam 2.1.1

    Neil C Novice

      Can anyone tell me what this error means?



      WARN  org.jboss.seam.util.Resources.getRealFile - Unable to determine real path from servlet context for "/WEB-INF/dev" path does not exist.
      



      I can't find where any place where I identify this path or something similar for anything in web.xml or anywhere else.


      Thanks.



        • 1. Re: Initialization Warning with Seam 2.1.1
          Julien Kronegg Novice

          You may have Eclipse project properties Java Build Path / Allow output folders for source folders checked. I had this checked once and some classes were generated to /WebContent/WEB-INF/dev

          • 2. Re: Initialization Warning with Seam 2.1.1
            Neil C Novice

            That's a good thought, but I am developing with IntelliJ and building with Ant. 


            I have a feeling Seam is expecting a file to be found at the WEB-INF/dev location and correctly not finding it.  I am wondering why Seam would be looking there and which file it would be looking for. 


            Or more precisely, why is Resources.getRealFile() called on startup?


            Thanks.

            • 3. Re: Initialization Warning with Seam 2.1.1
              Neil C Novice

              This is pretty interesting.  Here is the code for the method that generates the warning, and notice the first comment:



              public static File getRealFile(ServletContext servletContext, String path)
                 {
                    String realPath = servletContext.getRealPath(path);
                    if (realPath==null) //WebLogic!
                    {
                       try 
                       {
                          URL resourcePath = servletContext.getResource(path);
                          if ((resourcePath != null) && (resourcePath.getProtocol().equals("file"))) 
                          {
                             realPath = resourcePath.getPath();
                          }
                          else
                          {
                             log.warn("Unable to determine real path from servlet context for \"" + path + "\" path does not exist.");
                          }
                       }
                       catch (MalformedURLException e) 
                       {
                          log.warn("Unable to determine real path from servlet context for : " + path);
                          log.debug("Caused by MalformedURLException", e);
                       }
              
                    }
                    
                    if (realPath != null)
                    {
                       File file = new File(realPath);
                       if (file.exists())
                       {
                          return file;
                       }
                    }
                    return null;
                 }
              
              



              I am actually deploying to WebLogic!  9.2 to be exact.  What the heck is that comment referring to?


              I should note also that I am having no problems deploying Seam 2.0.0 GA to WebLogic 9.2 and using what I believe to be an identical deployment process (as I have pretty much copied the same Ant scripts to my other project.)


              Any insight is really appreciated.


              Thanks.

              • 4. Re: Initialization Warning with Seam 2.1.1
                Neil C Novice

                Well, I figured out that the issue isn't something I am doing at all.  It is based on an assumption Seam makes on initialization.


                From Initialization.java:


                public Initialization(ServletContext servletContext)
                   {
                      this.servletContext = servletContext;
                      this.warRoot = getRealFile(servletContext, "/");
                      this.warClassesDirectory = getRealFile(servletContext, "/WEB-INF/classes");
                      this.warLibDirectory = getRealFile(servletContext, "/WEB-INF/lib");
                      this.hotDeployDirectory = getRealFile(servletContext,     
                                  HotDeploymentStrategy.DEFAULT_HOT_DEPLOYMENT_DIRECTORY_PATH);
                   }
                



                As you might guess, that last line is the kicker.


                As we find in HotDeploymentStrategy.java:


                HotDeploymentStrategy.DEFAULT_HOT_DEPLOYMENT_DIRECTORY_PATH = "/WEB-INF/dev";



                So Seam assumes the presence of such a directory.  Because I am deploying to WebLogic 9.2, I have no use for such a directory.  Is there a way I can get Seam not to look for this?  Or do I just have to put a superfluous empty dev directory in the WEB-INF folder of my war file?


                Also, my application currently isn't working because of this error.  On the page I have developed so far, when I submit, I just get like 50 repetitions of the WARN  org.jboss.seam.util.Resources.getRealFile - Unable to determine real path from servlet context for "/WEB-INF/dev" path does not exist.
                warning. 


                I get the hot deploy thing is super convenient for people who can use it, but shouldn't it be an optional deal?  Why would the absence of this convenience actually cripple my app?


                Thanks for any insight.

                • 5. Re: Initialization Warning with Seam 2.1.1
                  Binesh Gummadi Novice

                  Try to turn of the debug mode in components.xml


                  <core:init debug="false"/>



                  I don't know why it isn't working tho. Seam is looking for a special folder for hot deployment and if present uses a special class loader to load your classes.

                  • 6. Re: Initialization Warning with Seam 2.1.1
                    Binesh Gummadi Novice

                    How are you deploying your application? If you are using seam-gen you can see build-dev.properties and build-prod.properties which has action.dir property which is used for hot deployment.


                    In my previous post I asked you to turn off the debug mode to see if you can bring up your application. Hot deployment feature will be turned off when you turn off debugging. (Section 8 in seam reference documentation)


                    Good Luck

                    • 7. Re: Initialization Warning with Seam 2.1.1
                      Neil C Novice

                      I noticed the thing about the modes too.  However, if I set <core:init debug="false"/>, doesn't that mean I will lose the Seam debug page.  I find that pretty helpful and don't want to lose it.


                      To answer your question about deployment, I generated all my own artifacts because I wanted to really understand how things work.  I then compose my own war file with an Ant script from these artifacts I made.  I suppose I can look into these properties files you mentioned and generate them myself if that helps me.


                      Thanks for the insight.  Any more is appreciated.


                      • 8. Re: Initialization Warning with Seam 2.1.1
                        Binesh Gummadi Novice

                        After a little research, this looks like a bug in weblogic 9x. Deploy your app in weblogic 10x and see if it works. This apprently is fixed in 10x.


                        If you cannot upgrade to weblogic 10x try to deploy it as an exploded war file as opposed to a web archive file.
                        If you still see the error add this to your weblogic.xml file and see if you can resolve the issue without losing debugging feature.



                        <container-descriptor> 
                           <show-archived-real-path-enabled>true</show-archived-real-path-enabled> 
                        </container-descriptor>



                        Hope this helps.

                        • 9. Re: Initialization Warning with Seam 2.1.1
                          Neil C Novice

                          Can you be more specific about what the bug is exactly?  Links to the resources you identified are appreciated.


                          I can't upgrade to WebLogic 10, so I think I will try the following (and see what happens) in this order:




                          1. Add a superfluous dev directory

                          2. Add a weblogic.xml file with the element you mentioned.  My other application built on Seam 2.0.0 and also deployed to WebLogic 9.2 doesn't need such a file.  The samples don't have one either.

                          3. Deploy as an exploded directory



                          Let's see what happens.


                          Thanks for your effort and your help.

                          • 10. Re: Initialization Warning with Seam 2.1.1
                            Neil C Novice

                            I forgot to mention my last resort will be simply downgrading to Seam 2.0.0 which I know to work on WebLogic 9.2.  All the while I will probably be harping on the infrastructure guys to let me have WebLogic 10.


                            Thanks.

                            • 11. Re: Initialization Warning with Seam 2.1.1
                              Linnet S Newbie

                              Hi,


                              I am experiencing the same issue with Seam 2.2.0.GA and WebLogic 10.3.3, were you able to resolve your issue?


                              Thanks!