[EJB 3.0] - EJB reference in Servlet always null
by buki79
Hi,
I use JBoss 4.2.2 on Mac OS with JDK 1.5.
First, I created a Session:
@Stateful(name="ViewerBean")
| public class ViewerBean implements Viewer,
| ViewerLocal{
|
Then I want to call the bean from a servlet:
| public class ViewerServlet extends HttpServlet {
|
| //inject EJB
| @EJB(mappedName="ViewerBean")
| private ViewerBean bean;
|
| private static final long serialVersionUID = 1L;
|
|
| /**
| * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
| */
| protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
| try {
| List events = bean.getEvents();
| ...
|
I haven't added anything to the ejb-jar.xml as the annotations should be sufficient. But everytime I want to call bean.getEvents() I get a NullPointerException.
I have an EJB3 project created in eclipse, as well as an EAR project. Both are deployed on the same server and the EAR client program references the EJB3 project, so I can use the ViewerBean in the client.
Is this correct? Could you give me any hints on what I'm actually missing?
Best regards,
Andreas
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4216791#4216791
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4216791
17 years, 1 month
[JBoss Tools (users)] - Re: Seam components view problem with JBDS 1.1.0.GA
by asookazian
"akazakov" wrote : "asookazian" wrote : Also, it seems strange to me that when you use seam-gen from cmd line, you end up with one high level project folder (in my case 'BETS'). But when you create a new Seam project using JBoss Tools (or Seam tools??), you end up with 4 high level folders *for the exact same project* (i.e. it's an EAR, etc.)
| Seam-gen projects use ant sript to build/deploy EAR/EJB/WAR. So you can use any project structure. It's metter of ant file to handle it. But JBoss Tools depends on Eclipse Web Tools. And you have to have WTP-strucrtured projects to have whole set of features.
| For EAR deployment type it creates 4 projects: EAR,EJB,WAR,Test. And there are two projects in case of WAR deployment: WAR,Test.
I would expect that the JBoss Seam/Tools dev team would have seam-gen and JBoss Tools "seamlessly" and completely integrated by now. What I mean by that is to be able to seam-gen a new project from the IDE rather than cmd line.
I see here: http://docs.jboss.org/tools/3.0.0.CR2/en/seam/html_single/index.html that there is some integration with some of the seam command line commands (e.g. action, form, entity, conversation, generate-entities) but I'd love to see the setup and create-project in there as well (as well as the build.xml that we know and love!)
So basically what is the recommendation from your team and Pete Muir, for example? Use JBoss Tools and forget seam-gen from cmd line? Stick with 4 projects "per project" for an EAR?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4216787#4216787
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4216787
17 years, 1 month
[JBoss Tools (users)] - Re: Seam components view problem with JBDS 1.1.0.GA
by asookazian
Not sure if this is related or not...
eclipse.buildId=M20090107-0800
| java.version=1.5.0_17
| java.vendor=Sun Microsystems Inc.
| BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
| Command-line arguments: -os win32 -ws win32 -arch x86
|
|
| Error
| Tue Mar 10 14:49:59 PDT 2009
| Problems occurred when invoking code from plug-in: "org.eclipse.jst.jee".
|
| java.lang.NullPointerException
| at org.eclipse.wst.common.componentcore.ModuleCoreNature.primaryContributeToContext(ModuleCoreNature.java:552)
| at org.eclipse.jem.internal.util.emf.workbench.EMFWorkbenchContextFactory.createEMFContext(EMFWorkbenchContextFactory.java:113)
| at org.eclipse.wst.common.internal.emfworkbench.edit.EMFWorkbenchEditContextFactory.createEMFContext(EMFWorkbenchEditContextFactory.java:81)
| at org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase.createEMFContext(WorkbenchResourceHelperBase.java:249)
| at org.eclipse.jem.util.emf.workbench.nature.EMFNature.createEmfContext(EMFNature.java:105)
| at org.eclipse.jem.util.emf.workbench.nature.EMFNature.getEmfContextBase(EMFNature.java:229)
| at org.eclipse.wst.common.internal.emfworkbench.integration.EditModelNature.getEmfContext(EditModelNature.java:61)
| at org.eclipse.wst.common.componentcore.ModuleCoreNature.getModuleStructuralModelForRead(ModuleCoreNature.java:269)
| at org.eclipse.wst.common.componentcore.internal.StructureEdit.<init>(StructureEdit.java:320)
| at org.eclipse.wst.common.componentcore.internal.StructureEdit.getStructureEditForRead(StructureEdit.java:119)
| at org.eclipse.wst.common.componentcore.internal.resources.VirtualResource.getReadOnlyComponent(VirtualResource.java:326)
| at org.eclipse.wst.common.componentcore.internal.resources.VirtualResource.getProjectRelativePath(VirtualResource.java:147)
| at org.eclipse.jst.jee.model.internal.JEE5ModelProvider.getModelResource(JEE5ModelProvider.java:147)
| at org.eclipse.jst.jee.model.internal.Web25ModelProvider.getModelObject(Web25ModelProvider.java:42)
| at org.eclipse.jst.jee.model.internal.JEE5ModelProvider.getModelObject(JEE5ModelProvider.java:210)
| at org.eclipse.jst.jee.model.internal.Web25MergedModelProvider.getXmlWebApp(Web25MergedModelProvider.java:51)
| at org.eclipse.jst.jee.model.internal.Web25MergedModelProvider.internalModelChanged(Web25MergedModelProvider.java:137)
| at org.eclipse.jst.jee.model.internal.Web25MergedModelProvider.xmlModelChanged(Web25MergedModelProvider.java:128)
| at org.eclipse.jst.jee.model.internal.common.AbstractMergedModelProvider$XmlModelListener.modelsChanged(AbstractMergedModelProvider.java:95)
| at org.eclipse.jst.jee.model.internal.JEE5ModelProvider$NotifyRunner.run(JEE5ModelProvider.java:446)
| at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
| at org.eclipse.jst.jee.model.internal.JEE5ModelProvider.notifyListeners(JEE5ModelProvider.java:421)
| at org.eclipse.jst.jee.model.internal.JEE5ModelProvider.resourceChanged(JEE5ModelProvider.java:103)
| at org.eclipse.jst.jee.model.internal.JEE5ModelProvider$ResourceAdapter.notifyChanged(JEE5ModelProvider.java:78)
| at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:247)
| at org.eclipse.emf.ecore.resource.impl.ResourceImpl.setModified(ResourceImpl.java:1748)
| at org.eclipse.emf.ecore.resource.impl.ResourceImpl$ContentsEList.modified(ResourceImpl.java:490)
| at org.eclipse.emf.ecore.resource.impl.ResourceImpl$ContentsEList.didRemove(ResourceImpl.java:451)
| at org.eclipse.emf.common.util.BasicEList.didClear(BasicEList.java:260)
| at org.eclipse.emf.ecore.resource.impl.ResourceImpl$ContentsEList.didClear(ResourceImpl.java:470)
| at org.eclipse.emf.common.util.BasicEList.clear(BasicEList.java:1000)
| at org.eclipse.emf.common.notify.impl.NotifyingListImpl.doClear(NotifyingListImpl.java:1155)
| at org.eclipse.emf.common.notify.impl.NotifyingListImpl.clear(NotifyingListImpl.java:1082)
| at org.eclipse.emf.ecore.resource.impl.ResourceImpl.doUnload(ResourceImpl.java:1563)
| at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doUnload(XMLResourceImpl.java:505)
| at org.eclipse.emf.ecore.resource.impl.ResourceImpl.unload(ResourceImpl.java:1585)
| at org.eclipse.jem.internal.util.emf.workbench.ProjectResourceSetImpl.removeAndUnloadAllResources(ProjectResourceSetImpl.java:226)
| at org.eclipse.jem.internal.util.emf.workbench.ProjectResourceSetImpl.release(ProjectResourceSetImpl.java:210)
| at org.eclipse.wst.common.internal.emfworkbench.integration.ResourceSetWorkbenchEditSynchronizer.release(ResourceSetWorkbenchEditSynchronizer.java:258)
| at org.eclipse.jem.util.emf.workbench.ResourceSetWorkbenchSynchronizer.resourceChanged(ResourceSetWorkbenchSynchronizer.java:83)
| at org.eclipse.wst.common.internal.emfworkbench.integration.ResourceSetWorkbenchEditSynchronizer.resourceChanged(ResourceSetWorkbenchEditSynchronizer.java:145)
| at org.eclipse.core.internal.events.NotificationManager$2.run(NotificationManager.java:288)
| at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
| at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:282)
| at org.eclipse.core.internal.events.NotificationManager.handleEvent(NotificationManager.java:248)
| at org.eclipse.core.internal.resources.Workspace.broadcastEvent(Workspace.java:307)
| at org.eclipse.core.internal.resources.Project.close(Project.java:165)
| at org.eclipse.ui.actions.CloseResourceAction.invokeOperation(CloseResourceAction.java:218)
| at org.eclipse.ui.actions.WorkspaceAction.execute(WorkspaceAction.java:162)
| at org.eclipse.ui.actions.WorkspaceAction$2.runInWorkspace(WorkspaceAction.java:483)
| at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
| at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4216786#4216786
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4216786
17 years, 1 month
[JBoss Tools (users)] - Re: Seam components view problem with JBDS 1.1.0.GA
by asookazian
"akazakov" wrote : The same problem with Hibernate console or/and with empty components view?
| Adding Seam builder to .project should solve second problem.
This is my BETS\.project after the mod you suggested:
| <?xml version="1.0" encoding="UTF-8"?>
| <projectDescription>
| <name>BETS</name>
| <comment></comment>
| <projects>
| </projects>
| <buildSpec>
| <buildCommand>
| <name>org.jboss.tools.seam.core.seambuilder</name>
| <arguments>
| </arguments>
| </buildCommand>
| <buildCommand>
| <name>org.eclipse.jdt.core.javabuilder</name>
| <arguments>
| </arguments>
| </buildCommand>
| <buildCommand>
| <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
| <triggers>full,</triggers>
| <arguments>
| <dictionary>
| <key>LaunchConfigHandle</key>
| <value><project>/explode.launch</value>
| </dictionary>
| </arguments>
| </buildCommand>
| </buildSpec>
| <natures>
| <nature>org.eclipse.jdt.core.javanature</nature>
| <nature>org.hibernate.eclipse.console.hibernateNature</nature>
| <nature>org.jboss.tools.seam.core.seamnature</nature>
| </natures>
| </projectDescription>
I refreshed my BETS project and closed and opened the Seam components view and when I click the plus (+) sign next to BETS in Seam components view, there's nothing.
Here's the error log message:
Contributor org.jboss.tools.seam.ui.views.SeamComponentsNavigator cannot be created.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4216782#4216782
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4216782
17 years, 1 month
[JBoss Portal] - Passing parameters to JSP included
by nilsonp
Hi.
Iôm use Jboss Portal 2.7.0 GA, and my web application consists of:
portlet class:
| public class TestPortlet extends GenericPortlet {
|
| protected void doView(RenderRequest request, RenderResponse response)
| throws PortletException, IOException {
|
| PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/jsp/uno.jsp?MiParametro=47");
| prd.include(request, response);
| }
|
| }
|
jsp page "uno.jsp":
| <body>
| <jsp:include page="/jsp/dos.jsp" flush="true">
| <jsp:param name="otroParametro" value="40" />
| </jsp:include>
| </body>
|
jsp page "dos.jsp":
| <body>
| <%out.println("MiParametro: "+request.getParameter("MiParametro"));
| out.println("otroParametro: "+request.getParameter("otroParametro"));
| %>
| </body>
|
and xml file "portlet.xml":
| <portlet>
| <portlet-name>PruebaPortlet</portlet-name>
| <portlet-class>test.portlettest.TestPortlet</portlet-class>
| <supports>
| <mime-type>text/html</mime-type>
| <portlet-mode>view</portlet-mode>
| </supports>
| <portlet-info>
| <title>Prueba Portlet</title>
| </portlet-info>
| </portlet>
|
when displaying the page containing the portlet, the result is:
anonymous wrote : MiParametro: 47 otroParametro: null
Does anyone know how can this problem be solved?
would greatly appreciate any responses that guide me to solve it.
Nilson
PS. please excuse my English
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4216781#4216781
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4216781
17 years, 1 month