Marc Gagnon

Greenhorn
+ Follow
since Dec 17, 2004
Marc likes ...
Eclipse IDE Firefox Browser
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Marc Gagnon

After looking around, I found that I can do this:
Add the following to conf/jboss-service.xml:
...
<mbean code="org.jboss.naming.JNDIBindingServiceMgr"
name="pm-urls:service=JNDIBindingServiceMgr">
<attribute name="BindingsConfig" serialDataType="jbxb">
<jndi:bindings
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jndi="urn:jboss:jndi-binding-service:1.0"
xs:schemaLocation="urn:jboss:jndi-binding-service:1.0 resource:jndi-binding-service_1_0.xsd"
>

<jndi:binding name="urls/jboss-home">
<jndi:value type="java.net.URL">http://www.jboss.org</jndi:value>;
</jndi:binding>

</jndi:bindings>
</attribute>
<depends>jboss:service=Naming</depends>
</mbean>

Then I see it in the global JNDI tree:
...
+- urls (class: org.jnp.interfaces.NamingContext)
| +- jboss-home (class: java.net.URL)

Which is fine.

As is, this is a working solution.

The only improvement I would like to see is:
How can I define the same behavior outside of the jboss-service.xml file?
The reason I'm asking is because I don't like the idea of adding to an existing configuration file.
When we install a new jboss from the distribution, I like to be able to unzip the whole package and then, only add the config file required.
If I keep the urls in the jboss-service.xml file, I cannot do this: I must open (manually or programmatically) the jboss-service.xml file and add the mbean section at the end.
I would prefer to simply copy a standalone file to do the same.
Any suggestion?
14 years ago
Problem:
Our EJBs and WARs (in an EAR) have references to an URL.
I want to deploy this URL in JNDI one time and resolve all references by linking on the deployed URL.
This is the same concept as websphere default URL provider, but how do I do that in jboss?
Which mbean can I use?
Do I have to define a special service?
Right now, I resolved the link using the jboss.xml file and it works. But I do not want to repeat this in each EJB.

Thank you.

My code uses a URL like this:
...
public static final String AUDITLOG_PATH = "java:comp/env/AuditLogPath";
...
Object rep = new InitialContext().lookup(InternalJNDIRefererences.AUDITLOG_PATH);

In ejb-jar.xml:
...
<resource-ref>
<description></description>
<res-ref-name>AuditLogPath</res-ref-name>
<res-type>java.net.URL</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

In jboss.xml:

<enterprise-beans>

<session>
<ejb-name>xyz</ejb-name>
<resource-ref>
<res-ref-name>AuditLogPath</res-ref-name>
<resource-name>AuditLogPath</resource-name>
</resource-ref>
</session>
...
...
<resource-managers>
<resource-manager>
<res-name>AuditLogPath</res-name>
<res-url>file:///c:/audit/audit.log</res-url>;
</resource-manager>

</resource-managers>

This works:
UserTransaction (class: javax.transaction.UserTransaction)
+- env (class: org.jnp.interfaces.NamingContext)
| +- ejb (class: org.jnp.interfaces.NamingContext)
| | +- ConfigurationManager[link -> ConfigurationManager] (class: javax.naming.LinkRef)
| +- AuditLogPath (class: java.net.URL)

But I don't want to duplicate the URL definition in all WARs and EJBs jboss xml config.

How can I define something I can deploy in server/default/deploy ?
Which mbean can I reuse to deploy URLs like in websphere URL provider?
14 years ago
Hi,

I am using WSAD 5.1.0 and I would like to clarify how to set classpath in manifest.

In my dynamic web project, I want to use XStream which uses among other jars the xalan-2.4.1.jar and xercesImpl-2.4.0.jar (with these exact names).

In my DefaultEAR project, I copied xalan-2.4.1.jar and xercesImpl-2.4.0.jar at the root of the project.

Back in the dyn. web project, I opened the properties, go in "Java JAR Dependencies" and I can see xalan-2.4.1.jar in the available dependent JARs (which lists the content of the DefaultEAR). I mark the xalan checkbox.

So far so good.

Back in the DefaultEAR, I now see the following error message:
"IWAE0024W The Manifest Class-Path for archive xalan-2.4.1.jar contains an entry xercesImpl.jar, that is now resolvable to a file or module in the EAR: DefaultEAR".

The Xstream (or other component) is using specific names like xalan-2.4.1.jar or xercesImpl-2.4.0.jar... But xalan-2.4.1.jar itself needs xercesImpl and its MANIFEST file has an entry without a version name for this.

What should I do? Should I rename xercesImpl-2.4.0.jar --> xercesImpl.jar?

Seems like I'm loosing an important visual information.

Is there a better way to handle utility jars?
15 years ago
Hi,

I agree there is a part of the process that requires pure memorization.

However, consider how many times you will focus on all those details:
hopefully, only one time in your Java career (unless you take an upgrade exam).

Is this investment required? I think so. Maybe you will eventually forget many minor details but at least you will remember they exist and know exactly where to look to find an answer.

I remember studying many details thinking that my understanding was good... Mock exams told me otherwise, forcing me to study until I truly understand each detail.

I passed SCJP 1.4 with only three errors, a pretty good score.

But I also know that passing the test today, a year later, my score would not be that good because I already forgot some minor syntax rules that any IDE catches automatically.

Investing 8 to 12 weeks (12-16 hrs per week), focusing on all details, one time in a Java career seems fair enough to me.
I looked at the FAQ and made a google search but I don't find references to the following phrasing error:

We can read this in http://java.sun.com/j2se/1.4.2/docs/api/ for class Object:

...
Otherwise, this method creates a new instance of the class of this object and initializes all its fields with exactly the contents of the corresponding fields of this object, as if by assignment; the contents of the fields are not themselves cloned.
...

I think we should read "as is by assignment;" intead of "as if by assignment;" the idea being that a direct assignment is a shallow copy and that is consistent with the spec being explained.

Maybe my English is not good enough but my understanding is that "as is" makes much more sense than "as if".

What do you think?
Hi,

I am following the Rational software developper tutorial gallery "Do and learn" - Create EJB components using UML modeling tools - 1.4 = Mapping entity beans to relation databases.

I was successfully following the tutorial and I decided to add a new field to the Book entity bean => isbn. At some point, I got a compilation error because I did not promote the field to the interface. I fixed that, got another error... At some point I was to confused, I deleted "Map.mapxmi" to start over... Now the sample project is in a weird state. When I "clean" the project, the generated file are not refreshed.

My question is:

How do I proceed to really clean up the generated files and be able to redo the mapping (I simply want to continue following the tutorial!!!).

Thx
16 years ago