JUnitEE in OC4J 904 gives ClassNotFountException
Hi,
I try to run JUnitEE tests from a war-file generated using the ant task from JUnitEE. When I run the test, I always get a 'Class not found' message. I checked and double checked the war-file, but the class is present in the WEB-INF/classes directory.
I never had any problems with this with JBoss or WebLogic.
Why can't OC4J find the test classes ?
Regards,
Joost
It does load clases from the web-inf/classes directory.
Can you post a stacktrace?
Do you have all the classes available -- ie is it depending on some common 3rd party lib, such as xerces, etc. whic may be supplied by the other products?
I'm not intimately familiar with JUnitEE, are the framework classes available somewhere for the server?
Another thing to try is changing the classloader precedence so webapp classes are loaded FIRST from web-inf/*. This can be done by altering a setting in the orion-web.xml generated for your application (see j2ee/home/application-deployments/<app-name>/<webmodule-name>.
You'll see a tag to uncomment which sets this behaviour.
<!-- Uncomment this element to control web application class loader behavior.
<web-app-class-loader search-local-classes-first="true" include-war-manifest-class-path="true" />
-->cheers
-steve-
Similar Messages
-
OC4J 904 and Unicode(AL16UTF16) in NVARCHAR2 column
I have:
OC4J 904 standalone runs on Windows2000 AdvancedServer.
Oracle 9i
JDBC thin driver shipped with OC4J
NLS_NCHAR_CHARSET = AL16UTF16
(NLS_CHARACTERSET = VN8VN3)
I have a table with a NVARCHAR2 column. I created a CMP EJB from the table but I can't use the EJB to retreive data from Database. I was success in using Oracle JDBC connection to connect manually to database and save/retreive Unicode data.
I read somewhere that EJB use thin driver, so the getter/setter of CMP-Fields should work normally.
I think that may be the problems is the function OraclePreparedStatement.setFormOfUse(1,OraclePreparedStatement.FORM_NCHAR);
was not called in the EJB Contenner or things like that - so it's a bug of OC4J, right?.
This is the Exception I received on the browser.
javax.ejb.NoSuchObjectLocalException: ? ?ÃY CÃ CH? HOA CÃ D?U!!!!!
at TestLocal_EntityBeanWrapper0.reActivateNew(TestLocal_EntityBeanWrapper0.java:1668)
at TestLocal_EntityBeanWrapper0.reActivateNewLocal(TestLocal_EntityBeanWrapper0.java:1636)
at TestLocal_EntityBeanWrapper0.getUnicode(TestLocal_EntityBeanWrapper0.java:108)
at test.showparam._jspService(_showparam.java:100)
[SRC:/test/showparam.jsp:65]
at com.orionserver[Oracle9iAS (9.0.4.0.0) Containers for J2EE].http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:348)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:498)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:402)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind[Oracle9iAS (9.0.4.0.0) Containers for J2EE].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:293)
at com.evermind[Oracle9iAS (9.0.4.0.0) Containers for J2EE].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:602)
at com.evermind[Oracle9iAS (9.0.4.0.0) Containers for J2EE].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:308)
at com.evermind[Oracle9iAS (9.0.4.0.0) Containers for J2EE].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:779)
at com.evermind[Oracle9iAS (9.0.4.0.0) Containers for J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:264)
at com.evermind[Oracle9iAS (9.0.4.0.0) Containers for J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:107)
at com.evermind[Oracle9iAS (9.0.4.0.0) Containers for J2EE].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
at java.lang.Thread.run(Thread.java:536)
Can anybody help or give me some information or workaround?
Thank you very much.Hi Nghia,
Can anybody help or give me some information or
workaround? I suggest using BMP and a non-emulated data source. More details are available in the documentation which can be downloaded from here:
http://technet.oracle.com/tech/java/oc4j/904/documentation_preview.html
Good Luck,
Avi. -
I want to disable beans reload when recompiling while OC4J is running.
Have set the following in orion-web.xml :
<orion-web-app
deployment-version="9.0.4.0.0"
jsp-cache-directory="./persistence"
temporary-directory="./temp"
development="false"
autoreload-jsp-beans="false"
autoreload-jsp-pages="true"
>
But OC4J is still trying to reload reompiled beans... unsuccessfully.
Any clue ?Hi Nghia,
Can anybody help or give me some information or
workaround? I suggest using BMP and a non-emulated data source. More details are available in the documentation which can be downloaded from here:
http://technet.oracle.com/tech/java/oc4j/904/documentation_preview.html
Good Luck,
Avi. -
JHS 1012 with Standalone OC4J 904
Has anyone got this to work? I can deploy JHS 10.1.2 to standalone OC4J 10.1.2 (without ADF runtime installed) but standalone 9.0.4 OC4J gives an HTTP 500 error (without ADF runtime installed, no additional messages appear; with ADF runtime installed yields this: java.lang.NoSuchMethodError: int java.lang.StringBuffer.indexOf(java.lang.String)java.lang.Object oracle.adf.model.binding.DCUtil.findContextObject(oracle.adf.model.BindingContext, java.lang.String)
DCUtil.java:293).
These results are after applying the workaround for iAS 9.0.4 on Steve Muench's blog at: http://radio.weblogs.com/0118231/stories/2005/05/27/workaroundForDeployingAdf1012AppUsingIntermediaDomainsToOracleAs904.htmlHere are some details about the solution:
1. In the j2ee\home\config\application.xml file, remove all references to libraries from the bottom of the file, such as:
<library path="../../../ord/jlib/ordim.jar"/>2. Add the following libaries to the project properties for the ViewController project
- ADF Web Runtime
- ADF Toplink Runtime
- Oracle Intermedia JClient
3. Create a WAR deployment profile for the ViewController project. In the WEB-INF\lib node of the File Groups node in the properties, select all libraries. Click OK and deploy the file to an EAR file using the right click menu on that deployment profile.
4. Copy the EAR file to the j2ee\home\applications manually and add entries in the server.xml and http-web-site.xml. See entries that JDeveloper adds when you do right-click deployments to the server for the pattern.
5. Bounce the OC4J server (if it did not pick up the new application).
Note: The steps above load more libraries than are needed. The following list has also been proven to work but it still may be more than is needed.
adf-controller.jar
adfm.jar
adfmtl.jar
adfmweb.jar
adftags.jar
bc4jct.jar
bc4jdomorcl.jar
bc4jhtml.jar
bc4jimdomains.jar
bc4jmt.jar
bc4juixtags.jar
classes12.jar
collections.jar
commons-beanutils.jar
commons-collections.jar
commons-digester.jar
commons-el.jar
commons-fileupload.jar
commons-lang.jar
commons-logging.jar
commons-logging.jar
commons-validator.jar
datatags.jar
graphtags.jar
jakarta-oro.jar
jaxen-full.jar
jhsadfrt.jar
jdev-cm.jar
ojmisc.jar
ordhttp.jar
ordim.jar
jsp-el-api.jar
jstl.jar
log4j-1.2.7.jar
nls_charset12.jar
oracle-el.jar
regexp.jar
saxpath.jar
share.jar
standard.jar
struts.jar
uix2.jar
uixadfrt.jar
xalan.jar -
JDeveloper 903 with OC4J 904 container
I have JDeveloper 9.0.3 with OC4J container 9.0.4.
Is this an oracle supported configuration?In it I have some problem.
Not stable Run of the project in Jdev 9.0.3.2 (c embedded OC4J 9.0.4)
Thanks
Alexandre -
Oracle OC4J 904 and JNDI environment variable lookup up
Hi all, we are getting this when trying to run our app in Oracle 904:
org.springframework.beans.factory.access.BootstrapException: Define an environment variable [java:comp/env/ejb/BeanFactoryPath] containing the class path locations of XML bean definition files; nested exception is javax.naming.NameNotFoundException: No object bound for java:comp/env/ejb/BeanFactoryPath
javax.naming.NameNotFoundException: No object bound for java:comp/env/ejb/BeanFactoryPath
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:116)
at javax.naming.InitialContext.lookup(InitialContext.java:345)
at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:123)
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:85)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:121)
at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:71)
at org.springframework.context.access.ContextJndiBeanFactoryLocator.useBeanFactory(ContextJndiBeanFactoryLocator.java:64)
at org.springframework.ejb.support.AbstractEnterpriseBean.loadBeanFactory(AbstractEnterpriseBean.java:117)
at org.springframework.ejb.support.AbstractStatelessSessionBean.ejbCreate(AbstractStatelessSessionBean.java:63)
at MethodInvokerHome_StatelessSessionHomeWrapper1.callCreate(MethodInvokerHome_StatelessSessionHomeWrapper1.java:115)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.ejb.StatelessSessionEJBHome.getContextInstance(StatelessSessionEJBHome.java:275)
at MethodInvokerRemote_StatelessSessionBeanWrapper0.invoke(MethodInvokerRemote_StatelessSessionBeanWrapper0.java:77)
at java.lang.reflect.Method.invoke(Native Method)
at org.springframework.remoting.rmi.RmiClientInterceptorUtils.doInvoke(RmiClientInterceptorUtils.java:103)
at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.doInvoke(SimpleRemoteSlsbInvokerInterceptor
Basically the app server thinks there is no environment entry but I have it declared in ejb-jar.xml descriptor:
<env-entry>
<env-entry-name>ejb/BeanFactoryPath</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>applicationContext.prod.xml</env-entry-value>
</env-entry>
Any ideas,
JThat depends of the shell that you use.
If you use the bash than execute:
EXPORT ORACLE_SID=<YOUR_SID>
If you use csh:
setenv ORACLE_SID <YOUR_SID>
Bye, Aron -
Error starting up OC4J Standalone 904
I'm getting the following error when starting up an OC4J 904 standalone (/j2ee/home/java -jar oc4j.jar) I get this error on both my Windows 2000 environment and Solaris. Any ideas?
04/02/19 10:29:07 Error creating Tag Library Descriptor Cache : null
04/02/19 10:29:07 java.lang.ExceptionInInitializerError
04/02/19 10:29:07 at sun.reflect.NativeConstructorAccessorImpl.newInstance
0(Native Method)
04/02/19 10:29:07 at sun.reflect.NativeConstructorAccessorImpl.newInstance
(NativeConstructorAccessorImpl.java:39)
04/02/19 10:29:07 at sun.reflect.DelegatingConstructorAccessorImpl.newInst
ance(DelegatingConstructorAccessorImpl.java:27)
04/02/19 10:29:07 at java.lang.reflect.Constructor.newInstance(Constructor
.java:274)
04/02/19 10:29:07 at java.lang.Class.newInstance0(Class.java:306)
04/02/19 10:29:07 at java.lang.Class.newInstance(Class.java:259)
04/02/19 10:29:07 at oracle.jsp.parse.XMLUtil.elemToTagInfo(XMLUtil.java:1
278)
04/02/19 10:29:07 at oracle.jsp.parse.XMLUtil.domDocToTagLib(XMLUtil.java:
1063)
04/02/19 10:29:07 at oracle.jsp.parse.tldcache.TldUtil.getTlibInfo(TldUtil
.java:225)
04/02/19 10:29:07 at oracle.jsp.parse.tldcache.CachedTldImpl.findUriAttrib
ute(CachedTldImpl.java:189)
04/02/19 10:29:07 at oracle.jsp.parse.tldcache.CachedTldImpl.getTldInfo(Ca
chedTldImpl.java:138)
04/02/19 10:29:07 at oracle.jsp.parse.tldcache.CachedTldImpl.<init>(Cached
TldImpl.java:92)
04/02/19 10:29:07 at oracle.jsp.parse.tldcache.TldResourceImpl.buildTlds(T
ldResourceImpl.java:132)
04/02/19 10:29:07 at oracle.jsp.parse.tldcache.TldCacheImpl.applyInserts(T
ldCacheImpl.java:292)
04/02/19 10:29:07 at oracle.jsp.parse.tldcache.TldCacheImpl.updateCache(Tl
dCacheImpl.java:281)
04/02/19 10:29:07 at oracle.jsp.parse.tldcache.ApplicationTldCacheImpl.<in
it>(ApplicationTldCacheImpl.java:62)
04/02/19 10:29:07 at com.evermind.server.http.HttpApplication.initDefaultS
ervlets(HttpApplication.java:4835)
04/02/19 10:29:07 at com.evermind.server.http.HttpApplication.initDynamic(
HttpApplication.java:701)
04/02/19 10:29:07 at com.evermind.server.http.HttpApplication.<init>(HttpA
pplication.java:497)
04/02/19 10:29:07 at com.evermind.server.Application.getHttpApplication(Ap
plication.java:886)
04/02/19 10:29:07 at com.evermind.server.http.HttpServer.getHttpApplicatio
n(HttpServer.java:688)
04/02/19 10:29:07 at com.evermind.server.http.HttpSite.initApplications(Ht
tpSite.java:570)
04/02/19 10:29:07 at com.evermind.server.http.HttpSite.setConfig(HttpSite.
java:263)
04/02/19 10:29:07 at com.evermind.server.http.HttpServer.setSites(HttpServ
er.java:259)
04/02/19 10:29:07 at com.evermind.server.http.HttpServer.setConfig(HttpSer
ver.java:160)
04/02/19 10:29:07 at com.evermind.server.ApplicationServer.initializeHttp(
ApplicationServer.java:2325)
04/02/19 10:29:07 at com.evermind.server.ApplicationServer.setConfig(Appli
cationServer.java:1498)
04/02/19 10:29:07 at com.evermind.server.ApplicationServerLauncher.run(App
licationServerLauncher.java:93)
04/02/19 10:29:07 at java.lang.Thread.run(Thread.java:536)
04/02/19 10:29:07 Caused by: java.util.MissingResourceException: Can't find bund
le for base name oracle.webdb.service.resource.PortalBundle, locale en_US
04/02/19 10:29:07 at java.util.ResourceBundle.throwMissingResourceExceptio
n(ResourceBundle.java:804)
04/02/19 10:29:07 at java.util.ResourceBundle.getBundleImpl(ResourceBundle
.java:773)
04/02/19 10:29:07 at java.util.ResourceBundle.getBundle(ResourceBundle.jav
a:511)
04/02/19 10:29:07 at oracle.webdb.service.tagext.PortletTagExtraInfo.<clin
it>(Unknown Source)
04/02/19 10:29:07 ... 29 more
04/02/19 10:29:07 JspTagLibListener error : null
04/02/19 10:29:08 Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)
initializedfyi: all these problems seem to have gone away since I upgraded to JDK 1.4.1_02 and reinstalled.
--matt -
How to deploy an application in OC4J standalone?
I'm trying to deploy Jspell 2004 in a standalone OC4J 10g. All my attempts have failed thus far, as I admit, I don't really know what I am doing.
I've found several articles, including those from Jspell, and they all start with 'deploy the war file' but how?
I don't know where I should deploy the WAR file or exaclty which config files I need to modify. I've tried under OH/j2ee/home/applications, OH/j2ee/DevSuite/application-deployments and always get the 'Error instantiating web-application' no application found on server.'
I'm using the OC4J strictly for forms/reports running on port 8889 and that all works fine. When I start the OC4J, it is referencing the server.xml file in the DevSuite/config folder.
Any ideas?Please look at the OC4J FAQ
http://www.oracle.com/technology/tech/java/oc4j/904/collateral/oc4j-faq-904.html#oc4j_deploy
Yes. If you wish to deploy only a Web module then you can utilize the default application OC4J is configured with. This is a two step task:
First, tell the container about the WAR file to be deployed. Open the <J2EE_HOME>/config/application.xml file in an editor. Add a new <web-module> tag and specify the attributes for your WAR file.
<web-module id="HRWebModule" path="<PATH-TO-WAR-FILE>"/>
Secondly, tell the OC4J HTTP server about the new WAR file and provide a URL to access it. Open the <J2EE_HOME>/config/http-web-site.xml file in an editor. Add a new <web-app> tag and specify the attributes for your new Web module. It's important to note that the application attribute must specified as "default" since you have deployed your Web module to the default application. The name attribute should match the ID attribute you specified for the Web module.
<web-app application="default" name="HRWebModule" root="/hrweb" />
The WAR file will now be deployed by OC4J and accessible using a URL of /hrweb.
-Debu
http://debupanda.com -
Help - using custom login module with embedded jdev oc4j to access ejb 3
Hi All (Frank ??),
I'm just wondering if anyone has successfully been able to leverage a custom login module in combination
with a client that connects to a local EJB 3 stateless session bean through Jdeveloper 10.1.3.2's embedded oc4j.
I have spent 2+ days trying to get this to work - and i think I resound now to the fact im going to
have to deploy to oc4j standalone instead.
I got close.. but finally was trumped with the following error from the client trying to access the ejb:-
javax.naming.NoPermissionException: Not allowed to look up XXXXXX, check the namespace-access tag
setting in orion-application.xml for details.
Using the various guides available, I had no problem getting the custom login module working
with a local servlet running from JDev's embedded oc4j.. however with ejb - no such luck.
I have a roles table (possible values Member, Admin) - that maps to sr_Member and sr_Admin
respectively in various config files.
I'm using EJB 3 annotations for protecting methods .. for example
@RolesAllowed("sr_Member")
Steps that I had to do so far :-
In <jdevhome>\jdev\system\oracle.jwee.10.1.3.40.66\embedded-oc4j\config\system-jazn-data.xml1) Add custom login module
<application>
<name>current-workspace-app</name>
<login-modules>
<login-module>
<class>kr.security.KnowRushLoginModule</class>
<control-flag>required</control-flag>
<options>
<option>
<name>dataSource</name>
<value>jdbc/DB_XE_KNOWRUSHDS</value>
</option>
<option>
<name>user.table</name>
<value>users</value>
</option>
<option>
<name>user.pk.column</name>
<value>id</value>
</option>
<option>
<name>user.name.column</name>
<value>email_address</value>
</option>
<option>
<name>user.password.column</name>
<value>password</value>
</option>
<option>
<name>role.table</name>
<value>roles</value>
</option>
<option>
<name>role.to.user.fk.column</name>
<value>user_id</value>
</option>
<option>
<name>role.name.column</name>
<value>name</value>
</option>
</options>
</login-module>
</login-modules>
</application>2) Grant login rmi permission to roles associated with custom login module (also in system-jazn-data.xml)
<grant>
<grantee>
<principals>
<principal>
<realm-name>jazn.com</realm-name>
<type>role</type>
<class>kr.security.principals.KRRolePrincipal</class>
<name>Admin</name>
</principal>
</principals>
</grantee>
<permissions>
<permission>
<class>com.evermind.server.rmi.RMIPermission</class>
<name>login</name>
</permission>
</permissions>
</grant>
<grant>
<grantee>
<principals>
<principal>
<realm-name>jazn.com</realm-name>
<type>role</type>
<class>kr.security.principals.KRRolePrincipal</class>
<name>Member</name>
</principal>
</principals>
</grantee>
<permissions>
<permission>
<class>com.evermind.server.rmi.RMIPermission</class>
<name>login</name>
</permission>
</permissions>
</grant>3) I've tried creating various oracle and j2ee deployment descriptors (even though ejb-jar.xml and orion-ejb-jar.xml get created automatically when running the session bean in jdev).
My ejb-jar.xml contains :-
<?xml version="1.0" encoding="utf-8"?>
<ejb-jar xmlns ....
<assembly-descriptor>
<security-role>
<role-name>sr_Admin</role-name>
</security-role>
<security-role>
<role-name>sr_Member</role-name>
</security-role>
</assembly-descriptor>
</ejb-jar>Note- i'm not specifying the enterprise-beans stuff, as JDev seems to populate this automatically.
My orion-ejb-jar.xml contains ...
<?xml version="1.0" encoding="utf-8"?>
<orion-ejb-jar ...
<assembly-descriptor>
<security-role-mapping name="sr_Admin">
<group name="Admin"></group>
</security-role-mapping>
<security-role-mapping name="sr_Member">
<group name="Member"></group>
</security-role-mapping>
<default-method-access>
<security-role-mapping name="sr_Member" impliesAll="true">
</security-role-mapping>
</default-method-access>
</assembly-descriptor>My orion-application.xml contains ...
<?xml version="1.0" encoding="utf-8"?>
<orion-application xmlns ...
<security-role-mapping name="sr_Admin">
<group name="Admin"></group>
</security-role-mapping>
<security-role-mapping name="sr_Member">
<group name="Member"></group>
</security-role-mapping>
<jazn provider="XML">
<property name="role.mapping.dynamic" value="true"></property>
<property name="custom.loginmodule.provider" value="true"></property>
</jazn>
<namespace-access>
<read-access>
<namespace-resource root="">
<security-role-mapping name="sr_Admin">
<group name="Admin"/>
<group name="Member"/>
</security-role-mapping>
</namespace-resource>
</read-access>
<write-access>
<namespace-resource root="">
<security-role-mapping name="sr_Admin">
<group name="Admin"/>
<group name="Member"/>
</security-role-mapping>
</namespace-resource>
</write-access>
</namespace-access>
</orion-application>My essentially auto-generated EJB 3 client does the following :-
Hashtable env = new Hashtable();
env.put(Context.SECURITY_PRINCIPAL, "matt.shannon");
env.put(Context.SECURITY_CREDENTIALS, "welcome1");
final Context context = new InitialContext(env);
KRFacade kRFacade = (KRFacade)context.lookup("KRFacade");
...And throws the error
20/04/2007 00:55:37 oracle.j2ee.rmi.RMIMessages
EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER
WARNING: Exception returned by remote server: {0}
javax.naming.NoPermissionException: Not allowed to look
up KRFacade, check the namespace-access tag setting in
orion-application.xml for details
at
com.evermind.server.rmi.RMIClientConnection.handleLookupRe
sponse(RMIClientConnection.java:819)
at
com.evermind.server.rmi.RMIClientConnection.handleOrmiComm
andResponse(RMIClientConnection.java:283)
....I can see from the console that the user was successfully authenticated :-
20/04/2007 00:55:37 kr.security.KnowRushLoginModule validate
WARNING: [KnowRushLoginModule] User matt.shannon authenticated
And that user is granted both the Admin, and Member roles.
The test servlet using basic authentication correctly detects the user and roles perfectly...
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
LOGGER.log(Level.INFO,LOGPREFIX +"doGet called");
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head><title>ExampleServlet</title></head>");
out.println("<body>");
out.println("<p>The servlet has received a GET. This is the reply.</p>");
out.println("<br> getRemoteUser = " + request.getRemoteUser());
out.println("<br> getUserPrincipal = " + request.getUserPrincipal());
out.println("<br> isUserInRole('sr_Admin') = "+request.isUserInRole("sr_Admin"));
out.println("<br> isUserInRole('sr_Memeber') = "+request.isUserInRole("sr_Member"));Anyone got any ideas what could be going wrong?
cheers
Matt.
Message was edited by:
mshannonThanks for the response. I checked out your blog and tried your suggestions. I'm sure it works well in standalone OC4J, but i was still unable to get it to function correctly from JDeveloper embedded.
Did you ever get the code working directly from JDeveloper?
Your custom code essentially seems to be the equivalent of a grant within system-jazn-data.xml.
For example, the following grant to a custom jaas role (JAAS_ADMIN) that gets added by my custom login module gives them rmi login access :-
<grant>
<grantee>
<principals>
<principal>
<realm-name>jazn.com</realm-name>
<type>role</type>
<class>kr.security.principals.KRRolePrincipal</class>
<name>JAAS_Admin</name>
</principal>
</principals>
</grantee>
<permissions>
<permission>
<class>com.evermind.server.rmi.RMIPermission</class>
<name>login</name>
</permission>
</permissions>
</grant>If I add the following to orion-application.xml
<!-- Granting login permission to users accessing this EJB. -->
<namespace-access>
<read-access>
<namespace-resource root="">
<security-role-mapping>
<group name="JAAS_Admin"></group>
</security-role-mapping>
</namespace-resource>
</read-access>Running a standalone client against the embedded jdev oc4j server gives the namespace-access error.
I tried out your code by essentially creating a static reference to a singleton class that does the role lookup/provisioning with rmi login grant :-
From custom login module :-
private static KRSecurityHelper singleton = new KRSecurityHelper();
protected Principal[] m_Principals;
Vector v = new Vector();
v.add(singleton.getCustomRmiConnectRole());
// set principals in LoginModule
m_Principals=(Principal[]) v.toArray(new Principal[v.size()]);
Singleton class :-
package kr.security;
import com.evermind.server.rmi.RMIPermission;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.security.jazn.JAZNConfig;
import oracle.security.jazn.policy.Grantee;
import oracle.security.jazn.realm.Realm;
import oracle.security.jazn.realm.RealmManager;
import oracle.security.jazn.realm.RealmRole;
import oracle.security.jazn.realm.RoleManager;
import oracle.security.jazn.policy.JAZNPolicy;
import oracle.security.jazn.JAZNException;
public class KRSecurityHelper
private static final Logger LOGGER = Logger.getLogger("kr.security");
private static final String LOGPREFIX = "[KRSecurityHelper] ";
public static String CUSTOM_RMI_CONNECT_ROLE = "remote_connect";
private RealmRole m_Role = null;
public KRSecurityHelper()
LOGGER.log(Level.FINEST,LOGPREFIX +"calling JAZNConfig.getJAZNConfig");
JAZNConfig jc = JAZNConfig.getJAZNConfig();
LOGGER.log(Level.FINEST,LOGPREFIX +"calling jc.getRealmManager");
RealmManager realmMgr = jc.getRealmManager();
try
// Get the default realm .. e.g. jazn.com
LOGGER.log(Level.FINEST,LOGPREFIX +"calling jc.getGetDefaultRealm");
Realm r = realmMgr.getRealm(jc.getDefaultRealm());
LOGGER.log(Level.INFO,LOGPREFIX +"default realm: "+r.getName());
// Access the role manager for the remote connection role
LOGGER.log(Level.FINEST,
LOGPREFIX +"calling default_realm.getRoleManager");
RoleManager roleMgr = r.getRoleManager();
LOGGER.log(Level.INFO,LOGPREFIX +"looking up custom role '"
CUSTOM_RMI_CONNECT_ROLE "'");
RealmRole rmiConnectRole = roleMgr.getRole(CUSTOM_RMI_CONNECT_ROLE);
if (rmiConnectRole == null)
LOGGER.log(Level.INFO,LOGPREFIX +"role does not exist, create it...");
rmiConnectRole = roleMgr.createRole(CUSTOM_RMI_CONNECT_ROLE);
LOGGER.log(Level.FINEST,LOGPREFIX +"constructing new grantee");
Grantee gtee = new Grantee(rmiConnectRole);
LOGGER.log(Level.FINEST,LOGPREFIX +"constructing login rmi permission");
RMIPermission login = new RMIPermission("login");
LOGGER.log(Level.FINEST,
LOGPREFIX +"constructing subject.propagation rmi permission");
RMIPermission subjectprop = new RMIPermission("subject.propagation");
// make policy changes
LOGGER.log(Level.FINEST,LOGPREFIX +"calling jc.getPolicy");
JAZNPolicy policy = jc.getPolicy();
if (policy != null)
LOGGER.log(Level.INFO, LOGPREFIX
+ "add to policy grant for RMI 'login' permission to "
+ CUSTOM_RMI_CONNECT_ROLE);
policy.grant(gtee, login);
LOGGER.log(Level.INFO, LOGPREFIX
+ "add to policy grant for RMI 'subject.propagation' permission to "
+ CUSTOM_RMI_CONNECT_ROLE);
policy.grant(gtee, subjectprop);
// m_Role = rmiConnectRole;
m_Role = roleMgr.getRole(CUSTOM_RMI_CONNECT_ROLE);
LOGGER.log(Level.INFO, LOGPREFIX
+ m_Role.getName() + ":" + m_Role.getFullName() + ":" + m_Role.getFullName());
else
LOGGER.log(Level.WARNING,LOGPREFIX +"Cannot find jazn policy!");
else
LOGGER.log(Level.INFO,LOGPREFIX +"custom role already exists");
m_Role = rmiConnectRole;
catch (JAZNException e)
LOGGER.log(Level.WARNING,
LOGPREFIX +"Cannot configure JAZN for remote connections");
public RealmRole getCustomRmiConnectRole()
return m_Role;
}Using the code approach and switching application.xml across so that namespace access is for the group remote_connect, I get the following error from my bean :-
INFO: Login permission not granted for current-workspace-app (test.user)
Thus, the login permission that I'm adding through the custom remote_connect role does not seem to work. Even if it did, i'm pretty sure I would still get that namespace error.
This has been such a frustrating process. All the custom login module samples using embedded JDeveloper show simple j2ee servlet protection based on settings in web.xml.
There are no samples showing jdeveloper embedded oc4j using ejb with custom login modules.
Hopefully the oc4j jdev gurus like Frank can write a paper that demonstrates this.
Matt. -
Hello, All!
I use JDeveloper 9.0.3.2 and embedded OC4J 9.0.4.
But frequently, at Run project, embedded OC4J (9.0.4) startup occurs to a mistake:
Target URL -- http://192.168.1.104:8989/Log/index.html
Copying default deployment descriptor from archive at C:\Work\PS_FRAMEWORK\classes/META-INF/orion-ejb-jar.xml to deployment directory C:\jdev9032_2_oc4j904\jdev\system9.0.3.2.1145\oc4j-config\application-deployments\current-workspace-app\classes...
Auto-deploying file:/C:/Work/PS_FRAMEWORK/classes/ (No previous deployment found)... done.
Auto-deploying PS-tests (New server version detected)...
Auto-deploying PS-tests (New server version detected)...
Error initializing server: Error loading web-app 'Log' at C:\Work\PS_FRAMEWORK\web\framework: Error writing orion-descriptor: C:\jdev9032_2_oc4j904\jdev\system9.0.3.2.1145\oc4j-config\application-deployments\current-workspace-app\Log\orion-web.xml
Process exited with exit code 1.
Repeating it a few times, it is possible in a result to receive required, i.e.
Oracle9iAS (9.0.4.0.0) Containers for J2EE initialized.
Whether somebody met something similar and how it to correct?
Thanks
Alexandre.You might find the sample code which is part of OC4J-howto's useful.
http://otn.oracle.com/tech/java/oc4j/904/index.html
http://otn.oracle.com/tech/java/oc4j/904/how_to/how-to-ejb-mdb.zip
raghu
JDev Team -
OC4J Fail to Start - Address in Use
I installed Oracle9iR1 in my Server Windows2000 Terminal Server Edition, and the Oracle9iDS in my computer Windows2000 Professional update to Patch 2. When ever I tried to start OC4J it give me this message:
C:\>f:\ninphas\DB\Developer\jdk\bin\java -Dorg.omg.CORBA.ORBClass=com.inprise.vb
roker.orb.ORB -Dorg.omg.CORBA.ORBSingletonClass=com.inprise.vbroker.orb.ORB -Dor
acle.security.jazn.config=f:\ninphas\DB\Developer\j2ee\Oracle9iDS\config\jazn.xm
l -Doracle.home=f:\ninphas\DB\Developer -DORACLE_HOME=f:\ninphas\DB\Developer -j
ar f:\ninphas\DB\Developer\j2ee\home\oc4j.jar -userThreads -config f:\ninphas\DB
\Developer\j2ee\Oracle9iDS\config\server.xml
Error starting HTTP-Server: Address in use: JVM_BindOracle9iAS (9.0.2.0.0) Containers for J2EE initialized
Any clue???
P.D.: I have Omnicron HTTP Server Runing in my computer
Jose Cleto
NinphasJose,
the following ports are used by OC4J in iDS
HTTP: 8888 (defined in http-web-site.xml)
RMI : 23791 (rmi.xml)
JMS : 9127 (jms.xml)
is one of these ports taken by another server ?
Frank -
CMP beans in OC4J 9.0.4.
Hi all,
I 've download the oracle sample demo "CMP Entity bean" and deploy it under OC4J 9.0.4.
While running the client i get the following exception in OC4J :
java.lang.NullPointerException
at com.evermind.server.ejb.RemoteDBEntityEJBObject.getPrimaryKey_X(RemoteDBEntityEJBObject.java:39)
at com.evermind.server.ejb.EJBRemoteInvocationHandlerFactory.getObjectInfo(EJBRemoteInvocationHandlerFactory.java:76)
at com.evermind.server.rmi.RMIOutputStream.replaceObject(RMIOutputStream.java:82)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:323)
at com.evermind.server.rmi.RMIOutputStream.writeType(RMIOutputStream.java:166)
at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:167)
at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:48)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
at java.lang.Thread.run(Thread.java:484)
It seems to occurs when OC4J is trying to update an already created rows.
Thanks a lot for any piece of advice.
R�my.Marcel -- the known-issues document for the 904 release describes how to workaround this issue.
http://otn.oracle.com/tech/java/oc4j/904/release_notes/release-notes-904-preview.html
Custom User Managers Deployed within EJB-JAR Files can not be found.
OC4J is not able to load customer user managers when they are packaged within an EJB-JAR file.
The workaround is to add an explicit <library> element to the orion-application.xml file for the application which points at the EJB-JAR file containing the custom user manager classes. This will allow the custom user manager to be resolved and instantiated.
<orion-application ....>
<library path="d:\oc4j904\j2ee\home\applications\XmlnewsEar\XmlnewsEjb.jar"/>
</orion-application>
cheers
-steve- -
Deployment problem in OC4J 9.0.4
We try to deploy our application to OC4J 9.0.4 and have following problem with deployment:
Error instantiating application 'elpos' at file:/C:/oc4j9.0.4/j2ee/home/applications/elpos-app.ear: UserManager class 'com.abilitydev.usermanager.orion.ServiceBasedUserManager' not found
The application deploys and runs correctly on 9.0.3 release. The user manager class is inside EJB module jar file.
Thanks for any comments.
Marcel StrakaMarcel -- the known-issues document for the 904 release describes how to workaround this issue.
http://otn.oracle.com/tech/java/oc4j/904/release_notes/release-notes-904-preview.html
Custom User Managers Deployed within EJB-JAR Files can not be found.
OC4J is not able to load customer user managers when they are packaged within an EJB-JAR file.
The workaround is to add an explicit <library> element to the orion-application.xml file for the application which points at the EJB-JAR file containing the custom user manager classes. This will allow the custom user manager to be resolved and instantiated.
<orion-application ....>
<library path="d:\oc4j904\j2ee\home\applications\XmlnewsEar\XmlnewsEjb.jar"/>
</orion-application>
cheers
-steve- -
http://otn.oracle.com/software/htdocs/devlic.html?http://download.oracle.com/otn/java/oc4j/904/preview/oc4j_extended.zip
i have download oc4j_904 by link http://download.oracle.com/otn/java/oc4j/904/preview/oc4j_extended.ziphttp://otn.oracle.com/software/htdocs/devlic.html?http://download.oracle.com/otn/java/oc4j/904/preview/oc4j_extended.zip
i have download oc4j_904 by link http://download.oracle.com/otn/java/oc4j/904/preview/oc4j_extended.zip -
Oc4j starting with Oracle Database & oc4j App Server on same machine
Hi ALL, can anybody help me(pls read this)
This is Sagar, i have created a GIS Application(java) using Oracle 10g.
Senario I:
oc4j server and oracle 10g Database Server on different machines:
When i start oc4j server with NO. OF Mappers = 64 or 30 in DNS using
1. oc4j -start (normally)
from the path c:/oc4j/bin by setting ORACLE_HOME path normally
application is working fine but when users are increased say 4 to 5 oc4j server gives error:
java.lang.OutOfMemoryError: Java Heap Space
I searched for this error i found a solution for starting oc4j as follows:
2.Java -Xmx1024m -Xms1024m -jar oc4j.jar
from the path c:/oc4j/j2ee/home --- oc4j.jar
Then map & application works fine and fast since heap space is increased to 1GB (speed is noticable)
but if...(in other senario)
Senario II:
oc4j server and oracle 10g Database Server on same machine:
if step 2: is used form above senario, oc4j Server does not gets started only it gets initialized...(server does not gets started)
but Step 1: is used application works fine but again heap space error as mentioned above is seen.
Again if changes are made in oc4j.cmd file in c:/oc4j/bin ....by giving the heap space command oc4j works fine but the application(performance) is very very slow but heap space error is not seen.
Please can any body suggest the solution.. application should work fast and also the heap space should be increased but taking the senario - oc4j App Server & Oracle 10g Database Server on Same machine..Hello,
How much RAM do you have on the machine? What is the size of the SGA for the database you are using?
if step 2: is used form above senario, oc4j Server does not gets started only it gets >initialized...(server does not gets started)What do you mean by this? Provide the output from the server when you start your server.
Maybe you are looking for
-
Java application - build JAR file & include JCO library
Hello everyone, I have a problem with my Java application that <i>connects to SAP system using JCO </i>library <b>(sapjco.jar)</b>. I would like to create a JAR file from my Java application but when I run the JAR file that I created I get an error t
-
Payment received from *Excise Department*
All SAP Gurus, We have received some payment from Excise Department. Now, how to create this entry in SAP? Regards,
-
Fields only on the last page of a report
Hello everybody, I have a report region1, the report can contain many records thus I will have to paginate it.... In the same page, I must have another region2 with some fields on it, but theses fields must appear only on the last page of my report,
-
Ethernet was gone suddenly.
Hello everyone: I'm experiencing a strange phenomenon which began yesterday. I have three macs in my home; 1 mac mini, 1 mac mini server, and 1 macbook (pro). They were purchased within 1 year, and softwares were updated recently. Until the event, th
-
Multiple Dropdowns Email Multiple Recipients
Hi, I am trying to get 3 different dropdown menus to determine the multiple recipients of a submitted form. I can't seem to get them all to work at once, ...only one or another. This is the click event script I am using on the Submit button. Could so