Jelmer's right, I'm using EE so that would explain the availability of openSession() in my persistence interface...
Pete Helgren:
The NB created SB war and jar deploys on Glassfish 3.0.1 without a hitch. I also have written a servlet which uses the services in the SB portlet. The ONLY way I can use the services this way is to put the services*.jar in the GF_HOME/domains/domain1/lib folder. With this combination all is well with the NB generated SB portlet and my servlet.
Okay, this is neither an NB or Eclipse issue, this is just a deployment issue. In both cases, GF and T, you just need to copy the service jar to the WEB-INF/lib directory of the servlet to use the services. You must ensure that the load order has the servlet load after the plugin providing the service loads in the app container, otherwise you'll end up with bean locator exceptions...
The Eclipse generated SB war when deployed to the same GF instance (having removed the old war and seeing it undeploy in GF) and removing the service*.jar from the GF_HOME/domain/domain1/lib folder and replacing it with the Eclipse generated one, generates the $Proxy error. With Tomcat, well, I can't get Tomcat to work with this kind of configuration regardless of where I put the service*.jar so I have focused for now on GF (I wish I could get it to work with TC but after months of trying I have given up for now)
When you are deploying any SB-based service in this manner (promoting service jar to the global loader), you must remove the service jar from the plugin after deployment. You should only have a single instance of the service jar, the one in the global lib dir, and no copies in the web apps folder.
I don't know about NB, but Eclipse relies totally on the SDK/ant build process for bundling and deploying plugins. I know in my SDK directory I've indicated I'm using tomcat for the app server type (in the build-${username}.properties file), but I think that if you're switching between app servers you may need to change your file to build the correct deployment artifact.
Just as a reminder I am running LR 6.0.6CE on Windows 7 (64bit) Java 1.6.0_31 (64 bit mixed mode). Both the GF and TC bundles are used.
I suspect that I am either creating the SB portlet incorrectly or that Eclipse is building things slightly differently than NB.
Well, for the most part Eclipse does not do anything during the build except invoke ant (and therefore the SDK). NB, I'm not sure if it does the same or if it uses a different build process for Liferay.
Again, this exact same $Proxy cast error occurs both in GF and TC with the Eclipse generated SB portlet. It doesn't occur in GF with the NB generated SB portlet (but the NB generated doesn't work in TC anyway - I always get a BeanLocator has not been set error). For the Eclipse generated SB war/jar in TC, if I only have the service*.jar in the WEB-INF/lib folder of the deployed portlet and the WEB-INF/lib of my servlet then I get a BeanLocator has not been set for servlet context error (yeah, just like with the NB generated SB portlet). As you surmised, the $Proxy cast error occurs when the service*.jar resides in the /lib/ext folder and in the SB portlet's WEB-INF/lib folder.
The BeanLocator not being set is load order in the app container. The servlet is trying to access the service before the service is set up and ready to go. Often times for a servlet it may be easier to use the remote service instead of the local service because the bean locator stuff is not invoked.
Please sign in to flag this as inappropriate.