[JBoss Portal] - Re: Spring MVC Portlet framework for Development
by swisst
I guess I am confused by this statement:
anonymous wrote : I tried the Spring MVC Porlet framework example but not able to understand whether we can have Servlet as the base request handler on top of which I can place the MVC portlet framework?
Let's take a step back...you say you are new to Spring, have you used Struts before? If so, think of them as analogous in the Servlet (typical web app) world. **Calm down Spring guru's, I know there is a lot more to Spring, we are just talking MVC.
Now, move into the Portlet world...there is no DispatcherServlet, however, there is a DispatcherPortlet that will delegate all of the requests to the proper Controllers (think Struts Actions). The Spring portlet framework class structure mirrors that of it's Servlet cousin, but the starting point is not a Servlet, rather it is a Portlet.
There are countless books on the Spring Framework (I like the "..In Action" series myself). Pick up one of these books, and it will help you to learn Spring for the Servlet world. Just remember that most tutorials for the Servlet world will transfer to the Portlet world, thanks to the mirrored class structure.
Does that help?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4130442#4130442
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4130442
18 years, 2 months
[Beginners Corner] - Error when conecting with a remote object from MBean
by ovistanciu
Hello.
I have a remote server and a client in the form of an MBean, designed following the Serialization Server example from JBoss Remoting.
The Server
| import javax.management.MBeanServer;
|
| import org.jboss.remoting.InvocationRequest;
| import org.jboss.remoting.InvokerLocator;
| import org.jboss.remoting.ServerInvocationHandler;
| import org.jboss.remoting.ServerInvoker;
| import org.jboss.remoting.callback.InvokerCallbackHandler;
| import org.jboss.remoting.transport.Connector;
|
| import ro.ebsoft.doorcontrol.comm.common.CommModuleMain;
| import ro.ebsoft.doorcontrol.interfaces.CommModule;
|
| public class Main {
|
| private static String transport = "rmi";
| private static String host = "localhost";
| private static int port = 5400;
|
| private static CommModule response;
|
| public void setupServer(String locatorURI) throws Exception {
| InvokerLocator locator = new InvokerLocator(locatorURI);
| System.out.println("Starting remoting server with locator URI of: "
| + locatorURI);
| Connector connector = new Connector(locator);
|
| connector.create();
|
| SampleInvocationHandler invocationHandler = new SampleInvocationHandler();
| connector.addInvocationHandler("CommModule", invocationHandler);
|
| connector.start();
| }
|
| // rmi server main class
| public static void main(String args[]) {
|
| String locatorURI = transport + "://" + host + ":" + port
| + "/?serializationtype=jboss";
| Main main = new Main();
|
| try {
| response = new CommModuleMain();
| main.setupServer(locatorURI);
| while (true) {
| Thread.sleep(1000);
| }
| } catch (Exception e) {
| e.printStackTrace();
| }
| }
|
| public static class SampleInvocationHandler implements
| ServerInvocationHandler {
|
| @Override
| public void addListener(InvokerCallbackHandler arg0) {
| }
|
| @Override
| public Object invoke(InvocationRequest invocation) throws Throwable {
| System.out.println("Invocation request is "
| + invocation.getParameter());
|
| return new CommModuleMain();
| }
|
| @Override
| public void removeListener(InvokerCallbackHandler arg0) {
| }
|
| @Override
| public void setInvoker(ServerInvoker arg0) {
| }
|
| @Override
| public void setMBeanServer(MBeanServer arg0) {
| }
|
| }
| }
|
The MBean class
| package ro.ebsoft.doorcontrol.mbean.engine;
|
| import org.jboss.remoting.Client;
| import org.jboss.remoting.InvokerLocator;
| import org.jboss.system.ServiceMBeanSupport;
|
| import interfaces.CommModule;
|
| public class CommEngine extends ServiceMBeanSupport implements CommEngineMBean {
|
| private static String transport = "rmi";
| private static String host = "localhost";
| private static int port = 5400;
|
| public String getMessage() {
| return message;
| }
|
| public void setMessage(String message) {
| this.message = message;
| }
|
| public void printMessage(){
| log.info(message);
| }
|
| protected void startService() throws Exception{
| log.info("Starting CommModuleMBean");
| String locatorURI = transport + "://" + host + ":" + port + "/?serializationtype=jboss";
| log.info("Connecting to " + locatorURI);
| //String locatorURI = transport + "://" + host + ":" + port;
|
| InvokerLocator locator = new InvokerLocator(locatorURI);
| Client remotingClient = new Client(locator);
| remotingClient.connect();
|
| try{
| CommModule cm = (CommModule)remotingClient.invoke("CommModule");
| }
| catch(Throwable t){
| t.printStackTrace();
| }
| }
|
| protected void stopService() throws Exception{
| log.info("Stopping with message: " + message);
| }
|
| //setters & getters
| }
|
When I run both the server and a similar client (which is not an MBean), all goes well. But when I deploy my client as a .sar in the app server, I get
| ERROR [MainDeployer] Could not create deployment: file:/opt/jboss-4.2.2.GA/server/default/deploy/commengine.sar
| org.jboss.deployment.DeploymentException: - nested throwable: (java.lang.reflect.UndeclaredThrowableException)
| at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:196)
| at org.jboss.system.ServiceController.install(ServiceController.java:226)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy4.install(Unknown Source)
| at org.jboss.deployment.SARDeployer.create(SARDeployer.java:249)
| at org.jboss.deployment.MainDeployer.create(MainDeployer.java:969)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:818)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy9.deploy(Unknown Source)
| at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
| at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
| at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
| at $Proxy0.start(Unknown Source)
| at org.jboss.system.ServiceController.start(ServiceController.java:417)
| at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy4.start(Unknown Source)
| at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
| at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy5.deploy(Unknown Source)
| at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
| at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
| at org.jboss.Main.boot(Main.java:200)
| at org.jboss.Main$1.run(Main.java:508)
| at java.lang.Thread.run(Thread.java:595)
| Caused by: java.lang.reflect.UndeclaredThrowableException
| at org.jboss.system.ServiceCreator.install(ServiceCreator.java:236)
| at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:451)
| at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:171)
| ... 81 more
| Caused by: java.lang.NoClassDefFoundError: interfaces/CommModule
| at java.lang.Class.getDeclaredConstructors0(Native Method)
| at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
| at java.lang.Class.getConstructor0(Class.java:2671)
| at java.lang.Class.getConstructor(Class.java:1629)
| at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:1232)
| at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:286)
| at org.jboss.mx.server.MBeanServerImpl.createMBean(MBeanServerImpl.java:344)
| at org.jboss.system.ServiceCreator.install(ServiceCreator.java:157)
| ... 83 more
|
I have included a .jar which contains interfaces.CommModule in the MBean .sar.
If I change the server to return. say, a String rather than a CommModule, all goes well, the MBean deploys and works as expected (obtains the string by invoking the remote server).
All I want to do is to obtain a remote instance of a CommModule when the app server starts.
Could someone explain what am I doing wrong? Or a better idea (any idea) of doing this?
Thank you for your time.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4130440#4130440
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4130440
18 years, 2 months
[Installation, Configuration & DEPLOYMENT] - Re: org.jboss.deployment.DeploymentException: ManagedConnect
by fengbin98
Jboss 4.2.2GA
Jave: SDK 1.5
It seems to me that the problem is the application fails to get a database connection handle from the jboss server. But I am not sure whether it is caused by the fact that Jboss server is not running or the fact that the server config is wrong. Please help.
1112 [main] DEBUG org.jboss.util.NestedThrowable - org.jboss.util.NestedThrowable.parentTraceEnabled=true
1112 [main] DEBUG org.jboss.util.NestedThrowable - org.jboss.util.NestedThrowable.nestedTraceEnabled=false
1112 [main] DEBUG org.jboss.util.NestedThrowable - org.jboss.util.NestedThrowable.detectDuplicateNesting=true
1112 [main] ERROR com.wire.db.DataUtil - Exception caught in setupDataSource(): org.jboss.deployment.DeploymentException: ManagedConnectionFactory not set!
1134 [main] ERROR com.wire.db.DataException - Exception thrown while initializing DataSource
org.jboss.deployment.DeploymentException: ManagedConnectionFactory not set!
at org.jboss.resource.connectionmanager.ManagedConnectionPool.startService(ManagedConnectionPool.java:291)
at com.wire.db.ManagedConnectionPoolProxy.doStartService(DataUtil.java:718)
at com.wire.db.DataUtil.setupDataSource(DataUtil.java:358)
at com.wire.db.DataUtil.setupDataSource(DataUtil.java:241)
at com.wire.db.DataUtil.setupDataSource(DataUtil.java:140)
at com.wire.db.DbConnUtil.getContext(DbConnUtil.java:109)
at com.wire.db.DbConnUtil.getConnection(DbConnUtil.java:40)
at com.wire.db.DbConn.getConnection(DbConn.java:180)
9563 [main] ERROR com.wire.db.DbConn - com.wire.db.DbConn::getConnection: Failed to get a connection.
com.wire.db.DataException: Exception thrown while initializing DataSource
at com.wire.db.DataUtil.setupDataSource(DataUtil.java:474)
at com.wire.db.DataUtil.setupDataSource(DataUtil.java:241)
at com.wire.db.DataUtil.setupDataSource(DataUtil.java:140)
at com.wire.db.DbConnUtil.getContext(DbConnUtil.java:109)
at com.wire.db.DbConnUtil.getConnection(DbConnUtil.java:40)
at com.wire.db.DbConn.getConnection(DbConn.java:180)
Caused by: org.jboss.deployment.DeploymentException: ManagedConnectionFactory not set!
at org.jboss.resource.connectionmanager.ManagedConnectionPool.startService(ManagedConnectionPool.java:291)
at com.wire.db.ManagedConnectionPoolProxy.doStartService(DataUtil.java:718)
at com.wire.db.DataUtil.setupDataSource(DataUtil.java:358)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4130439#4130439
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4130439
18 years, 2 months