[Beginners Corner] - Access scoped / isoloated bean from a sar
by newgro
Hi *,
i already read alot of faqs, tutorials and threads. But i didn't found an appropriate solution.
I run 2 applications within one server (default). Bot are packaged as an ear. Both applications are based upon a little framework (located in framework.jar packaged in both ears). The framework.jar contains the interfaces for the beans.
I added a jboss-app.xml with the loader-repository tag to isolate both applications. Everything works fine.
Now i have written a Scheduler-MBean (deployed in a sar file). This should backup my database files at an appropriate date. But i can't access the backup-bean within the application-ear. Is there a solution for this?
| server.../deploy
| |-- applA.ear
| | |-- META-INF/jboss-app.xml
| | |-- META-INF/...
| | |-- application.xml
| | |-- framework.jar
| | |-- beansA.jar
| |-- applB.ear
| | |-- META-INF/jboss-app.xml
| | |-- META-INF/...
| | |-- application.xml
| | |-- framework.jar
| | |-- beansB.jar
| |-- deploy.last
| | |-- backupA-timer.sar
| | |-- jboss-service.xml
| | |-- my/BackupASchedulable.class
| | |-- framework.jar
|
I get a ClassCastException. I know already that the isolated ears are loaded within different ClassLoaders. But how can i access the beans from classes in my sar?
Thanks for helping me
Cheers
Per
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4011269#4011269
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4011269
19Â years, 2Â months
[JBoss jBPM] - Concurrent task acquisition (how?)
by Johan.Parent
I know the topic has been discussed frequently in this forum but I can't find the answer I'm looking for.
My question is: How to handle the concurrent access to a task assigned to an actor pool?
findPoolTaskInstance(actorId) will return all the tasks assigned to any pool the actor is a member of. But as long as you don't use setActorId() the task is not assigned. Concurrent access to the same task instance (taken from the list return by findPoolTaskInstance) will result in an exception when the data gets persisted in the DB for processes which did not set their actorId succesfully.
| protected boolean acquire() {
| // Now acquire the very first task
| createSession();
|
| try {
| jbpmContext.setActorId(actorName);
|
| // Now we search for all the tasks waiting for our actor
| List tasksActor = taskMgmtSession.findPooledTaskInstances(actorName);
|
| if (tasksActor.size() > 0) {
| TaskInstance task = (TaskInstance) tasksActor.get(0);
| task.setActorId(actorName);
|
| jbpmContext.save(task);
| }
| }
| catch(Exception e) {
| e.printStackTrace();
| }
| finally {
| // Tear down the pojo persistence context.
| try {
| closeSession();
| }
| catch(Exception e) {
| // If the Task is already taken you'll end up here
| e.printStackTrace();
|
| return false;
| }
| }
|
| return true;
| }
|
I'm not considering multi-threaded scenario, using synchronize would be a solution then. Catching the exception, like illustrated above, does not look like an elegant solution to me. Is there a better way?
Best regards,
Johan
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4011267#4011267
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4011267
19Â years, 2Â months
[JNDI/Naming/Network] - Getting the Initial Context for a EJB3 client
by toni
Hi,
I'm trying to get the initial context for a java client. I include ALL the client jars in the jboss/client/ directory, but I nevertheless get an exception:
What other jars do I have to include???
java -cp activation.jar:antlr-2.7.6.jar:avalon-framework.jar:commons-httpclient.jar:commons-logging.jar:concurrent.jar:ejb3-persistence.jar:getopt.jar:hibernate-annotations.jar:hibernate-client.jar:jacorb.jar:javassist.jar:javax.servlet.jar:jbossall-client.jar:jboss-annotations-ejb3.jar:jboss-aop-jdk50-client.jar:jboss-aspect-jdk50-client.jar:jboss-client.jar:jboss-common-client.jar:jbosscx-client.jar:jboss-deployment.jar:jboss-ejb3-client.jar:jboss-ejb3x.jar:jbossha-client.jar:jboss-iiop-client.jar:jboss-j2ee.jar:jboss-jaxrpc.jar:jbossjmx-ant.jar:jboss-jsr77-client.jar:jbossmq-client.jar:jboss-remoting.jar:jboss-saaj.jar:jboss-serialization.jar:jboss-srp-client.jar:jbosssx-client.jar:jboss-system-client.jar:jboss-transaction-client.jar:jbossws-client.jar:jboss-xml-binding.jar:jmx-client.jar:jmx-invoker-adaptor-client.jar:jnp-client.jar:juddisaaj.jar:log4j.jar:logkit.jar:mail.jar:scout.jar:trove.jar:wsdl4j.jar:xmlsec.jar -jar ~toni/projects/di/bin/import.jar
Exception in thread "main" javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.(InitialContext.java:197)
at de.pilati.hhe.client.OrganizerImport.getContext(OrganizerImport.java:91)
at de.pilati.hhe.client.OrganizerImport.(OrganizerImport.java:40)
at de.pilati.hhe.client.OrganizerImport.main(OrganizerImport.java:96)
Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
... 6 more
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4011266#4011266
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4011266
19Â years, 2Â months
[Installation, Configuration & Deployment] - My JBOSS is still pointing to JSF-RI instead of myfaces when
by ivan.indrawan
Hi there,
I am trying to use tomahawk with jboss seam but I have an early problem with myfaces. It seems that my application is still pointing to the sun implementation instead of myfaces. I have the following exception:
10:43:35,601 INFO [STDOUT] 10:43:35,586 ERROR [[/Epsilon]] Exception sending co
ntext initialized event to listener instance of class org.apache.myfaces.webapp.
StartupServletContextListener
java.lang.NoClassDefFoundError: com/sun/facelets/FaceletViewHandler
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
4)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(Webapp
ClassLoader.java:1815)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoa
der.java:869)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1322)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1201)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at org.apache.myfaces.shared_impl.util.ClassUtils.classForName(ClassUtil
s.java:131)
I have removed all the jsf-ri libraries from tomcat library and my project library.
Below is my web.xml file. Thank you beforehand for your help.
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<!-- Seam -->
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/navigation.xml</param-value>
</context-param>
<listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
<!-- Propagate conversations across redirects -->
<filter-name>Seam Exception Filter</filter-name>
<filter-class>org.jboss.seam.servlet.SeamExceptionFilter</filter-class>
<filter-mapping>
<filter-name>Seam Exception Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-name>Seam Redirect Filter</filter-name>
<filter-class>org.jboss.seam.servlet.SeamRedirectFilter</filter-class>
<filter-mapping>
<filter-name>Seam Redirect Filter</filter-name>
<url-pattern>*.seam</url-pattern>
</filter-mapping>
<!-- 120 second conversation timeout -->
<context-param>
<param-name>org.jboss.seam.core.manager.conversationTimeout</param-name>
<param-value>120000</param-value>
</context-param>
<!-- MyFaces -->
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<!-- My Faces Extensions Filter -->
<filter-name>extensionsFilter</filter-name>
<!-- <filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class> -->
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
<init-param>
<param-name>uploadMaxFileSize</param-name>
<param-value>100m</param-value>
<!--
Set the size limit for uploaded files.
Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB
-->
</init-param>
<init-param>
<param-name>uploadThresholdSize</param-name>
<param-value>100k</param-value>
<!--
Set the threshold size - files
below this limit are stored in memory, files above
this limit are stored on disk.
Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB
-->
</init-param>
<!--
<init-param>
<param-name>uploadRepositoryPath</param-name>
<param-value>/temp</param-value>
Set the path where the intermediary files will be stored.
</init-param>
-->
<filter-mapping>
<filter-name>extensionsFilter</filter-name>
<url-pattern>*.seam</url-pattern>
</filter-mapping>
<!-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.) -->
<filter-mapping>
<filter-name>extensionsFilter</filter-name>
<url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
</filter-mapping>
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.seam</url-pattern>
</servlet-mapping>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</web-app>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4011264#4011264
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4011264
19Â years, 2Â months
[JBoss Portal] - Header injection into Portal 2.4.1
by chuaky
dear all,
I was trying to do header injection following the guidelines in portal reference guide section 6.1.3. But what i got is a blank page.
My setup is :
- AS 4.0.5
- Portal 2.4.1
- Seam 1.1.5
- facelets
For this experiment, i modify the seam portal example, jboss-portlet.xml, as follows:
| <portlet-app>
| <portlet>
| <portlet-name>SeamBookingPortlet</portlet-name>
| <header-content>
| <link rel="stylesheet" type="text/css" href="/css/screen.css" title="" media="screen"/>
| <script type="text/javascript" src="/portlet-styles/HeaderContent.js"/>
| </header-content>
| </portlet>
| </portlet-app>
|
The HeaderContent.js is a file with simple script, as follows:
| // simple test java script
| function injectJS()
| {
| alert('hello from the injected java script!');
| }
|
There is a solved issue in portal 2.4.1 (http://jira.jboss.com/jira/browse/JBPORTAL-1173) but i am not sure if it is related to this problem here.
Please help,
Thank you in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4011258#4011258
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4011258
19Â years, 2Â months