[Remoting] - RMI call from JBoss Servlet : Security Exception
by Lokeya
I am using JBoss as my Application server and trying to make an RMI call from that. Facing following exception. I googled and understood that its something to do with the Java 2 security issue. I tried to overcome that using the following lines of code in my servlet(RMI client) and RMI server
System.setProperty("java.security.policy","policy.all");
System.setSecurityManager(new RMISecurityManager());
where i grant AllPermissions. Even then facing the following issue. Is there some JBoss configuration which needs to be changed to get this working?
Help Appreciated.
java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:2000 connect,resolve)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java :264)
at java.security.AccessController.checkPermission(AccessController.java:427)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4062145#4062145
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4062145
18Â years, 9Â months
[Tomcat, HTTPD, Servlets & JSP] - Servlet + RMI call Issue.
by Lokeya
I am using JBoss as my Application server and trying to make an RMI call from that. Facing following exception. I googled and understood that its something to do with the Java 2 security issue. I tried to overcome that using the following lines of code in my servlet(RMI client) and RMI server
System.setProperty("java.security.policy","policy.all");
System.setSecurityManager(new RMISecurityManager());
where i grant AllPermissions. Even then facing the following issue. Is there some JBoss configuration which needs to be changed to get this working?
Help Appreciated.
java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:2000 connect,resolve)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java :264)
at java.security.AccessController.checkPermission(AccessController.java:427)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4062144#4062144
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4062144
18Â years, 9Â months
[JNDI/Naming/Network] - Re: RMI on HTTP with PROXY
by Lokeya
I am using JBoss as my Application server and trying to make an RMI call from that. Facing following exception. I googled and understood that its something to do with the Java 2 security issue. I tried to overcome that using the following lines of code in my servlet(RMI client) and RMI server
System.setProperty("java.security.policy","policy.all");
System.setSecurityManager(new RMISecurityManager());
where i grant AllPermissions. Even then facing the following issue. Is there some JBoss configuration which needs to be changed to get this working?
Help Appreciated.
java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:2000 connect,resolve)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java :264)
at java.security.AccessController.checkPermission(AccessController.java:427)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4062143#4062143
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4062143
18Â years, 9Â months
[JBoss Seam] - Re: Getting objects from conversation in a custom PhaseListe
by JakeC
That looks like exactly what I need, but I can't use 2.0, with a handy-dandy ContextualHttpServletRequest. Here is what I've come up with for 1.1.5GA:
components.xml
| <component name="documentResource" class="com.myco.myproject.DocumentResource" scope="APPLICATION" auto-create="true"/>
|
DocumentResource.java
| package com.myco.myproject;
|
| import static org.jboss.seam.InterceptionType.NEVER;
| import static org.jboss.seam.ScopeType.APPLICATION;
| import static org.jboss.seam.annotations.Install.BUILT_IN;
|
| import java.io.File;
| import java.io.InputStream;
| import java.io.IOException;
| import java.util.Set;
|
| import javax.faces.context.FacesContext;
| import javax.servlet.http.HttpServletRequest;
| import javax.servlet.http.HttpServletResponse;
|
| import org.jboss.seam.annotations.Install;
| import org.jboss.seam.annotations.Intercept;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Scope;
| import org.jboss.seam.annotations.Startup;
| import org.jboss.seam.annotations.security.Restrict;
| import org.jboss.seam.contexts.ContextAdaptor;
| import org.jboss.seam.contexts.Lifecycle;
| import org.jboss.seam.core.Expressions;
| import org.jboss.seam.core.Manager;
| import org.jboss.seam.core.Expressions.ValueBinding;
| import org.jboss.seam.log.Log;
| import org.jboss.seam.log.Logging;
| import org.jboss.seam.servlet.AbstractResource;
|
| import com.myco.myproject.db.Document;
| import com.myco.myproject.db.DocumentSet;
|
| @Startup
| @Scope(APPLICATION)
| @Name("documentResource")
| @Restrict("#{identity.loggedIn}")
| @Install(precedence = BUILT_IN)
| @Intercept(NEVER)
| public class DocumentResource extends AbstractResource {
| private static final String RESOURCE_PATH = "/document";
|
| public static final String WEB_RESOURCE_PATH = "/seam/resource" + RESOURCE_PATH;
|
| private static Log log = (Log) Logging.getLog(DocumentResource.class);
|
| private static String docDir = "C:\\resources\\docs";
|
| static final int BUF_SIZE = 16384;
|
| @Override
| protected String getResourcePath() {
| return RESOURCE_PATH;
| }
|
| Document getDocument(int index) {
| Set<Document> attachments = null;
| try {
| ValueBinding vb = Expressions.instance().createValueBinding("#{currentDocumentSet}");
| if (vb == null)
| log.error("VB is null!");
| else {
| Object o = vb.getValue();
| log.info("vb type=" + vb.getType() + ", value=" + o);
| if (o != null && o instanceof DocumentSet)
| attachments = ((DocumentSet) o).getAttachments();
| }
| } catch (Throwable t) {
| log.error("Exception getting VB", t);
| }
|
| return attachments == null || index >= attachments.size() ? null : (Document) attachments.toArray()[index];
| }
|
| @Override
| public void getResource(HttpServletRequest request,
| HttpServletResponse response) throws IOException {
| String pathInfo = request.getPathInfo().substring(getResourcePath().length());
| log.info("pathInfo=" + pathInfo);
| beginConversation(request);
|
| String path[] = pathInfo.split("/");
| int i = 0;
| boolean src = false;
| if ("".equals(path))
| ++i;
| if ("src".equals(path)) {
| src = true;
| ++i;
| }
| Document doc = null;
| try {
| doc = getDocument(Integer.parseInt(path));
| } catch (Throwable t) {
| log.error("Exception parsing document index", t);
| }
|
| InputStream is = null;
| if (doc != null)
| try {
| if(docDir == null) {
| try {
| docDir = getServletContext().getInitParameter("document.folder");
| } catch (Throwable t) {
| log.error("Exception getting init parameter", t);
| }
| }
| is = doc.getInputStream(src, docDir);
| int len = -1;
| byte[] buf = new byte[BUF_SIZE];
| while((len = is.read(buf)) != -1)
| response.getOutputStream().write(buf, 0, len);
| } catch (IllegalArgumentException e) {
| response.sendError(HttpServletResponse.SC_NOT_FOUND);
| return;
| } catch (Throwable t) {
| response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
| return;
| } finally {
| if(is != null) try {is.close();} catch (Exception ignored){}
| }
| else {
| response.sendError(HttpServletResponse.SC_NOT_FOUND);
| return;
| }
| response.setHeader("Cache-Control", "no-store");
| response.setHeader("Pragma", "no-cache");
| response.setDateHeader("Expires", 0);
| response.setContentType("application/octet-stream");
| response.getOutputStream().flush();
| response.getOutputStream().close();
| endConversation(request);
| }
|
| private void beginConversation(HttpServletRequest request) {
| Lifecycle.beginRequest(getServletContext(), request.getSession(), request);
| Manager.instance().restoreConversation(request.getParameterMap());
| Lifecycle.resumeConversation(request.getSession());
| Manager.instance().handleConversationPropagation(request.getParameterMap());
| }
| private void endConversation(HttpServletRequest request) {
| Manager.instance().endRequest(ContextAdaptor.getRequest(request));
| Lifecycle.endRequest();
| }
| }
|
The code in my beginConversation() and endConversation() methods seem to be roughly equivalent to code in ContextualHttpServletRequest, but I'm sure that I'm not doing it correctly, as I'm still getting an exception, and still killing the conversation.
The exception I get now is:
ERROR [DocumentResource] Exception getting VB
| javax.el.PropertyNotFoundException: ELResolver cannot handle a null base Object with identifier
| 'currentDocumentSet'
If I log "Manager.instance().getCurrentConversationId()", I get the correct ID, but I can't seem to get the information out of the conversation. And once again, if I try to continue after this, I get an error:
| Caused by: javax.ejb.EJBTransactionRolledbackException: org.jboss.seam.NoConversationException:
| no long-running conversation for @Conversational bean:
| documentSetController
|
Also, it is ignoring the @Restrict and allowing access to un-logged-in users, although, of course, they also get the javax.el.PropertyNotFoundException.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4062139#4062139
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4062139
18Â years, 9Â months
[JBoss Seam] - Re: Problems with seam and icefaces (sending emails)
by kosl
Different exception is thrown when the message is thrown asynchronously.
| 22:25:41,921 ERROR [STDERR] 2007-07-09 22:25:41 com.sun.facelets.tag.jsf.ComponentRule warnAttr
| WARNING: /jboss-seam-email.war/simple.xhtml @3,51 xmlns="http://www.w3.org/1999/xhtml" Property '' is not on type: org.jboss.seam.mail.ui.UIMessage
| 22:25:41,953 ERROR [STDERR] java.lang.IllegalStateException: ICEfaces requires the PersistentFacesServlet. Please check your web.xml servlet mappings
| 22:25:41,953 ERROR [STDERR] at com.icesoft.faces.context.DOMResponseWriter.<init>(DOMResponseWriter.java:118)
| 22:25:41,953 ERROR [STDERR] at com.icesoft.faces.context.DOMContext.createTemporaryDOMResponseWriter(DOMContext.java:138)
| 22:25:41,953 ERROR [STDERR] at com.icesoft.faces.context.DOMContext.attachDOMContext(DOMContext.java:106)
| 22:25:41,953 ERROR [STDERR] at com.icesoft.faces.renderkit.dom_html_basic.TextRenderer.renderUIOutput(TextRenderer.java:81)
| 22:25:41,953 ERROR [STDERR] at com.icesoft.faces.renderkit.dom_html_basic.TextRenderer.renderEnd(TextRenderer.java:66)
| 22:25:41,968 ERROR [STDERR] at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeEnd(DomBasicRenderer.java:125)
| 22:25:41,968 ERROR [STDERR] at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:833)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.ui.util.JSF.renderChild(JSF.java:181)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.ui.util.JSF.renderChildren(JSF.java:163)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.mail.ui.MailComponent.encode(MailComponent.java:80)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.mail.ui.MailComponent.encode(MailComponent.java:54)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.mail.ui.UIBody.encodeChildren(UIBody.java:44)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.ui.util.JSF.renderChild(JSF.java:175)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.ui.util.JSF.renderChildren(JSF.java:163)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.mail.ui.UIMessage.encodeChildren(UIMessage.java:155)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.ui.util.JSF.renderChild(JSF.java:175)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.ui.util.JSF.renderChildren(JSF.java:163)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer.renderFacelet(FaceletsRenderer.java:147)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer.render(FaceletsRenderer.java:111)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.example.mail.AsynchronousMailProcessor.scheduleSend(AsynchronousMailProcessor.java:18)
| 22:25:41,968 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 22:25:41,968 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 22:25:41,968 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 22:25:41,968 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:42)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.example.mail.AsynchronousMailProcessor_$$_javassist_15.scheduleSend(AsynchronousMailProcessor_$$_javassist_15.java)
| 22:25:41,968 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 22:25:41,968 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 22:25:41,968 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 22:25:41,968 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:124)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.async.AsynchronousInvocation.call(AsynchronousInvocation.java:52)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.async.Asynchronous.executeInContexts(Asynchronous.java:76)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.async.Asynchronous.execute(Asynchronous.java:45)
| 22:25:41,968 ERROR [STDERR] at org.jboss.seam.async.TimerServiceDispatcher.dispatch(TimerServiceDispatcher.java:50)
| 22:25:41,968 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 22:25:41,968 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 22:25:41,968 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 22:25:41,968 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
| 22:25:41,968 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
| 22:25:41,968 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
| 22:25:41,968 ERROR [STDERR] at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
| 22:25:41,968 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 22:25:41,968 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
| 22:25:41,968 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 22:25:41,968 ERROR [STDERR] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
| 22:25:41,968 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 22:25:41,968 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
| 22:25:41,968 ERROR [STDERR] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
| 22:25:41,968 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 22:25:41,968 ERROR [STDERR] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
| 22:25:41,968 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 22:25:41,968 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
| 22:25:41,968 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 22:25:41,968 ERROR [STDERR] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
| 22:25:41,968 ERROR [STDERR] at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
| 22:25:41,968 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 22:25:41,968 ERROR [STDERR] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
| 22:25:41,968 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 22:25:41,968 ERROR [STDERR] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| 22:25:41,968 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 22:25:41,968 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessContainer.callTimeout(StatelessContainer.java:151)
| 22:25:41,968 ERROR [STDERR] at org.jboss.ejb.txtimer.TimerImpl$TimerTaskImpl.run(TimerImpl.java:561)
| 22:25:41,968 ERROR [STDERR] at java.util.TimerThread.mainLoop(Timer.java:512)
| 22:25:41,968 ERROR [STDERR] at java.util.TimerThread.run(Timer.java:462)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4062138#4062138
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4062138
18Â years, 9Â months
[Tomcat, HTTPD, Servlets & JSP] - @EJB injection problems for managed beans and servlets
by fobos
Hi all, i have created a SSB/EJB and access the same in my ManagedBean JSF and in a servlet using a commom lookup as:
EJBX = (EJBX)(new InitialContext().lookup("ejb/EJBX"));i mapped the name "ejb/EJBX" in jboss.xml to local interface of my EJB. this works in Managed Bean and in Servlet.
If i use:
@EJB(name= "ejb/EJBX") EJBX ejb;
in a managed bean its works fine but when try run this same code injection in a servlet the same not run, why ??
I use a jboss-4.2.0.GA.
Other question is when a try use for eg.
<ejb-local-ref>
| <ejb-ref-name>SessionEJBLocal</ejb-ref-name>
| <ejb-ref-type>Session</ejb-ref-type>
| <local>jbossjpa.model.session.SessionEJBLocal</local>
| <ejb-link>ejb/SessionEJBLocal</ejb-link>
| </ejb-local-ref>
Using a servlet version="2.5", jboss cannot deploy my application, the folowing exception is throw:
| 2007-07-09 13:43:11,926 DEBUG [org.jboss.web.tomcat.service.JBossWeb] Problem in init
| org.jboss.deployment.DeploymentException: Failed to parse WEB-INF/web.xml; - nested throwable: (org.jboss.deployment.DeploymentException: expected one local-home tag)
| at org.jboss.web.AbstractWebContainer.parseMetaData(AbstractWebContainer.java:755)
Why this error is throw ? this version of Jboss is sevlet 2.5 compatible or no ?
Thanks!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4062134#4062134
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4062134
18Â years, 9Â months