meaning of this glassfish warning: context path differs from bundle

Thufir picture Thufir · Sep 9, 2014 · Viewed 23.6k times · Source

I'm not quite sure what this error message is indicating:

INFO:   visiting unvisited references
INFO:   visiting unvisited references
INFO:   visiting unvisited references
INFO:   visiting unvisited references
INFO:   EJB5181:Portable JNDI names for EJB Hello: [java:global/SalutationApp/SalutationApp-ejb/Hello, java:global/SalutationApp/SalutationApp-ejb/Hello!ejb.Hello]
INFO:   Loading application [SalutationApp#SalutationApp-war.war] at [SalutationApp-war]
INFO:   SalutationApp was successfully deployed in 976 milliseconds.
WARNING:   Context path from ServletContext: /SalutationApp-war differs from path from bundle: SalutationApp-war
INFO:   myRemoteMethod..

So far as I can tell, there doesn't seem to be an "application.xml" file...has that been deprecated?

thufir@dur:~/NetBeansProjects/SalutationApp/dist$ 
thufir@dur:~/NetBeansProjects/SalutationApp/dist$ ll
total 16
drwxrwxr-x 2 thufir thufir 4096 Sep  9 01:42 ./
drwxrwxr-x 8 thufir thufir 4096 Sep  9 01:42 ../
-rw-rw-r-- 1 thufir thufir 7139 Sep  9 01:42 SalutationApp.ear
thufir@dur:~/NetBeansProjects/SalutationApp/dist$ 
thufir@dur:~/NetBeansProjects/SalutationApp/dist$ jar -xf SalutationApp.ear 
thufir@dur:~/NetBeansProjects/SalutationApp/dist$ 
thufir@dur:~/NetBeansProjects/SalutationApp/dist$ ll
total 32
drwxrwxr-x 3 thufir thufir 4096 Sep  9 01:42 ./
drwxrwxr-x 8 thufir thufir 4096 Sep  9 01:42 ../
drwxrwxr-x 2 thufir thufir 4096 Sep  9 01:42 META-INF/
-rw-rw-r-- 1 thufir thufir 7139 Sep  9 01:42 SalutationApp.ear
-rw-rw-r-- 1 thufir thufir 1908 Sep  9 01:42 SalutationApp-ejb.jar
-rw-rw-r-- 1 thufir thufir 4652 Sep  9 01:42 SalutationApp-war.war
thufir@dur:~/NetBeansProjects/SalutationApp/dist$ 
thufir@dur:~/NetBeansProjects/SalutationApp/dist$ ll META-INF/
total 12
drwxrwxr-x 2 thufir thufir 4096 Sep  9 01:42 ./
drwxrwxr-x 3 thufir thufir 4096 Sep  9 01:42 ../
-rw-rw-r-- 1 thufir thufir  103 Sep  9 01:42 MANIFEST.MF
thufir@dur:~/NetBeansProjects/SalutationApp/dist$ 
thufir@dur:~/NetBeansProjects/SalutationApp/dist$ cat META-INF/MANIFEST.MF 
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.9.2
Created-By: 1.7.0_51-b31 (Oracle Corporation)

thufir@dur:~/NetBeansProjects/SalutationApp/dist$ 

see also comments here:

Is the Application-ejb.jar file listed in the application.xml file in the META-INF dir of the ear file? Is the Application-ejb.jar in the root of the ear file? – Sam Nunnally Nov 24 '13 at 4:03

Setting up Enterprise Application

which makes me wonder about the structure of my application. Currently, the application runs with the expected output -- a servlet which invokes an EJB.

What is this error indicative of?

see also:

https://netbeans.org/bugzilla/show_bug.cgi?id=232326

Answer

unwichtich picture unwichtich · Sep 9, 2014

This is just a warning, you can ignore it if you want.

The warning is raised because you probably have a leading slash (i.e. /) in your context-root in glassfish-web.xml (should be in the WEB-INF folder of the WAR).

You may get rid of the warning if you remove the leading slash so your glassfish-web.xml looks similar to this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
  <context-root>SalutationApp-war</context-root>
</glassfish-web-app>

If you don't have a glassfish-web.xml you can create one which looks like the example. You may also choose a better context-root for your application.